--the below script will make a UI Text element display this GameObjects Hinge Joint Limits' 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()limits = hingejoint.Limitstext.Text = limits.ToString()endthisObject.OnUpdate(OnUpdateFunction)
--the below script will change all Hinge Joint Limits properties to 0 when clicked--[Add "thehingejoint" reference to the Scripting Runtime component]thisObject = Space.Host.ExecutingObjecthingejoint = Space.Host.GetReference("thehingejoint").HingeJointfunctionOnClickFunction() limits = hingejoint.Limitshingejoint.Limits = limits.New(0,0,0,0,0)endthisObject.AddClickable()thisObject.Clickable.OnClick(OnClickFunction)
Properties
Min
float Mingetset
The lower angular limit (in degrees) of the joint.
--the below script will make a slider change a Hinge Joint Limits Min property--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]slider = Space.Host.GetReference("theslider").UISliderhingejoint = Space.Host.GetReference("thehingejoint").HingeJointOVC=function()limits = hingejoint.Limitslimits.Min = (slider.Value *10.0) -- from 0.0 to 10.0hingejoint.Limits = limitsendslider.OnValueChanged(OVC)
Max
float Maxgetset
The upper angular limit (in degrees) of the joint.
--the below script will make a slider change a Hinge Joint Limits Max property--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]slider = Space.Host.GetReference("theslider").UISliderhingejoint = Space.Host.GetReference("thehingejoint").HingeJointOVC=function()limits = hingejoint.Limitslimits.Max = (slider.Value *10.0) -- from 0.0 to 10.0hingejoint.Limits = limitsendslider.OnValueChanged(OVC)
Bounciness
float Bouncinessgetset
Determines the size of the bounce when the joint hits it's limit. Also known as restitution.
--the below script will make a slider change a Hinge Joint Limits Bounciness property--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]slider = Space.Host.GetReference("theslider").UISliderhingejoint = Space.Host.GetReference("thehingejoint").HingeJointOVC=function()limits = hingejoint.Limitslimits.Bounciness = (slider.Value *1.0) -- from 0.0 to 1.0hingejoint.Limits = limitsendslider.OnValueChanged(OVC)
BounceMinVelocity
float BounceMinVelocitygetset
The minimum impact velocity which will cause the joint to bounce.
--the below script will make a slider change a Hinge Joint Limits BounceMinVelocity property--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]slider = Space.Host.GetReference("theslider").UISliderhingejoint = Space.Host.GetReference("thehingejoint").HingeJointOVC=function()limits = hingejoint.Limitslimits.BounceMinVelocity = (slider.Value *10.0) -- from 0.0 to 10.0hingejoint.Limits = limitsendslider.OnValueChanged(OVC)
ContactDistance
float ContactDistancegetset
Distance inside the limit value at which the limit will be considered to be active by the solver.
--the below script will make a slider change a Hinge Joint Limits Contact Distance property--[Add "theslider" and "thehingejoint" reference to the Scripting Runtime component]slider = Space.Host.GetReference("theslider").UISliderhingejoint = Space.Host.GetReference("thehingejoint").HingeJointOVC=function()limits = hingejoint.Limitslimits.ContactDistance = (slider.Value *10.0) -- from 0.0 to 10.0hingejoint.Limits = limitsendslider.OnValueChanged(OVC)