Binding a Camera to an Object
Binding a Camera to an Object
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!
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
Similar topics
» Camera or Object
» How to bind the camera to a object
» Camera / object movement
» Rotate the camera instead of the object...
» Static Camera to follow an Object
» How to bind the camera to a object
» Camera / object movement
» Rotate the camera instead of the object...
» Static Camera to follow an Object
Permissions in this forum:
You cannot reply to topics in this forum