Dear Friends at Epic,
I am trying to rotate objects within my in-game editor using the mouseDelta ( I am literally dragging the mouse around to change the rotation)
I am just doing Pitch at the moment for testing.
I am smoothly rotating the object along its Pitch value over a full 360 range.
I’ve noticed that at about 90 and about 270, as I am incrementally adjusting the pitch,
the yaw and roll will set themselves to 180, causing a lockup during the smooth rotation that often forces me to switch the direction I am moving the mouse to get the object to keep rotating in the SAME direction and not get stuck.
I noticed this also when I was trying to set the rotation of my Directional Light, the Sun, just smoothly incrementing the yaw was causing a hitch in the rotation at High noon of about 90 degrees.
#Repro
You can even observe this for yourself in the Editor, grab the Sun, and start rotating it along one axis (pitch for example), while the F4 properties window is open.
You’ll notice that the other rotation values (yaw and roll) that you are not trying to edit will be editing themselves as you try to rotate the light along a single axis.
In the editor this works fine and there is no hitch, but when I am only adjusting a single rotation component like pitch via the C++, it is resulting in weird behavior
Why is this happening?
Can you explain to me why this behavior happens and how to avoid it?
It is making my ability to smoothly incrementally rotate objects very difficult
Here’s my code:
//this function is running PER-TICK, resulting in smooth appearance of rotation
//except at 90 and 270 when the yaw and roll, which SHOULD be 0
//go to 180 all of a sudden (and then back to 0)
//Z
if (VictoryPC->IsInputKeyDown(EKeys::Z))
{
//CTRL - Rotation - Pitch
if (VictoryPC->PlayerInput->IsCtrlPressed())
{
//get the Actor Rotation
FRotator RV_Rot = VictoryPC->SelectedSMA->GetActorRotation();
//Increment the Pitch by MouseDelta ( a small number averaging 0-2 per tick)
RV_Rot.Pitch += VictoryPC->MouseDeltaX;
//Passing Each Component for Precision
//(I get same behavior using VectorQuantizedNormal)
SERVER_RotateSMA(
RV_Rot.Pitch, RV_Rot.Yaw, RV_Rot.Roll,
VictoryPC->SelectedSMA
);
return;
}
}
//Doing the Rotation on the server so replicated movement works happily
void AVictoryPower::SERVER_RotateSMA_Implementation(
float P, float Y, float R,
AStaticMeshActor * VSMA
) {
if (!VSMA) return;
//~~~~~~~~~~~~~~
FRotator RV_Rot = FRotator(P, Y, R);
VSMA->SetActorRotation(RV_Rot);
}
#What the issue isnt
It has nothing to do with the network
I had the same problem rotating the Sun locally
It has nothing to do with mousedelta
I was rotating the sun by holding the up arrow on my keyboard and continually adding to the pitch value each tick
Hope you can help me out with this, it’s making rotators difficult for me to use
Rama