hey, heres a video of my problem, sorry if I'm doing anything convoluted, if you can help that would be great thanks. I don't know whats the deal withvideo links on this site so sorry if it's against the rules; http://vimeo.com/18361778 if you notice anything else wrong or unnecessary feel free to mention it :P here is the script which is applied to the gemspawner object :
var Gem1 : Transform;
var Gem2 : Transform;
var Gem3 : Transform;
var Gem4 : Transform;
var Gem5 : Transform;
var Gem6 : Transform;
var Gem7 : Transform;
var isShooter = false;
var whichGemIGot : String;
function Start ()
{
CreateGem();
}
function Update ()
{
if(Input.GetButtonDown("Jump") && isShooter)
{
var child = transform.Find(whichGemIGot);
child.rigidbody.AddRelativeForce(0,-1000,0);
isShooter = false;
}
}
function CreateGem ()
{
var whichGem = Random.Range(1,7);
switch(whichGem)
{
case 1:
var Gem11 = Instantiate(Gem1, transform.position, transform.rotation);
Gem11.parent = transform;
whichGemIGot = "Gem - Blue(Clone)";
break;
case 2:
var Gem22 = Instantiate(Gem2, transform.position, transform.rotation);
Gem22.parent = transform;
whichGemIGot = "Gem - Green(Clone)";
break;
case 3:
var Gem33 = Instantiate(Gem3, transform.position, transform.rotation);
Gem33.parent = transform;
whichGemIGot = "Gem - Indigo(Clone)";
break;
case 4:
var Gem44 = Instantiate(Gem4, transform.position, transform.rotation);
Gem44.parent = transform;
whichGemIGot = "Gem - Orange(Clone)";
break;
case 5:
var Gem55 = Instantiate(Gem5, transform.position, transform.rotation);
Gem55.parent = transform;
whichGemIGot = "Gem - Red(Clone)";
break;
case 6:
var Gem66 = Instantiate(Gem6, transform.position, transform.rotation);
Gem66.parent = transform;
whichGemIGot = "Gem - Violet(Clone)";
break;
case 7:
var Gem77 = Instantiate(Gem7, transform.position, transform.rotation);
Gem77.parent = transform;
whichGemIGot = "Gem - Yellow(Clone)";
break;
}
}