rotation on addTorque hit

Im struggling with something that I thought should be straight forward… no doubt it is, but not working for me.

I have a ray on my gun that when I fire I want to make a gravity-less cube spin depending where and on what normal is hit… as you would expect in reality. However when I use addTorque I seem to be restricted to a single access, or the cube rotates in unexpected angles.
Ive been using variations of

hit.rigidbody.AddForce(-hit.normal* 30);
hit.rigidbody.AddTorque(hit.normal * 30);

Im using AddForce with AddTorque as I wish to get to both move and spin. Seems like AddForceAtPosition does thins but Im getting results where the cube spins the wrong way.

Is there a better way to use AddTorque?
Thanks

You seeem to have the wrong idea about AddForce and AddTorque. Torque is given by the axis of rotation that goes through the center of mass of the object. Since you add a torque around the hit normal the rotation would be of course wrong. Also the amount of torque applied would depend on how much off-center you hit the object.

AddForce, just like AddTorque, will apply the linear force at the center of mass.

Unity’s physics system does not implement real physics but something close to. While linear forces velocities are quite simple to understand and to calculate, torque and angular velocity is a quite complex topic, in the real world as in the simulated world. When applying torque one has to take the inertia tensor into account which actually encodes the mass as well as it’s distribution based on the shape of the object (collider(s)). This is quite difficult math.

Luckily in most cases you don’t have to care about all the math behind it since Unity usually has methods to do this for you. In your case all you want to use is AddForceAtPosition. This does not just add a linear force at the center of mass, but rather on the worldspace position you pass to the method. If the point where the force is applied is off center, It will actually split the force into it’s proper linear component and the torque that should be applied.

Note that Unity’s physics system does not obey the law of conservation of angular momentum. Instead it does something that’s a bit simpler which can be described as conservation of angular velocity. This is not physically correct but in most common cases it doesn’t really matter. Have a look at this video which describes brifely the connection between angular momentum, the rotational inertia and the angular velocity. Note that the mentioned “tumbling” in the bottom middle figure can’t be achieved in Unity since as said above, Unity does not have conservation of angular momentum but conservation of angular velocity. So once no force or torque is applied to the object it will always rotate around one stable axis.

Ive decided to use Dynamic Bone from the asset store. If I make a simple rig and add rigidbody.AddForce(-hit.normal* 30); it gives the results I need.