| Property | Value |
|---|---|
| Native Name | HARD_ATTACH_CAM_TO_ENTITY |
| Hash | 0x202A5ED9CE01D6E7 |
| Return Type | void |
| Parameters | cam (Cam), entity (Entity), xRot (float), yRot (float), zRot (float), xOffset (float), yOffset (float), zOffset (float), isRelative (BOOL) |
Description: Attaches a camera to an entity, including full matrix transformations for both rotation and position offsets.
NativeDB Introduced: v2189
Parameters
cam(Cam) — The camera handle.entity(Entity) — The entity handle.xRot(float) — X-axis rotation.yRot(float) — Y-axis rotation.zRot(float) — Z-axis rotation.xOffset(float) — X-axis offsetyOffset(float) — Y-axis offsetzOffset(float) — Z-axis offsetisRelative(BOOL) — Whether or not the camera position will be relative to the entity rotation
Examples
-- assuming that the obj variable was created earlier in the script
local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
-- attaches the camera to the object rotated 90 degrees and offset 10 x values
HardAttachCamToEntity(cam, obj, 0.0, 0.0, 90.0, 10.0, 0.0, 0.0, true)
-- renders the camera
RenderScriptCams(true, false, 0, true, true)
// assuming that the obj variable was created earlier in the script
const cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
// attaches the camera to the object rotated 90 degrees and offset 10 x values
HardAttachCamToEntity(cam, obj, 0.0, 0.0, 90.0, 10.0, 0.0, 0.0, true)
// renders the camera
RenderScriptCams(true, false, 0, true, true)
using static CitizenFX.Core.Native.API;
// assuming that the obj variable was created earlier in the script
int cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true);
// attaches the camera to the object rotated 90 degrees and offset 10 x values
HardAttachCamToEntity(cam, obj, 0.0f, 0.0f, 90.0f, 10.0f, 0.0f, 0.0f, true);
// renders the camera
RenderScriptCams(true, false, 0, true, true);