Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ThaUnknownProgga

D3d Camera position type question

This topic is 6726 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

I have my engine currently utilizing the view world and perspective matrices after a long time of static renderings. The matrix code i''m using is basically the same as on this page: http://www.ziron.com/links/directx/drawprim.htm This implemention is alright except I can''t seem to get the location of the camera. This is because it''s just a view matrix, not an actual camera implementation, but i''ve had a lot of trouble implementing a camera system. i was wondering how then to get the current position of the view matrix, or help on creating a good camera system. thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I have just posted a camera routine in the thread "How do I re-align orientation". It uses LookFrom -> LookAt system, with a RollAngle. Check that thread, and ask any questions about it.

Share this post


Link to post
Share on other sites
Although I highly recommend creating a camera class, you can get the position of the camera by first inverting the view matrix and then reading the fourth row in the matrix.

- WitchLord

Share this post


Link to post
Share on other sites
Ok then could you help me with a few questions I have?

first of all, how should my camera class be organized? Should it contain a vector (the position of the camera) and a matrix (the orientation of the camera)? If so, how do i maintain the position of the camera after applying things like rotations and transformations to the matrix? And finally, should I just create a new view matrix every time i update my camera using the origin/lookat/up direction vectors?

thanks for the help so far, and thanks in advance

Share this post


Link to post
Share on other sites
Create a new view matrix from scratch every time it needs to be changed. This can be done with the help of position, lookat, and up vectors, but there is also other ways. For example with, position vector and yaw, pitch, and roll angles. You can go one step further and always keep three vectors describing the orientation of the camera, namely the front, right and up vectors of the camera. And then there is the buzz word quaternions .

Choose which ever model is most fitting to what type of camera your class is going to represent. The important thing to remember is that it is most efficient to rebuild the matrix every time it changes, otherwise you''ll have to deal with recalibration of the matrix and other stuff to avoid numerical errors.

- WitchLord

Share this post


Link to post
Share on other sites
Ok, I created a class that contains a D3DVECTOR Position and a D3DMATRIX Axis. However, every time i call my functions to rotate a matrix the function begins by setting the matrix to an identity matrix. Thus I have no clue how to properly keep track of my position vector.
Is this how i should be doing this? or should i just keep track of 4 vectors, position, lookat, up, and right? If so, how would i calculate how to rotate these vectors properly and translate correctly?

Share this post


Link to post
Share on other sites
Ok, well it''s actually not being set to an identity matrix each time. Anyway, I can''t figure out how to translate my point according to the Matrix defining my alignment.

Share this post


Link to post
Share on other sites
Hmm, that tutorial was a help, but i refuse to use the D3DX stuff. The one thing i need to know how to do was done through the function D3DXVec3TransformCoord, so i still can''t figure out how to do this!


How do I translate a point through a matrix?

Share this post


Link to post
Share on other sites
What would be the proper way to calculate a World Matrix if I have a position and a matrix describing orientation?

Edited by - ThaUnknownProgga on July 13, 2000 5:43:30 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!