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;
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.
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¶
AttachPosition¶
Where the attachment's attach point is, in the attachment's space.
public Vector3 AttachPosition { get; }
Property Value¶
Attached¶
What is attached, or 0.
public Entity Attached { get; }
Property Value¶
Class¶
What the registry knows about this object's class.
public override ClassInfo Class { get; }
Property Value¶
HitchEntity¶
The entity that is the hitch's frame, under the vehicle's entity.
public Entity HitchEntity { get; }
Property Value¶
IsAttached¶
public bool IsAttached { get; }
Property Value¶
Kind¶
public HitchKind Kind { get; }
Property Value¶
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¶
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()