Sign in to follow this  

DirectX camera issue

This topic is 3580 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay you linear algebra masters, I need some help. I have a camera that needs to be attached to a certain point within a model that will rotate on all axes. The details: Our model rotates using three floats representing the angle of rotation on each axis in radians. It has a position vector that represents its location in the world. Our camera needs to attach to a spot in the model, offset from the model's position. The model can and will rotate on all axes. We rotate the camera around the model's position so that it maintains its proper position inside the model. The problem: The horizon needs to be level. We need to get the camera to roll back so that the Y-axis is straight up, but without losing the position we found once we rotated with the model. Once we have rolled the camera into the right position, we need to rotate the camera again at that position. So far we just get the camera moving back as if we rolled it around a point, rather than in place. We have tried multiple variations of calculations, but we continue to miss some detail that is ruining our position once we try to level the camera. Anyone have suggestions?

Share this post


Link to post
Share on other sites
New camera problem!

This time I'm working with a first-person camera for a character in the program. It moves and looks based on using input, along with being attached to a model moving in the world.

I have a position vector and rotation matrix based on user input, then I have the position and rotation of the model the character is on. Currently I have everything rotation and moving correctly except for one issue. With the model rotates, the character does the proper world rotation to stay in its place on the model. However, its local rotation on the X (looking up and down)becomes screwed. At a 90 degree world rotation, a local X rotation acts like a local Z-rotation.

I've found that I can create the same problem by doing the local X rotation before the local Y rotation and turning 90 degrees.

Currently, the matrix math is like this:
mFinal = localRot * userPos * modelRot * modelPos

Any suggestions on fixes?

Share this post


Link to post
Share on other sites

This topic is 3580 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this