Table of Contents

Property UserData

Namespace
Box3D
Assembly
Box3D.NET.dll

UserData

Gets or sets the application identifier attached to this shape.

public ulong UserData { get; set; }

Property Value

ulong

Examples

head.UserData = (ulong)HitZone.Head;
torso.UserData = (ulong)HitZone.Torso;

RaycastHit hit = world.RaycastClosest(muzzle, aim * range);
float damage = (HitZone)hit.Shape.UserData == HitZone.Head ? 100 : 25;

Remarks

Separate from the body's identifier, which is what makes it useful: a body can carry the entity id while each of its shapes carries which part of that entity it is, so a hit can be attributed to the head rather than merely to the character. See Box3D.UserData.