Question by
smems · Jan 11, 2016 at 04:00 PM ·
2drigidbody2d
Rotate object smoothly with Rigidbody2D.MoveRotation!
I would like to rotate a 2D object smoothly using .MoveRotation. (The object is constantly moving around the target object through a set of waypoints)
I tried this and it didn't work:
rb2d.MoveRotation(angle * Time.deltaTime);
rb2d.MoveRotation(angle * speed * Time.deltaTime);
The angle gets updated every Update() so that my object can rotate towards the target object:
direction = target.transform.position - transform.position;
float ang = Vector2.Angle(rb2d.transform.position, direction);
if this question has already been answered please lead me to it. I couldn't find any solving my problem
Comment
Answer by Gman3214 · Apr 04, 2017 at 07:09 PM
sorry for the late reply lol i ran into this myself today took me an hour to figure it out but this is the answer:
rb2d.MoveRotation(Mathf.LerpAngle(rb2d.rotation,destination rot, RotSpeed * Time.deltaTime));
have a good one mate <3
Your answer
![](https://koobas.hobune.stream/wayback/20220612055556im_/https://answers.unity.com/themes/thub/images/avi.jpg)