Line 17: | Line 17: | ||
=Public Member Functions= | =Public Member Functions= | ||
− | {{ScriptFunction|string|ToString|();|Returns this SJointMotor's properties as a string||5=<pre>MotorString = Space.Host.ExecutingObject.HingeJoint.Motor.ToString()</pre>|6=<pre></pre>}} | + | {{ScriptFunction|string|ToString|();|Returns this SJointMotor's properties as a string||5=<pre>MotorString = Space.Host.ExecutingObject.HingeJoint.Motor.ToString()</pre>|6=<pre>--the below script will make a UI Text element display this GameObjects Hinge Joint Motor properties |
+ | --[Add "thetext" and "thehingejoint" reference to the Scripting Runtime component] | ||
+ | thisObject = Space.Host.ExecutingObject | ||
+ | text = Space.Host.GetReference("thetext").UIText | ||
+ | hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint | ||
+ | |||
+ | |||
+ | function OnUpdateFunction() | ||
+ | motor = hingejoint.Motor | ||
+ | text.Text = motor.ToString() | ||
+ | end | ||
+ | |||
+ | |||
+ | thisObject.OnUpdate(OnUpdateFunction)</pre>}} | ||
Creates a new SJointMotor with the given targetVelocity, force, freeSpin.
Motor= Space.Host.ExecutingObject.HingeJoint.Motor.New(1,2,true)
--the below script will change all Hinge Joint Motor properties to 0 when clicked --[Add "thehingejoint" reference to the Scripting Runtime component] thisObject = Space.Host.ExecutingObject hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint function OnClickFunction() motor = hingejoint.Motor hingejoint.Motor = motor.New(0,0,false) end thisObject.AddClickable() thisObject.Clickable.OnClick(OnClickFunction)
Returns this SJointMotor's properties as a string
MotorString = Space.Host.ExecutingObject.HingeJoint.Motor.ToString()
--the below script will make a UI Text element display this GameObjects Hinge Joint Motor properties --[Add "thetext" and "thehingejoint" reference to the Scripting Runtime component] thisObject = Space.Host.ExecutingObject text = Space.Host.GetReference("thetext").UIText hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint function OnUpdateFunction() motor = hingejoint.Motor text.Text = motor.ToString() end thisObject.OnUpdate(OnUpdateFunction)
The motor will apply a force up to force to achieve targetVelocity.
MotorTargetVelocity = Space.Host.ExecutingObject.HingeJoint.Motor.TargetVelocity
The motor will apply a force.
MotorForce= Space.Host.ExecutingObject.HingeJoint.Motor.Force
If freeSpin is enabled the motor will only accelerate but never slow down.
MotorFreeSpin = Space.Host.ExecutingObject.HingeJoint.Motor.FreeSpin
|