Skip to content

CVR Attachment

Attaches a GameObject to a bone, tracker, or snapping point. Useful for hats, glasses, or any prop that needs to stick to a specific part of an avatar or another prop. Runs with a high DefaultExecutionOrder (16000) so it can update after most IK / animation work.

AttachmentType flag enum (any combination):

  • Bone — match against an avatar humanoid bone.
  • Tracker — match against a camera / controller / additional tracker.
  • SnappingPoint — match against a CVRSnappingPoint.

The internal attach pass prioritises SnappingPoint, then Tracker, then Bone.

BoneType flag enum. Valid bones: Hips, Spine, Chest, UpperChest, Neck, Head, LeftUpperLeg, LeftLowerLeg, LeftFoot, RightUpperLeg, RightLowerLeg, RightFoot, LeftShoulder, LeftArm, LeftForearm, LeftHand, RightShoulder, RightArm, RightForearm, RightHand, Root (avatar root transform). Multiple bones can be selected; the closest is picked.

TrackerType flag enum: MainCamera, LeftHand, RightHand, AdditionalTracker. Again, the closest matching transform is picked.

List<string>. Filters which CVRSnappingPoint.type values this attachment will accept.

float. Maximum distance from a candidate transform at which the attachment will engage. If set to 0, distance is ignored.

bool. When the attachment is made to a humanoid bone, use the IK system’s BoneCalibrationData to convert the inspector-specified position / rotation offsets into bone-local space scaled by the play-space scale. Produces consistent placement across avatars with different proportions.

bool. When true, apply positionOffset directly instead of sampling the object’s current offset from the attachment point.

bool. When true, align to the attachment’s rotation times Quaternion.Euler(rotationOffset) instead of preserving the current object rotation.

Vector3. Offsets relative to the bone / tracker / snapping point.

CollisionWithPlayer enum (default DisableWhileHeld). Same values as on CVR Pickup Object: DisableWhileHeldAndColliding, DisableWhileHeld, DontDisable.

UnityEvent. Called when the attachment is made / released. Self-call recursion into the component is disabled at Start via UnityEventsHelper.DisableCallsToSelf.

  • Attach() — request attachment; resolved on the next late-update pass.
  • Attach(InteractionContext) — attachment-gated variant used by trigger actions.
  • DeAttach() — release; zeros the attached transform and fires onDeattach.
  • IsAttached() — true while attached. For SnappingPoint attachments, also requires the target to be active and enabled.
  • ShouldSync(int depth = 0) — used by CVRSpawnable to decide whether this client is authoritative for the carrier prop. Follows SnappingPoint chains up to depth 10.
  • AnimEventAttach(AnimationEvent) / AnimEventDeAttach(AnimationEvent) — animation-event entry points guarded by InteractionContext.ShouldExecuteAttachment.

CVR-GameFiles/ABI.CCK.Components/CVRAttachment.cs