The performance cost of using transform to rotate a rigidbody?

So I posted a long post about this topic, but I feel like very few people will read such a long post:

Basically, I have a the following object hierarchy for a ship controlled with forces and torques.
Spaceship GameObject [Rigidbody(non-kinematic), ShipPhyics]

  • visuals [Meshes, Colliders]

I want the ship to tilt slightly when moving left or right, so I rotate the “visuals” using
transform.localRotation for the child gameobject. This prevents the tilting from messing with my controls on the spaceship gameobject.

My basic question is, if I’m tilting the “visuals” using the transform, according to documentation, there is a “big physics solve” that needs to happen, and a large performance hit.

Should I be concerned about tilting the ship using transform.localRotation? I expect there to be max ~80 ships at any given time using this code running on mobile hardware.

There should be no performance hit. Moving colliders via transform is no longer an issue since Unity 5.0. Part of the documentation is outdated on this matter.

Are you kidding me? Damn I spent a solid 3 hours on this.

Yes, it’s a common issue due to the documentation being outdated and leading to misconceptions. Here’s a very similar thread:

Official mention: https://unity3d.com/unity/whats-new/unity-5.0

Thanks for clarifying this. Do you know if this applies to animations as well (ie: Animating a collider attached to a rigidbody?)

As far as I know, animating a collider is just modifying its transform. So my guess is that there should be no difference between using animation and modifying the transform directly.

I should really clarify this post
My Hierarchy is as follows:
Spaceship → Colliders

Where the child object Colliders contains the mesh renderer and colliders. The rigidbody component is on the spaceship.
In this sense, moving Colliders by its local transform is basically moving the rigidbody (ie: The colliders are not static → they are part of the rigidbody).

Now this should be expected to incur a cost right? as the notes you posted are referring to static colliders.

I can’t tell for sure as I don’t know how PhysX handles this internally. However I wouldn’t expect any significant penalty.

In order to be sure I’d recommend you to try animating your colliders in a bunch of spaceships at the same time while watching the Profiler for any unexpected spike.