Hi,
I’m not really familiar with Unity so sorry if my problem is really stupid but I’m trying to code a building tool, and I have some trouble with rotations. I want my object to be moved to another then rotated by 90, and then rotating around and moving it up and down along the object. (Sorry if it’s not really clear)
My code works on the first step, and the second, but not on the third. So I you could please check what’s wrong I would be really grateful.
function Rotate(obj:GameObject,target:GameObject){
obj.transform.position = Vector3.Slerp(obj.transform.position,target.transform.position,0.1);
var angle:Vector3 = target.transform.eulerAngles;
angle.x = angle.x + 90;
obj.transform.rotation = Quaternion.Lerp(obj.transform.rotation,Quaternion.Euler(angle.x,angle.y,angle.z),0.1);
if(obj.transform.position == target.transform.position){
rate = 0;
step += 1;
}
}
Thanks in advance !!