Skip to content

Class Hitch

Namespace: Apogee.Physics
Assembly: Apogee.Physics.dll

A hitch on a vehicle: a point on its body where an attachment or a trailer is attached. The hitch is an entity under the vehicle's, whose transform is the hitch's frame in the vehicle's space; takes the attachment's entity and the attach point in the attachment's space, which meets the hitch's frame. Make one with . A hitch holds one body at a time; the pair do not collide while hitched.

public sealed class Hitch : EngineObject

Inheritance

object ← EngineObject ← Hitch

Inherited Members

EngineObject.IsAdopted, EngineObject.Handle, EngineObject.IsDestroyed, EngineObject.Class, EngineObject.Adopt(), EngineObject.TryGet(SlotHandle, out EngineObject), EngineObject.Destroy(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks

A mounted attachment leaves the simulation: its collision shape is added to the truck's body (so the truck feels what the attachment hits) and its mass is added to the truck's. Its entity becomes a child of the hitch entity (placed at the inverse of the attach point), so the transform cascade carries it and moving the hitch entity lifts it. gives it a body again, where it is, moving as the truck point it was at. Both ends are restored when either body goes away.

Properties

AngularLimits

A trailer hitch's swing limits about the hitch's X, Y and Z, in degrees (default 25, 75, 15: pitch, yaw, roll).

public Vector3 AngularLimits { get; set; }

Property Value

Vector3

AttachPosition

Where the attachment's attach point is, in the attachment's space.

public Vector3 AttachPosition { get; }

Property Value

Vector3

Attached

What is attached, or 0.

public Entity Attached { get; }

Property Value

Entity

Class

What the registry knows about this object's class.

public override ClassInfo Class { get; }

Property Value

ClassInfo

HitchEntity

The entity that is the hitch's frame, under the vehicle's entity.

public Entity HitchEntity { get; }

Property Value

Entity

IsAttached

public bool IsAttached { get; }

Property Value

bool

Kind

public HitchKind Kind { get; }

Property Value

HitchKind

Methods

Attach(Entity, Vector3, Quaternion)

Attaches the body of attachment so that its point point (turned by pointRotation), in the attachment's own space, meets the hitch. False if the hitch holds something already. A mounted attachment must be a dynamic or kinematic body without a vehicle; a trailer may be a vehicle.

public bool Attach(Entity attachment, Vector3 point, Quaternion pointRotation)

Parameters

attachment Entity

point Vector3

pointRotation Quaternion

Returns

bool

Detach()

Lets the attachment go. A mounted one gets a body of its own again where it is (it keeps moving as the point of the vehicle it was at, and its mass leaves the vehicle); a trailer's joint goes. A mounted entity is put back under the hitch's parent... in the world, in its place: it is a root again.

public void Detach()

OnDestroyed()

protected override void OnDestroyed()