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"

[Closed] No quaternions in Actors and Components ?


I'm working on a space game. Obviously this requires the controls to be in full 3D, being able to move a ship pointing to the Z axis for example.

The issue is that SetActorRotation or MoveComponent only take FRotators as parameters. Worse than that, they also appear to store FRotators internally. FRotators are subject to a -90 +90 issue on pitch and thus are unusable in my case.

So, is it possible to avoid gimbal lock with UE4 ? What are quaternions good for if the internal representation is fundamentally unreliable ?

Product Version: Not Selected
more ▼

asked Jul 13 '14 at 11:25 AM in C++ Programming

avatar image

594 55 64 133

avatar image Shadowriver Jul 13 '14 at 01:25 PM

FRotator is just struct holding pitch and rest of parameters, not using FRotator most likely won't fix issues you have

avatar image zoid Jul 18 '14 at 12:32 AM

I'd like to know the answer to this as well. I've looked at the code and there are calls to set an FTransform on a USceneComponent but that is decomposed into translation and euler angles, which have this problem.

avatar image Rama Jul 18 '14 at 03:00 AM

FRotators in UE4 really need help, I always have issues with them flipping on me as you describe, for me it happens around the -180 to 180 range, and that flipping constantly interferes with my game mechanics.

Clamping all rotators values to -180 to 180 really helps though :)


avatar image zoid Jul 18 '14 at 03:11 AM

This is a classic issue with using euler angles to express rotations. I'm actually surprised USceneComponent stores rotations like this, even if they are doing it for efficient replication (which is what it appears to be), the rotation could be expressed as a quaternion...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The question has been closed Apr 27 '15 at 09:39 AM by StrangerGwenn for the following reason:

The question is answered, right answer was accepted

1 answer: sort voted first

After some digging around I think this can be done "correctly" using a USceneComponents ability to attach to a socket of another USceneComponent. If you made your own version of a USceneComponent like UQuatSceneComponent that provided a single socket, you can override HasAnySockets(), GetSocketTransform(), and QuerySupportedSockets() and use that to provide full rotational control using an FQuat.

A good example here would be to look at the SpringArmComponent which is what gave me this idea.

Good luck!

more ▼

answered Jul 18 '14 at 03:27 AM

avatar image

326 11 14 226

avatar image zoid Jul 18 '14 at 03:28 AM

NOTE: you'll need to handle replication yourself for the new component...

avatar image Meowski Feb 03 '15 at 01:05 AM


Do you have an example of how to do this? I am at wits end trying to figure out how to do something similar with applying Quaternion data to my Actor!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

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

Answers to this question