I’m trying to freeze rotation for a Pawn that is simulating physics. Freezing its position goes fine by putting the linear dampening to a high value, however putting the angular dampening to a high value does not prevent it from rotating during a collision.
We automatically calculate inertia tensor based on the density and the simple collision geometry, there isn’t a way to set it directly. Possibly adding a constraint would be another way to accomplish this? Or you could modify the source to let you do it!
Physics constraints seem to be useful when there are two Actors involved. However, I’m trying to control the effects of a collision of a Pawn with any object in the world.
So far I am able to achieve reasonable results by overriding the ReceiveHit event and adjusting the physics angular and linear velocities. However the ReceiveHit event is always called AFTER the physics engine pushed through its changes. This results in glitchy behaviour as described by the following example:
Suppose there is a Pawn simulating physics that has a very high linear velocity and is moving directly towards a wall
Suppose the physics angular and linear dampening of the pawn is set to zero
Suppose the physics material of MyPawn and the wall is set such that restitution is 1.0
Suppose the ReceiveHit event resets the velocities to zero:
When the pawn hits the wall it will stop moving, but it didn’t stop exactly at the wall. It bounced back a little and its rotation has changed. Now when I try to set the world rotation and location of MyPawn to my liking in the ReceiveHit event this results in glitchy behaviour, because I’m always one frame behind.
I hoped that there was an easier way to have complete control over the physics engine besides messing with the source code.