Binding a Camera to an Object

View previous topic View next topic Go down

Binding a Camera to an Object

Post  samson on Sun Dec 14, 2008 6:35 pm

Hey everyone,
I am trying to get my camera to follow an object and remain a set distance behind it, like in a 3rd person flying game where you always see the same view of the plane from the camera. Is it possible to do this with the orbit function? I have been tweaking tutorial09 to try to get this working, but I can't get the camera to rotate with the object. The camera just stays in the same fixed position relative to the object and watches it rotate. In tutorial09 the object's rotation is set to match the camera's rotation, but my object has a rigidbody and will be altered by collisions, so I need the opposite: for the camera to match to the object's rotation.

I have no problem getting the camera to track the object by linking the camera's x y and z coordinates to the objects,' but I can't seem to be able to access the object's updated rotation data. When I use object->rot->z it uses the objects z-rotation as exported by blender, but it doesnt update to the object's current rotation after collisions have occurred. I guess what I need is a way to access the rigidbody's current rotation. Perhaps with object->_btRigidBody->getOrientation()? Is there any way to get euler rather than quaternion?


...Also, so there is no CameraRotateY? Does that mean there is no way to rotate a camera on it's y axis? Or is there an update matrix sort of thing for cameras that would allow you to use rot->y?

Thanks a bunch guys!

samson

Posts : 27
Join date : 2008-11-29

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum