User Tools

Site Tools


en:tutorials:cameras:fixing_camera_to_object_by_parenting

Fixing the Camera to an Object by Parenting

If you wish the camera to be fixed on a moving object, like a camera handle (which you can apply FX to), you can parent the camera to an object.

Code

orxSTATUS orxFASTCALL Init()
{
...
 
    orxVIEWPORT *viewport = orxViewport_CreateFromConfig("Viewport");
    orxCAMERA *camera = orxViewport_GetCamera(viewport);
 
    orxOBJECT *cameraHandle = orxObject_CreateFromConfig("CameraHandle");
 
    orxCamera_SetParent(camera, cameraHandle);
 
...

You can also do this using a Clock to continually re-position a camera on to an object's position.

en/tutorials/cameras/fixing_camera_to_object_by_parenting.txt · Last modified: 2019/01/15 06:47 (17 months ago) (external edit)