vendredi 6 juin 2014

moving an object to a position at a fixed distance at a specified heading in unity


Vote count:

0




I have a gameObject (g) and a direction (d) and another gameObject (t). I need to place t somewhere along a line drawn from g along the direction defined by d.


I know how to draw a debug line along this path.



Debug.DrawLine(g.transform.position, g.transform.position + (d * 8.0f));


but what I now need to do is to place my other gameObject (t) at the end of that line? basically I was the t object to be a fixed distance from the g object at a heading specified by d.


Is there a strait forward way to do this?


Also... could anyone help me understand vector3's better? Im confused as they seam to be able to represent directions, and positions, which is confusing me a little



asked 45 secs ago






Aucun commentaire:

Enregistrer un commentaire