Move Object Based on Camera's Direction
Members - Reputation: 207
Posted 03 September 2012 - 11:18 AM
To calculate the position, I thought I’d simply put the position of the object into a new vector3, add to it’s z value like before, and then transform that vector by the view matrix and then set the object's position vector to the new vector3- however, this is not working as expected.
How can I transform my move (position) vector based off the camera’s looking direction?
Members - Reputation: 120
Posted 03 September 2012 - 11:38 AM
look here, matWorld is your position
Crossbones+ - Reputation: 5132
Posted 03 September 2012 - 11:43 AM
This is the direction in which you should move your object (backward - negate to move forward).
Just multiply the vector by the world distance you want to move the object, then add it to the object's position.
Moderators - Reputation: 13278
Posted 03 September 2012 - 11:44 AM