Hitch¶
Extends EngineObject.
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; Attach takes the attachment's entity and the attach point in the attachment's space, which meets the hitch's frame. Make one with PhysicsWorld.CreateHitch. A hitch holds one body at a time; the pair do not collide while hitched.
Properties¶
hitch_entity: EntityThe entity that is the hitch's frame, under the vehicle's entity. Read-only.kind: HitchKindRead-only.attached: EntityWhat is attached, or 0. Read-only.is_attached: booleanRead-only.angular_limits: Vector3A trailer hitch's swing limits about the hitch's X, Y and Z, in degrees (default 25, 75, 15: pitch, yaw, roll).attach_position: Vector3Where the attachment's attach point is, in the attachment's space. Read-only.
Methods¶
attach¶
function attach(self, attachment: Entity, point: Vector3, pointRotation: Quat): boolean
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.
detach¶
function detach(self): ()
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.