Attaching 2D/3D Entity To Another 3D Model

Attaching 2D/3D Entity To Another 3D Model

You are here:
← All Topics

There are times where you will need to attach either a 2D sprite or a 3D model to another 3D model for example adding a 2D sight sprite to a space-ship:

skybox.show "lagoon"
ship is a gemini
s is a sight sprite
s.attach to ship having pos=(0,1,3)
ship.turn left 360 in 10 seconds

In the above sample code we create a “gemini” 3D space ship and attach a 2D “sight” sprite to it. Then when we rotate the ship 360 degrees you can see how the 2D sight is rotated as well because both entities are attached.
Notice the pos=(0,1,3) attribute. This position the 2D sight 1 meter up and 3 meters forward to the gemini space ship.