I have object that can be in 2 positions that I have to change position smoothly
init position is set (270,90,0) and when it is needed I have to rotate it to (270,-90,0) 180 deg
- I tried this
- rotateArm.transform.RotateAround(rotateArm.transform.position, Vector3.up, desired_angle * Time.deltaTime);//rotateArm is a child that I want to rotate
- the problem is it rotate smoothly but not stoping (ovice)
- so I tried slerp
-
public Quaternion finial = Quaternion.Euler(270f, -90f, 0f);public Quaternion initial = Quaternion.Euler(270f, 90f, 0f);
Quaternion.Slerp(initial, finial, desired_angle * Time.deltaTime); //desired _angle it ether 1 or -1
non of them worked
another question how can I find out at which position is the Arm set to?
i.g. if arm is at 90 then go to -90 else go to 90
thank you
strong text