There are some disadvantages to using a rigidbody to rotate an enemy with a navmesh agent like the potential delay due to a fixedupdate being skipped. If I only intend to use about 20 enemies on screen is it ok to use the transform component to rotate them? 20 * 0,876ns = 17,52ns according to this thread: Most Efficient (Fastest) way to match forward direction between two objects - Unity Engine - Unity Discussions. Or will the player notice any difference if I rotate using rigidbody instead? What do you recommend guys?
Rigidbody is for physics. Only bother with a Rigidbody if the object has to dynamically update with collisions and stuff.
3 Likes
You can rotate physics with MoveRotation as fast as you like though, subject to fixed update rate. It wouldn’t interpolate however.
3 Likes
Is not being subject to fixed update the same as potentially getting a delayed rotation? I know that the delay is very low but still.
If you’re using .transform to rotate, you’re rotating the visual. Any collider will not be updated to that until the next fixedupdate. MoveRotation doesn’t act any faster, it just does it at higher performance, assuming you’ve got a rigidbody / collider to take care of.
.transform is “fastest” visually if you don’t care about physics.
1 Like