Move From One Entity To Another

Move From One Entity To Another

You are here:
← All Topics

You can move any object from one position to another position. Those positions can be either X,Y,Z values in 3D space or an entity name for example:

player is a gemini having pos=(0,-2,0)
enemy is a dragon having pos=(-4,2,-30)
fireball is a sphere having material="pond" and pos=(enemy)
fireball.move to (player+10) in 5 seconds

In this sample code we created a player (gemini space ship) and enemy (dragon) entities and then created a sphere at initial position the same as enemy then moved the fireball to the player + 10 meters in 5 seconds.
The fireball will move towards the player and will make 10 more meters after reaching it.
You can choose to move to a specific 3D location for example:

fireball.move to(0,-2,0) in 5 seconds

Or:

fireball.move to(player.x,player.y,player.z) in 5 seconds

These forms of movement will yield the same results except that move to(player+10) is the only form which can auto calculate the 10 more meters length

Previous Move A 3D Model Or Sprite
Next Playing Audio Files