Download

[SOLVED] How do you directly control the rotation of a Character?

My player blueprint is a child of Character, so its location and movement are controlled by a Character Movement component. As it’s a VR character, and I don’t want to force players to rotate in their playspace in order to rotate in the game, I want them to be able to press a button to rotate in-place, regardless of where in their playspace they are, or if they’re using roomscale or stationary VR.

This thread has been really helpful in figuring out how to pull that off, but the issue is that SetActorTransform does nothing for a subclass of Character. After some digging, I found that the way you rotate a character is by using a Rotating Movement Component, but the problem is, its interface is a bit odd. You add the component to a blueprint, then set the rotation rate, optional pivot translation, and whether the rotation is in local or world space.

I’m not sure how to translate “I want to rotate X degrees from my current direction one time” into that. With the thread above, the blueprint it details by the end does that just fine, and it’s pretty easy to understand. But if I’m using a Character blueprint, then I’m not sure how to get the same behavior when seemingly all I can do is add a Rotation Movement Component and tell it how fast it should turn (which doesn’t work). MoveUpdatedComponent() doesn’t seem to do anything, either.

This is a real head-scratcher. Essentially, I want my player pawn to benefit from the movement gameplay code in Character, but I can’t figure out how to override its rotation.

Probably in character movement on the pawn you have something like rotation something go for it… I’m not sure there is much of the stuff on character movement…

I’m not sure how you are controlling your Character’s rotations right now… as you know there are a bunch of ways to move a Pawn or Char… but the following might work: SetControlRotation

char movement rotation.png

Set Rotation Rate controls the rotation speed when Use Controller Desired Rotation is enabled. But even if I enable it, Set Control Rotation does nothing.

The problem is I’m currently not controller character rotations at all. The player has to physically move around in order to rotate. The player class inherits from Character so I can get the capsule collider and character movement component functionality, as well as all the nice movement code built into all of that. The problem is, that movement code overrides things like SetActorTransform, which would otherwise work. And I don’t see any way to decouple character rotation from either movement direction or camera rotation.

The camera is controlled only by the HMD. But I would like to be able to rotate the view about the Z axis so that the user can turn without getting tangled up in their HMD’s cables.

Edit: SetControlRotation was definitely the right way to do this, but it didn’t work because a plugin I was using had a MoveUpdatedComponent call and was set up in a way that basically overrode anything camera-related that was happening in blueprints. The clue was that the video I linked was using the same code for VR, so I dug a little deeper into my own setup and realized the problem.