No announcement yet.

Bad Rotation, yaw mixes with roll

  • Filter
  • Time
  • Show
Clear All
new posts

    Bad Rotation, yaw mixes with roll

    Hi, I'm encountering a weird problem where rotating my player's pawn using physics angular velocity, the yaw rotation does a weird up and down motion with some roll added to it(so 360 degree, yaw rotation will, in a sinusoidal fashion, go a bit up and down, and with a "roll" accordingly... in reality, it should only do a yaw rotation)....and based on the blueprint that I use for that it couldn't be simpler.. so I'm really puzzled as to why it would do that...maybe it's a bug? but surely I'm not the only one who tried to use such controls. So anyone has a hint?

    Click image for larger version

Name:	Captureyaw.PNG
Views:	1
Size:	166.9 KB
ID:	1199496

    Have you tried completely disabling the second axis that rotates around the right vector? It could be that even a small amount of rotation around the other axis is adding up over time and distorting the roll. If it becomes an issue you could store the rotation manually by using an FinterpTo and just setting the rotation based off that. Unless you need this to be real physics that interacts with other objects.
    Ryan Brucks
    Principal Technical Artist, Epic Games


      Indeed, I'd like to do this using physics.
      I've tried locking the Y axis, it solves the problem when looking straight and rotating, but since the Y axis is locked, rolls are completely disabled in that angle, and turning is completely disabled(replaced with roll) when looking up or down.. so it's not really a solution(even though it was still informative)

      I've tried splitting the up vector and only multiplying the values on the axis that I thought i'd need, but they don't work as I initially thought. Isn it all supposed to be local values? because as far as I can see, to me it means that these are not local values. If on the up vector, I multiply one of the axis(z in this case) and the rotation works, but only at a certain angle(looking straight), doesn't it point to an issue on what the up vector returns? Because in this case, "up" should always be up, not to the world, but to self. Then z axis in self should always react in the same way, weither the player is looking up, down or straight, with or without roll.
      So, I'm not sure what is wrong, is it my expectation of the behavior? if so, how could I do what I expect to see in that behavior, still using physics, considering previous tries failed?


        I also have this really weird issue. I'm doing something like this in c++:

        FRotator rot = impact.GetComponent()->GetComponentRotation(); // If I print the values I get something like 0, 90, 0
        ADecal* decal = World->SpawnActor<ADecal>(ADecal::StaticClass(), FTransform(rot, impact.Location), ActorSpawnParams);
        FRotator rot2 = decal->GetActorRotation(); // If I print the values of rot2 I SOMETIMES get 0, 26.5, 63.5 but sometimes it's 0, 90, 0...

        Clearly, 26.5+63.5 = 90 Why is the Yaw spread into the Roll??
        Regardless of the rotation I print out, the actual rotation in-game is fine because the decal is facing the right way with the right rotation.
        The thing is that I want to get that rotation in code and make decisions based on it and I can't because of what seems like a bug...
        The ADecal actor doesn't have a physics body, so I don't see how it could rotate by itself after spawning.