--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.ExecutingObjecttext = Space.Host.GetReference("thetext").UITexthingejoint = Space.Host.GetReference("thehingejoint").HingeJointfunctionOnUpdateFunction()spring = hingejoint.Springtext.Text = spring.ToString()endthisObject.OnUpdate(OnUpdateFunction)
New
static SJointSpring New (float spring, float damper, float targetPosition)
Creates a new SJointSpring with the given spring, damper, targetPosition.
--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.ExecutingObjecthingejoint = Space.Host.GetReference("thehingejoint").HingeJointfunctionOnClickFunction() spring = hingejoint.Springhingejoint.Spring = spring .New(0,0,0)endthisObject.AddClickable()thisObject.Clickable.OnClick(OnClickFunction)
Properties
Spring
float Springget
The spring forces used to reach the target position.
--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").UISliderhingejoint = Space.Host.GetReference("thehingejoint").HingeJointOVC=function()spring = hingejoint.Springspring.Spring = (slider.Value *10.0) -- from 0.0 to 10.0hingejoint.Spring= springendslider.OnValueChanged(OVC)
--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").UISliderhingejoint = Space.Host.GetReference("thehingejoint").HingeJointOVC=function()spring = hingejoint.Springspring.Damper = (slider.Value *10.0) -- from 0.0 to 10.0hingejoint.Spring = springendslider.OnValueChanged(OVC)
--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").UISliderhingejoint = Space.Host.GetReference("thehingejoint").HingeJointOVC=function()spring = hingejoint.Springspring.TargetPosition = (slider.Value *10.0) -- from 0.0 to 10.0hingejoint.Spring = springendslider.OnValueChanged(OVC)