What I mean is that I want to take a position (e.g. the position of object1) and a directional vector (e.g. object1’s forward vector), then set the position of object2 to the object1’s position plus 3 on object1’s forward vector so that object2 appears in front of object1. Sorry if that was complicated. Thanks again. I tried the add function, but it didn’t work.
Thank you. See, this is where I’m confused. This is my code attempt at making a third person camera (note this script is attatched to the camera and “target” is the player):
//camVector is now the target's forward
camVector = this.target.forward.clone();
//attatches the forward vector to the player so that the camera's final position is based off the player
//declaring the quaternion and setting it to a 45 degree rotation around the targets right vector to make the camVector be slightly above the player
q = new pc.Quat();
//using the quaternion to rotate the camVector
//making the camVector go backwards, behind the player
//making the camera go to the camVector
//this does not work at all, the movement of the camera is not intended and hard to explain
And, to me at least, the code looks pretty similar, so I’m not too sure what I did wrong. Did I do it in the wrong order or something?