Simple rotation in blueprints. ( Rotators and range? )

Hi,

I’m trying to rotate an object about a point. I have the idea of how in my head but I’m running in to some issues with the actual math involved. Now I don’t know too much about vector math, or quaternions, specifically rotations and things like gimble.

Now everything is functioning as I want it too except that I have a problem when I hit 90( for example on the Y axis ) on my rotation. When I do that it starts to jitter slightly and it tries to stick at a value of 90. I can modulo that back to 0 so it doesn’t freak out. But of course when doing that the object moves back too, essentially, it’s start point and the rotation starts over. This only gives me 45 degrees of rotation. So I have two questions.

1: Why is this happening? Is this the gimble lock thing? If I understand why it’s occurring then hopefully I can avoid it in future.

2: How can I rotate the full 360 degree’s on any given axis?

Here’s a snapshot of what I’m currently doing:

Here’s how I’m setting the rotator. I’ve also tried world rotation and it’s the same result.

Thanks,

Do you mean this? 215801-introduction-to-unreal-engine-blueprints-for-begin.pdf (1.04 MB)

If so I just skipped through using rotation as a keyword and you mention placing a limit on it.

Shouldn’t we place a restriction on the upper limit of the yaw value as a float goes up to 3.4x10^38

Could you elaborate on that a bit please?

Thanks,

See my tutorial I posted on blueprints it covers simple rotation.

If youve done coding bedore then you will know that there are limits on data types like floats and integers etc. We adding 30 to our float variable each frame. Its bound to exceed this limit and will cause an error at some stage.

Of course. I think you’re misunderstanding my problem. It hit’s 90 and then stays there, it doesn’t advance any further. A float can hold a value higher than 90. I’m not pushing the type past it’s limitation.

Basically I want to do this every frame:

Y + (RotationAmount * Delta) = NewY.

Then of course handle the case when it reaches 360 to wrap it back around to 0. I’m not exceeding the data type.

If I just start with a float at 0 and increase from there it works. It only seems to get weird if I first fill the variable using GetWorldRotation. I’m obviously misunderstanding something with that.

The problem is in your modulo 90.

Think about modulo as “evenly divide by this number, and give me the left over part”. If you modulo 100 by 90, you get 10, because you divide out one 90 and you have 10 left over. If you modulo 80 by 90, you end up with 80, because you divide out zero 90s, and you’re left with 80. If you modulo 100 degrees by 90, you end up with 10 degrees. That’s why this math looks ok under 90 degrees, but gets weird above 90.

It sounds like what you’re actually intending to do is round down to the nearest degree or something? I’m not really sure what the jitter you’re describing is, but modulo isn’t the solution. :slight_smile:

Rotations like this normally don’t “jitter”, so you should figure out what’s wrong with your object rotations that are causing it to jitter.