Struct LinearMotor
Used for configuring the linear motor drive of a joint.
Namespace: Motphys.Rigidbody
Assembly: solution.dll
Syntax
[Serializable]
public struct LinearMotor
Fields
Default
Declaration
public static readonly LinearMotor Default
Field Value
Type | Description |
---|---|
LinearMotor | The default configuration of the linear motor. Note: The use property is false by default |
maxForce
Declaration
public float maxForce
Field Value
Type | Description |
---|---|
System.Single | The maximum force the motor can apply to achieve the target position and target speed. Non-positive value means disable the motor. |
spring
Declaration
public SpringDamper spring
Field Value
Type | Description |
---|---|
SpringDamper | The spring used to drive the motor. |
targetPosition
Declaration
public float targetPosition
Field Value
Type | Description |
---|---|
System.Single | The target position the motor tries to achieve. |
targetSpeed
Declaration
public float targetSpeed
Field Value
Type | Description |
---|---|
System.Single | The target linear speed the motor tries to achieve. |
type
Declaration
public MotorType type
Field Value
Type | Description |
---|---|
MotorType | The type of motor, either driven by position or by velocity |
Methods
TargetPositionMotor(Single, SpringDamper)
Create a motor with a MotorType.Position.
Declaration
public static LinearMotor TargetPositionMotor(float targetPosition, SpringDamper spring)
Parameters
Type | Name | Description |
---|---|---|
System.Single | targetPosition | |
SpringDamper | spring |
Returns
Type | Description |
---|---|
LinearMotor |
TargetSpeedMotor(Single, Single)
Create a motor with a MotorType.Speed.
Declaration
public static LinearMotor TargetSpeedMotor(float targetSpeed, float strength)
Parameters
Type | Name | Description |
---|---|---|
System.Single | targetSpeed | |
System.Single | strength |
Returns
Type | Description |
---|---|
LinearMotor |