Garry's Mod Wiki

constraint.Motor

  Entity, Entity constraint.Motor( Entity ent1, Entity ent2, number bone1, number bone2, Vector localPos1, Vector localPos2, number friction, number torque, number forcetime, number nocollide = 0, number toggle = false, Player player = NULL, number forcelimit = 0, number key_fwd = nil, number key_bwd = nil, number direction = 1, Vector localAxis = nil )

Description

Creates a motor constraint, a player controllable constraint.Axis.

Arguments

1 Entity ent1
First entity.
2 Entity ent2
Second entity.
3 number bone1
PhysObj number of first entity to constrain to. (0 for non-ragdolls).

See Entity:TranslateBoneToPhysBone.

4 number bone2
PhysObj number of second entity to constrain to. (0 for non-ragdolls). Must be different from bone1.

See Entity:TranslateBoneToPhysBone.

5 Vector localPos1
Position relative to the the first physics object to constrain to.
6 Vector localPos2
Position relative to the the second physics object to constrain to.
7 number friction
Motor friction.
8 number torque
Motor torque.
9 number forcetime
Automatic shut-off after this time has passed. A value of 0 means to stay on forever or until deactivated.
10 number nocollide = 0
Whether the entities should be no-collided.
11 number toggle = false
Whether the constraint is on toggle.
12 Player player = NULL
The player that will control the motor. Used to to call numpad.OnDown and numpad.OnUp.
13 number forcelimit = 0
Amount of force until it breaks (0 = unbreakable)
14 number key_fwd = nil
The key binding for "forward", corresponding to an KEY enum
15 number key_bwd = nil
The key binding for "backwards", corresponding to an KEY enum
16 number direction = 1
Either 1 or -1 signifying which direction the motor should spin.
17 Vector localAxis = nil
Overrides axis of rotation?

Returns

1 Entity
The created constraint. (phys_torque) Will return false if the constraint could not be created.
2 Entity
The created axis constraint. (phys_hinge) Will return nil if the constraint could not be created.