jeromeetienne / threex.spaceships

three.js extension to get spaceships
http://jeromeetienne.github.io/threex.spaceships/examples/basic.html
MIT License
24 stars 12 forks source link

Animate The Spaceship #4

Open faizalmuzakki opened 5 years ago

faizalmuzakki commented 5 years ago

var enemy = new THREEx.SpaceShips.loadSpaceFighter02(function(object3d){ object3d.position.x = 0 object3d.position.z = 20 scene.add(object3d) })

how to get the enemy position? because i wanna do looping for the z position, so the spaceship apporaching. like enemy.position.z (?) but this give me an error. pls help

faizalmuzakki commented 5 years ago

var spaceship = null; THREEx.SpaceShips.loadSpaceFighter03(function(object3d){ scene.add(object3d) spaceship = object3d spaceship.position.x = 0 spaceship.position.z = 20
})

this code gives me error -> spaceship is undefined