Download

How do you rotate a physics simulated object in place using player input?

Hey everyone, I’m trying to tackle a problem with rotating a physics simulated object “in place” with user control input. Any idea how to make this happen? I can’t seem to get the controller/keyboard A,D input to override the physics simulation. It wants to me to check teleport on the current node setup but it’s choppy and stutters and isn’t smooth. Imagine a mars probe for example. I can drive the probe around using the vehicle movement setup provided by Unreal. I have tire configs setup, the whole shabang. My problem is I want to be able to rotate the rover in place like a tank when the player has no forward movement. So physics linear velocity is 0, forward speed is 0 etc… Any ideas? I’ve tried several node setups adding stuff to the input axis action for steering and can’t seem to get anything working. Help Please…

If all it’s doing is rotating in place, use a *addlocalrotation *node in place of add input.

I’ve tried that, but because its a physics simulated object it wants me to check teleport on the rotation and it isn’t smoothly rotating. i’ll snap a pic of the blueprint. obviously i’m just missing something silly.

For PhysX simulated Actors you should make a call to SetAngularVelocity() and related functions.

Ok I can go down that path Bruno. I’ll give it go today. I will try and setup something to set the angular velocity based on controller input, but only if the players linear velocity equals zero. To me this would simply mean if the player isn’t moving forward and turning is applied on the controls, then the player rotates. I’ll post an update.

Thanks for the help guys. Multiplying the steering output by an int value and then setting the currect value of angular velocity did the trick. I was on the right track before. Just needed to look at it with fresh eyes.