Line 35: | Line 35: | ||
=Properties= | =Properties= | ||
− | {{ScriptFunction|float|Spring|{ get;set; }|The spring forces used to reach the target position.|5=<pre>SpringSpring= Space.Host.ExecutingObject.HingeJoint.Spring.Spring</pre>|6=<pre> | + | {{ScriptFunction|float|Spring|{ get;set; }|The spring forces used to reach the target position.|5=<pre>SpringSpring= Space.Host.ExecutingObject.HingeJoint.Spring.Spring</pre>|6=<pre>--the below script will make a slider change a Hinge Joint Spring Spring property |
+ | --[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component] | ||
− | + | slider = Space.Host.GetReference("theslider").UISlider | |
+ | hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint | ||
− | {{ScriptFunction|float|TargetPosition|{ get;set; }|The target position the joint attempts to reach.|5=<pre>SpringTargetPosition = Space.Host.ExecutingObject.HingeJoint.Spring.TargetPosition</pre>|6=<pre></pre>}} | + | |
+ | OVC = function() | ||
+ | spring = hingejoint.Spring | ||
+ | spring.Spring = (slider.Value * 10.0) -- from 0.0 to 10.0 | ||
+ | hingejoint.Spring= spring | ||
+ | end | ||
+ | |||
+ | slider.OnValueChanged(OVC)</pre>}} | ||
+ | |||
+ | {{ScriptFunction|float|Damper|{ get;set; }|The damper force uses to dampen the spring.|5=<pre>SpringDamper= Space.Host.ExecutingObject.HingeJoint.Spring.Damper</pre>|6=<pre>--the below script will make a slider change a Hinge Joint Spring Damper property | ||
+ | --[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component] | ||
+ | |||
+ | slider = Space.Host.GetReference("theslider").UISlider | ||
+ | hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint | ||
+ | |||
+ | |||
+ | OVC = function() | ||
+ | spring = hingejoint.Spring | ||
+ | spring.Damper = (slider.Value * 10.0) -- from 0.0 to 10.0 | ||
+ | hingejoint.Spring = spring | ||
+ | end | ||
+ | |||
+ | slider.OnValueChanged(OVC)</pre>}} | ||
+ | |||
+ | {{ScriptFunction|float|TargetPosition|{ get;set; }|The target position the joint attempts to reach.|5=<pre>SpringTargetPosition = Space.Host.ExecutingObject.HingeJoint.Spring.TargetPosition</pre>|6=<pre>--the below script will make a slider change a Hinge Joint Spring TargetPosition property | ||
+ | --[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component] | ||
+ | |||
+ | slider = Space.Host.GetReference("theslider").UISlider | ||
+ | hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint | ||
+ | |||
+ | |||
+ | OVC = function() | ||
+ | spring = hingejoint.Spring | ||
+ | spring.TargetPosition = (slider.Value * 10.0) -- from 0.0 to 10.0 | ||
+ | hingejoint.Spring = spring | ||
+ | end | ||
+ | |||
+ | slider.OnValueChanged(OVC)</pre>}} | ||
{{Scripting Navbox}} | {{Scripting Navbox}} |
Creates a new SJointSpring with the given spring, damper, targetPosition.
Motor= Space.Host.ExecutingObject.HingeJoint.Spring.New(1,2,3)
--the below script will change all Hinge Joint Spring 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() spring = hingejoint.Spring hingejoint.Spring = spring .New(0,0,0) end thisObject.AddClickable() thisObject.Clickable.OnClick(OnClickFunction)
Returns this SJointSpring's properties as a string
SpringString = Space.Host.ExecutingObject.HingeJoint.Spring.ToString()
--the below script will make a UI Text element display this GameObjects Hinge Joint Spring 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() spring = hingejoint.Spring text.Text = spring.ToString() end thisObject.OnUpdate(OnUpdateFunction)
The spring forces used to reach the target position.
SpringSpring= Space.Host.ExecutingObject.HingeJoint.Spring.Spring
--the below script will make a slider change a Hinge Joint Spring Spring property --[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component] slider = Space.Host.GetReference("theslider").UISlider hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint OVC = function() spring = hingejoint.Spring spring.Spring = (slider.Value * 10.0) -- from 0.0 to 10.0 hingejoint.Spring= spring end slider.OnValueChanged(OVC)
The damper force uses to dampen the spring.
SpringDamper= Space.Host.ExecutingObject.HingeJoint.Spring.Damper
--the below script will make a slider change a Hinge Joint Spring Damper property --[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component] slider = Space.Host.GetReference("theslider").UISlider hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint OVC = function() spring = hingejoint.Spring spring.Damper = (slider.Value * 10.0) -- from 0.0 to 10.0 hingejoint.Spring = spring end slider.OnValueChanged(OVC)
The target position the joint attempts to reach.
SpringTargetPosition = Space.Host.ExecutingObject.HingeJoint.Spring.TargetPosition
--the below script will make a slider change a Hinge Joint Spring TargetPosition property --[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component] slider = Space.Host.GetReference("theslider").UISlider hingejoint = Space.Host.GetReference("thehingejoint").HingeJoint OVC = function() spring = hingejoint.Spring spring.TargetPosition = (slider.Value * 10.0) -- from 0.0 to 10.0 hingejoint.Spring = spring end slider.OnValueChanged(OVC)
|