# 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.

## 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 on other sites
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 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 forcam translate -> cam rotate the inverse transform would becam 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 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.

1. 1
2. 2
Rutin
18
3. 3
khawk
15
4. 4
A4L
14
5. 5

• 10
• 13
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633745
• Total Posts
3013667
×