Im trying to create a very light crowd simulation with threejs, but i dont know how to apply the direction it is to the rotation, so that it moves in the right direction. Anyone have any solutions?
I would use Vector3.addScaledVector, so that you can pass your direction vector and give a “speed” scalar :
const myObject = new THREE.Object3D(); const myDirection = new THREE.Vector3( 1, 0, 0 ); const speed = 0.1; myObject.position.addScaledVector( myDirection, speed );
Also getWorldDirection, in case you don’t know the direction.