How do I rotate a bone that has a rigid body in the animation graph?

I have a tank model with a turret and its barrel. The body of the tank has the root rigid body. The turret and the barrel each have their own rigid body. They have a skeletal structure with constraints to hold the three rigid bodies in place relative to each other, while allowing the turret only to rotate along the yaw and the barrel to rotate only along the pitch.

I want to rotate the turret using a simple bone rotation node in the animation graph, but it seems that the rigid body won’t turn unless I use a physics based node in the Pawn’s blueprint, such as add torque. But the problem with that approach is that I cannot (or I don’t know how yet) to stop on a dime and make it look smooth in its aiming.

Is there a way to turn the turret that is rigid body without resorting to physics based function calls?

I also have wheels under the body and I want to use add torque, for example, to give the realism of acceleration and deceleration to the tank. But the turret and barrel need to be more responsive to user input, and aim more instantly on a target.

Any insight would be helpful.

UE5.3

My original problem was that I could not set the turret and barrel to kinematic, because those rigid bodies would make the entire tank remain stationary in the space it spawned, even if that meant suspended in the air. So I resorted to looking for a way to turn the turret and barrel programmatically while they simulated physics.

However, I since found that by setting all constraints on the kinematic rigid bodies in the physics assets to FREE (no constraints), the turret and barrel can be manipulated as kinematic and the tank’s physics simulated body (main body) can be driven by the wheels’ torque, providing realistic driving behavior.

As an aside, I also found that the Chaos Vehicle Movement Component is the best way to manage a vehicle if you want solid replication in a multiplayer game. I wish it had better support for tank treads. It is great for wheeled vehicles though.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.