RigidBody study - angular motion

Just like with linear motion, *SetPhysicsAngularVelocity* should be avoided. *Add Angular Impulse* or *Add Torque* should be used.

Again, just like with linear motion, UE4 uses different units than SI.

Moment of inertia (I): kg*(cm^2)

Angular impulse (Iw): kg*(cm^2)*(rad/s)*

Torque: kg(cm^2)*(rad/(s^2))

Angular velocity (w): rad/s

1 rad/s = 57.29577951308 deg/s

**Adding angular impulse.**

You can see this as an instantaneous force applied that causes angular velocity change from w1 to w2. To compute impulse value you will need moment of inertia tensor values (can be acquired using node *GetInertiaTensor*). In the test below to make disc rotate around X axis with velocity of 35 deg/s, I multiplied X axis moment of inertia value in kg*cm^2 (2108660) by desired angular velocity converted to rad/s (35/57.2958). Resulting value is 12881106.

**Adding torque.**

Unlike impulse, torque needs to be applied over period of time. Simply divide computed impulse value by duration in seconds when torque will be applied. In my test to accelerate the disc to 35 deg/s over 2s, I need to use torque value of 12881106/2 = 6440553

I did some collision tests, including precession test:

Also, just like with linear motion, I figured *sleep* value for minimal angular velocity is: 0.0138 rad/s (0.79 deg/s)

While it can be seen that first example has perfect energy conservation and precession effect is also great, not everything is dandy. After performing numerous tests here are the key points:

- CCD must be turned on. Otherwise collisions are missed when object has high angular velocity. Even if linear velocity is pretty small.
- With CCD on high kinetic energy off axis collisions become elastic linear collisions, no angular motion is applied - I figured that this is fps dependent. When capped at 30 fps, >1KJ collisions behaved wrong. Higher fps or switching on SubStepping greatly improves things.
- Total system energy is not conserved. Particularly on cases with multiple collisions. Energy lost/gained is pretty small though comparing to the total energy of the system before collision.

Well, I think I should stop bumping up this thread for now with these oddities which are not yet an actual WIP

Final assorted notes before conclusion:

- PhysX uses collision volume for computations. The actual mesh is irrelevant.
- Having multiple meshes on blueprint using
*Auto Weld* works just fine. However, only root object defines physics material, mass override can not be applied to children, only to the whole group.
- Destroying a child or moving them around causes physX to recompute center of mass and moment of inertia tensor, real-time, this is pretty cool. However, angular momentum is not preserved. Object will maintain same angular velocity, its energy will just rise or drop.

Hopefully all this info will be of use to some who also just starting looking into UE4+physX physics model.

My conclusion is that physics model is really good and more than enough for my project needs. My next research will be thrusters/force/torque and actual flight model.