Jump to content
  • Advertisement
Sign in to follow this  
vurentjie

camera space help

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

hi, i have been trying to write a camera class in actionscript, as i have understood and tried to implement, all points needed to be transformed by the inverse of the camera transform before being projected, i have tried this by first finding the inverse of the 4x4 camera matrix, where i have just focused on the 3x3 rotation part and the translation part, after finding this i have assumed the following CameraMatrixInverse X CoordinateMatrix = TransformedCoordinateMatrix; For the most part the inverse camera matrix seems correct, after calculation the rotation part has been transposed, but I am not sure about the translation part, the reason is if the point's original position is at <0,0,0> the translation is correct relative to the cameras total transform(a translation and rotation), if the point's original position is at <1,0,0> and i just translate the camera 4 units up the x-axis the transformed point is now at <-3,0,0> which seems correct, and if i rotate the camera by 90 degrees about the y-axis the transformed point calculates to <0,0,3>, but i am not quite sure if this is entirely correct... i am sure i am missing something, possibly some kind of camera direction vector, and the more i try to visualize the implementation the more confused i get, i have made a diagram of what is confusing me. You can view it here http://www.skyfies.net/troubleshoot.php Advice, clarification and correction is much appreciated

Share this post


Link to post
Share on other sites
Advertisement
ok i havent had any replies yet, usually i think this is because i havent explained myself well enough,

anyhow, i think i have figured out some of my problem,

is it correct to say that if i translate my camera then rotate it, then the inverse will also mean an inverse order of operations so for

cam translate -> cam rotate
the inverse transform would be
cam inverserotate -> cam negate translate


Share this post


Link to post
Share on other sites
Quote:
is it correct to say that if i translate my camera then rotate it, then the inverse will also mean an inverse order of operations so for

cam translate -> cam rotate
the inverse transform would be
cam inverserotate -> cam negate translate
That's correct.

Note that the order in which the original transforms are applied would typically be rotate->translate, not translate->rotate. I'm assuming though that what you're referring to here is multiplication order (using column-basis matrices).

Share this post


Link to post
Share on other sites
ok thanks,

i was just trying to figure it out there logically without thinking about it as a matrix operation. But anyway i feel kinda chuffed and silly at the same time, as i did manage to debug my problem.

i was testing with hardcoded figures so i translated the camera 4 units up x,
then i rotated it 90 degrees

so i set a hardcoded camera matrix (not the inverted one) up as follows

0 -1 0 4
1 0 0 0
0 0 0 0
0 0 0 1

can you see the mistake?
if the rotation part was like that but i did the translation first then then
x-translation should be 0, and the y-translation should be 4 like so,

0 -1 0 0
1 0 0 4
0 0 0 0
0 0 0 1

but alas because i just shoved the figures in there and it completely slipped by.
just glad to know that it is working now...made me really tired second guessing myself.


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!