x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Problems with SetRelativeRotation

Sorry for my bad English ;D Hope someone could help... I guess im doing something very simple very wrong again.

I rotate my Camera aroud my Character wich works fine if the Pitch I set for "SetRelativeRotation" is unequal 270 e.g. OurCameraSpringArm->SetRelativeRotation(FRotator(280.0f, Rotation.Yaw, 0.0f)); - this is working fine!

But when I set the pitch to 270 to watch exactly from top the camera beginns to spin like crazy wich is caused by wrong values in Roll and Pitch (snapping from -180° to 180° and back again(the springarm component)). Is this a bug or am i just too stupid ? btw i deleted my asset an created it again from c++ class wich can cause somethin similar i read but its not fixed for me, by just readding the asset ; ( .

All i do for Camera Rotation is

 if (bYawTheCamera) {
             FTransform NewTransform = OurCameraSpringArm->GetRelativeTransform();
             FRotator Rotation = NewTransform.GetRotation().Rotator();
             Rotation.Yaw += CameraInput.X;
             OurCameraSpringArm->SetRelativeRotation(FRotator(270.0f, Rotation.Yaw, 0.0f));
 
         }


Why i try this is to debug my character rotation(i disabled the rotation stuff at this moment to find whats causing this SetRelativeRotation problem), wich gets off when pitching and yawing the camera (i rotate my character to mouse position) ...

 FVector mouseLocation, mouseDirection;
         APlayerController* MyController = GetWorld()->GetFirstPlayerController();
         MyController->DeprojectMousePositionToWorld(mouseLocation, mouseDirection);
             //rotate 10 degrees around y axis
         FVector YAxisRotatedVector = mouseDirection.RotateAngleAxis(10, FVector(0, 1, 0));

This fixes the pitch Rotation (otherwise the mouse position and character look at rotation drift apart). But when i try to fix the yaw rotation by rotating the Vector like I did with the pitch, it doesnt work.

Product Version: UE 4.12
Tags:
more ▼

asked Aug 16 '16 at 11:28 AM in C++ Programming

avatar image

L1ne
11 2 4 9

avatar image L1ne Aug 16 '16 at 12:54 PM

ok now i use FHitResult for character rotation so i dont need to rotate the mouseposition ... but would still like to know whats wrong with the rotation of my camera springarm when set to 270

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Post is too old!

more ▼

answered Dec 07 '18 at 10:27 AM

avatar image

L1ne
11 2 4 9

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question