PDA

View Full Version : rotating camera and object positions


rdg
02-12-2007, 08:34 AM
I have a camera that rotates around its local z axis - I animated the roll-parameter.
How do I calculate if an given object is left or right of the camera center at a given frame?

Is this way correct:
I calulate the angle between the loca z axis of the object and the loca y axis of the camera against a plane defined by camera.pos, object.pos and the camera local x axis?

**edit:
to make it even more interesting:
I realise that my objects are rotated around an aritrary axis, so their local z axis is of no use ...

** edit

Georg

rdg
02-12-2007, 09:01 AM
this helped : camera view and projection matrices (http://forums.cgsociety.org/showthread.php?f=98&t=461202)

as I just need some quantitiv values.

Georg

JohnSwafford
02-12-2007, 09:07 AM
in coordsys MyCamera, at time t (local PosInCamSpace = MyObject.pos)

--if (PosInCamSpace.x <0) then the object is to the left of the camera center.
--if (PosInCamSpace.x >0) then the object is to the right of the camera center.

rdg
02-12-2007, 09:21 AM
:eek:
This was my first attempt ... I nested the coordSys & at time stuff in an invalid way and it returned always the same position ...

thank you !

CGTalk Moderation
02-12-2007, 09:21 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.