Quantcast
Channel: Latest Questions by Grievemourne
Viewing all articles
Browse latest Browse all 51

How do I edit springjoint components in script?

$
0
0
I'm trying to create a pickup script through the use of springjoints and have been trying to set the 'Connected Body' to an object, and detach it later via script, and I'm having trouble reading the docs.unity site. I'm also trying to do this to an object that has been raycasthit. function FixedUpdate() { if(Input.getbutton("e")) { var fwd = transform.TransformDirection (Vector3.forward); var hit : RaycastHit; if(Physics.Raycast(transform.position, fwd, hit, 2)) { if(hit.collider.gameObject.tag == "Moveable") { var hitObject = hit.rigidbody; hitObject.springJoint. //Trying to find out how to get the springjoint component and connected body from the hit object. and set it to 'GameObject.Find("Spring Target")' } } } } I don't understand how I get ahold of anything to do with springjoints via script, not to mention having it behave.

Viewing all articles
Browse latest Browse all 51

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>