I am having more problems with my threejs code. I have got the camera working properly as an FPS camera, but the WASD movement is having some problems. I am using the camera.getWorldDirection to change the movement direction whilst the player is still trying to move.
var direction = new THREE.Vector3();
var direction = camera.getWorldDirection(direction);
if(evt.keyCode == 87){ // W key
camera.position.add(direction.multiplyScalar(distance));
}
However, I do not want the players Z axis to be changed during this. Currently it is like a freecam mode, and is very jerky. I want to smooth this and not effect the z axis. The player cannot be able to fly!
Also, for the D key, how can i reverse this? If anyone has a better way of doing this pls let me know.
No one has answered in a day so I would appreciate if someone could help me out
Thanks for your reply. The only problem is that it might be difficult for me to implement this into socketio as well. I was planning on making custom movement such as bhopping, slide hopping walljumping. I guess I’ll have to do more research.