Skip to main content

Physics.HingeMotorSettings

Class

Settings describing the independent force (motor) applied to the constraint.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Settings describing the independent force (motor) applied to the constraint. Motor within a hinge constraint is used to create controlled, powered movement along the hinge's axis, allowing objects to rotate automatically or maintain a particular speed or position.

Index

Example

//@input Physics.ConstraintComponent constraintComponent

let constraint = script.constraintComponent.constraint;

let motorSettings = constraint.motorSettings;
motorSettings.enabled = true;
motorSettings.maxImpulse = 1;
motorSettings.targetType = HingeMotorType.AngleTarget;
motorSettings.targetValue = Math.PI/2;
motorSettings = motorSettings;

Properties

enabled

enabled: boolean

Enable or disable motor settings.

Default Value

false

maxImpulse

maxImpulse: number

Maximum force allowed to be applied to constraint.

Default Value

0

targetType

targetType: HingeMotorType

A type of the applied motor.

Default Value

Physics.HingeMotorType.AngleTarget

targetValue

targetValue: number

Target value of the motor depending on type: speed or angle.

Default Value

0

Methods

getTypeName()

static getTypeName(): TypeName<HingeMotorSettings>

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<HingeMotorSettings>