- Home /
Snake Game reference help
Hey!
OK I am not doing a snake game. Every time my character collides with an object (an asteroid), I need a smaller version of said asteroid to append itself to my character. I am able to do this, but the part I am experiencing trouble with is how to precisely position each new asteroid. I would like them all to follow the lead character in a line (hence the Snake reference). I am also using Character Joint for the instantiated ones.
I would appreciate if anyone has any idea about how to instantiate objects on a straight line behind this character, knowing that I am using the 3D space...
Please :( It is giving me BIG headaches =)
Answer by DaveA · Mar 09, 2012 at 10:14 PM
If you really want a straight line, Transform.forward, take the negative of that, it's backward, then multiply by the distance you want it back there, that should be the position to use.
That's transform.forward (negated) on the last object in line to which the new object will become a child (I assume).
Btw, that is what i used =]
function AddLength(amount : int) { length += amount; var distance = Vector3.Distance (character.transform.position, LengthCharacter.transform.position); Instantiate (LengthCharacter, character.transform.position - character.transform.forward (distance(length*3)), character.transform.rotation); }
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How do I load customized characters into my next scene? 2 Answers
How do I move arms and legs in .fbx format? 1 Answer
How can I create a ragdoll ot of character joints? 0 Answers
Snake Game problems - errors 2 Answers