- Home /
Question by
mrbloggy · Sep 03, 2012 at 04:04 PM ·
instantiateobjectjointsmoving
Instantiate object with joints to moving object
Hi,
I have been attempting to Instantiate a line of objects. Spheres.
I have a lead sphere and it move throught the world. Afer every 1-2 seconds I Instatiate a new sphere to the object with a hinge joint. A bit like a tial i guess.
Now this works a little with the below code.
var extender : GameObject = Instantiate(Resources.Load("Sphereobject2", GameObject), gameObject.Find("Sphereobject1").transform.position, Quaternion.identity);
extender.GetComponent(ConfigurableJoint).connectedBody = gameObject.Find("Sphereobject1").rigidbody;
I increment the object number for each extra part. Trouble is, they wont always line up. So instead of a moving rope like stream, the ends get out of alinement and messy.
Any ideas how i can fix this? Thanks
Comment