Hey All!
First post here, so please go easy on me (I’m new to Unity) ![]()
I’m using the following code in a script attached to the main camera to instantiate and apply force to an object ( a ragdoll in this case ) -
var target : GameObject;
function Update()
{
if (Input.GetKeyDown(“space”))
{
var clone : GameObject;
clone = Instantiate(target, Vector3(0,1,-4), Quaternion.identity);
clone.Find("base").rigidbody.AddForce( target.transform.forward * 20000);
clone.Find("base").rigidbody.AddForce( target.transform.up * 10000);
}
}
It works fine the first time I press space, but if I press space a second (or third, etc) time, a new ragdoll is created in the scene, but the force get’s applied to the FIRST one, always.
I don’t understand why the force is not being applied to the clone that is being created inside the function.
Any help would be appreciated.
Thanks!
Daphyd