Following path

Hi.I have to get an object to follow a path that is set using the iphone’s touch.The behaviour should be similar to [Flight Control][1]

Making it move to that path is not a problem but i can’t get the rotation right.

var x : Vector2 = Vector2(transform.position.x,transform.position.y);
transform.position = Vector3.Lerp(transform.position, target ,sp);
var y : Vector2 = Vector2(transform.position.x,transform.position.y);

if (y!=x)
transform.eulerAngles.z = Mathf.Atan2(y.y - x.y, y.x - x.x) * 180 / Mathf.PI - 90;

the object is “shaking” al LOT.

Anyone know any scripts that can help me with this?

P.S.For some reason itween doesn’t work.

[1]: http://www.youtube.com/watch?v=MADHFGcmKFs

Hi,

you can use : Transform.LookAt functions for this purpose :

http://unity3d.com/support/documentation/ScriptReference/Transform.LookAt.html

Could you please let me know, how you are going to perform the touch path following,

I’ve already done this part ,but the speed isn’t constant, It depends on the path drawing speed. I need to avoid this.
If you have a suggestion please post it.

Thanks,

Regards
J Suriya