FixObjectToCamera

Description

Fixes an object to a camera so that any movement of the parent also affects the child. The object being fixed uses its current position, rotation, and scale as an offset to the parent. For example if the camera was placed at 10,5,0 and an object was fixed to it with the current position 0,10,0 then the object would now inherit the position of the camera, combine it with its own, and the object would be placed at 10,15,0. The same applies to rotation and scaling, so if the camera was rotated around the Y axis then the object would rotate by the same amount.

Note that using GetObjectY on the child would only show its local position relative to its parent (in this case it would return 10). To get the final world position of the child use GetObjectWorldY on it, which in this case would return 15. There is no limit to the number of objects a camera can have fixed to it, nor is there a limit to objects being fixed to objects which are fixed to cameras, just don't create any loops.

An object can only be fixed to one thing at a time, fixing it to something else will remove it from its current attachment (if any). To stop an object being fixed to anything set toObjID to 0 and it will become independent again.

Definition

FixObjectToCamera( objID, toCameraID )

Parameters