Model moving sideways off camera

Started by
0 comments, last by iedoc 12 years, 4 months ago
Hi there second post on these forums but i have a rather weird problem. As displayed in the picture below, is how i want a sword to display on the camera even when rotating the camera, however, when i am running on an angle from the forward vector the sword that is suppose to be pinned to the camera slowly slides off the camera.

Here is my update code for the sword position:


position = new Vector3(camera.Position.X + 8f, camera.Position.Y, camera.Position.Z - 20f);


However i feel like this is not properly setting the position of where the sword is suppose to be.

378973_10151052425630257_743435256_21689626_1519994202_n.jpg
Advertisement
There doesn't seem to be anything wrong with this line of code. Are you updating the swords positions somewhere else? otherwise, maybe your updating the cameras position after your updating the swords position. If this is the only line of code updating the sword, i'm guessing the problem is your camera. could you post all the lines that update the camera and the sword? and say whether the sword or camera is updated first (although i don't think updating the camera after the sword would cause a sliding effect, but it's good to think of all possibilities)

This topic is closed to new replies.

Advertisement