Crazy rotation values overwriting explicit instructions?

I’m trying to do a relatively simple task of getting the wheels on a car to turn. The wheels are a simple cylindrical mesh, with all collision, physics, overlap and hit events turned off - nothing complicated here. To get the wheels to turn, I am attempting to increment the Z (Yaw) rotation by one, and then repeat on a loop. I can do this with a simple delay, timeline, or tick. In the code below, I’m using a delay technique simply so that I can track the values, along with a print string node. I’ll explain why below:

Whatever method I use, the results are the same: X (roll) remains unchanged. Both Y (Pitch) and Z (Yaw) fluctuate wildly in values, with no discernable pattern. The result is that the wheel, instead of spinning in place, flails around like a possessed pillar from purgatory.

I do not understand how this is possible. I’ve even gone so far as to directly set the Y (pitch) value to a specific number every time (as seen above), but the game somehow ignores these instructions and puts its own value in. On top of this, it ignores the Z (Yaw) instructions, writing random values.

What is happening here? How can I achieve my desired result?

id start by setting your pitch/roll to 0.
if you need an offset you can change it in the wheel parent.

remember Z is only left/right on its default axis

I’m just using the starter content Cylinder as a wheel, which needs to be on its side to act as a wheel. Thus the rotation for pitch/roll is correct.
I’m not overly concerned with mixing up the correct axis - that’s something I can easily debug and figure out. What I can’t figure out is how the engine is changing the value for two axis when one of those is specifically being constantly reset back to where it should be - there should be no way for it to move.

because its relative,

ok so on begin play set world rotation 90,90,0
and then set relative rotation to 0,0,X

So I’ve done what you suggested, as seen below. I set the world rotation to 90,90,0 before setting the relative rotation, and zeroed out the X and Y on relative rotation.


This causes the wheel cylinder to spin correctly, but the entire cylinder is now next to the car body instead of where it should be. It is pointing forwards, like a gun, instead of sideways, like a cylinder for a pair of wheels.

Additionally, no matter what values I put into world rotation, the rotation does not change, and yet if I unplug world rotation, the cylinder goes back to where it is supposed to be (and the rotation goes crazy again of course).

I can put a value into the X of relative rotation, which has no effect. If I put a value into the Y of relative rotation (like 90), the cylinder starts producing random rotations.

Can you explain what is going on?

While I still can’t explain everything happening here, at this point I believe the root of the problem lies in gimbal lock. I can get the pillar to turn the way I want it, in every axis except the one I need it to. It will turn to 90 degrees, and then commence wobbling. I still don’t know why it was flailing around or inserting random values for the rotation, but the gimbal lock gives me some idea of how to proceed.

Due to the fact that during testing, I inserted a print string node and the behavior of the pillar changed, I am also guessing that there may be something wrong with the engine or my download of it. I’ve been getting several bugs, including positions not updating on models/viewports as I change them.

your wheel is a scene component so i assume its attached to a ‘car’ actor, thats where you’d normally set the location and initial rotation since those values will never change.

the flailing is due to relative rotation, i’d say watch a video or play around with that to understand it better

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