Motor
The motor allows you to control what the bearings and pistons should do.
Both normal bearings and spring bearings (suspension) that are connected to the motor are controlled by the bearing functions.
If power is enabled, the motor uses power based on its settings. Bearings use power based on their speed and torque, and pistons based on their speed and force, per connected bearing/piston. When the motor loses power, all of its settings (speed, torque and force) are reset to 0.
Functions
setBearingSpeed
Motor.setBearingSpeed( speed )
Sets the bearing(s) speed
Arguments:
- speed [ number ] The speed to set to bearing(s), in degrees per second. Cannot be infinite.
setBearingAngle
Motor.setBearingAngle( angle )
Sets the bearing(s) angle. Set it to nil to turn into an engine, or else (a number) to a controller.
Arguments:
- angle [ number? ] The angle to set to bearing(s), in degrees. Cannot be infinite.
setPistonSpeed
Motor.setPistonSpeed( speed )
Sets the piston(s) speed.
Arguments:
- speed [ number ] The speed to set to piston(s). Negative values are treated as positive. Cannot be infinite.
setTorque
Motor.setTorque( torque )
Sets the bearing(s) torque.
Arguments:
- torque [ number ] The torque to set to bearing(s). Cannot be negative or infinite, or else an error is thrown.
setLength
Motor.setLength( length )
Sets the piston(s) length.
Arguments:
- length [ number ] The length to set to piston(s). Cannot be negative or infinite, or else an error is thrown.
setForce
Motor.setForce( force )
Sets the piston(s) force.
Arguments:
- force [ number ] The force to set. Negative values are treated as positive. Cannot be infinite.
getCurrentAngle
Motor.getCurrentAngle()
Gets the bearing's current angle. Note that only 1 bearing can be connected! (Spring bearings count as bearings too.)
Returns:
- [ number ] The current angle, in degrees.
getCurrentLength
Motor.getCurrentLength()
Gets the pistons's current length. Note that only 1 piston can be connected!
Returns:
- [ number ] The current length.