creating a very basic catch the falling object game. I want a new sphere to spawn at a given point when the previous one is caught.
I have searched and tried everything I can find.
latest attempt:
I have a prefab called icecream in the hierarchy
I have an empty game object called Gam eObject in the Heirarchy
scene starts with and instance of icecenter code here
ream at (0,2,0)
scene starts with the empty game object at (.75,2,0) should be just off the x axis across my screen, same height and same z axis
the ice cream prefab has 2 scripts a caught script which is working properly . when it collides with a cone object it connects with a hinge joint and moves with that object.
function OnCollisionEnter(c : Collision)
{
var joint = gameObject.AddComponent(HingeJoint);
joint.connectedBody = c.rigidbody;
}
and a spawn script intended to cause a new instance of icecream to instantiate at the empty game object postion
var pos : Transform;
var iceCream : GameObject;
function OnCollisionEnter(c : Collision)
{
Instantiate(iceCream, pos.position, pos.rotation);
}
I have the pos variable set as the empty game object and the iceCream variable set as the icecream prefab.
At thispoint when I run the clone spawns but never shows on the screen
any help would be amazing, thanks