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"

Is there a reliable replacement for the Quaternion math in blueprints?

Hey, I was messing around trying to convert the "physics gun" from the content examples map to have features similar to the stock gun in UE3, but I hit a snag in regards to orientation. The UE3 gun uses quaternions to calculate out the orientation of the RB Grabber, but quaternions are unavailable in blueprints. Is there a reliable replacement for the quaternion math available? Otherwise, I'd like to see them added as a variable type in the future.


Product Version: Not Selected
more ▼

asked Mar 25 '14 at 02:38 AM in Blueprint Scripting

avatar image

James Steininger
126 12 26 30

avatar image Gebba Mar 25 '14 at 08:13 AM

I've never worked with UE3 (And pretty new at this in general), but isn't it just the rotator you're after? You can get an actors rotator, and get directional vectors etc.

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

6 answers: sort voted first

Hello ! Blueprint node "Combine Rotators" is in reality making a quaternion rotation !

Here is the proof : When you call this node, it converts both rotators to Quaternions (FQuat), multiplies them, and returns the result as a Rotator !

UE4 Quaternions

Hope it helped ;)

more ▼

answered Jun 26 '16 at 09:06 PM

avatar image

114 12 11 16

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

We don't plan to add Quaternion support to Blueprints because they are quite complicated to enter and create from components, whereas Euler angles (Rotator) make quite a lot of sense to break apart and put back together. We did however expose several maths functions which convert to quaternion under the covers (e.g. 'Combine Rotators' and 'Negate Rotator' nodes). You can also use a Transform which stores the rotation as a quaternion internally.

more ▼

answered Mar 25 '14 at 10:02 AM

avatar image

1.3k 8 8 32

avatar image Roel Mar 25 '14 at 10:08 AM

Isn't Rotator already a Quaternion internally? Since a Euler could just be stored in a Vector.

avatar image JamesG STAFF Mar 25 '14 at 10:09 AM

Rotator is stored as Euler angles. As you say it is basically just a vector, but we keep it as a separate type to make things more clear.

avatar image Roel Mar 25 '14 at 10:13 AM

Ok! Thanks for the info :)

avatar image Art_Oculus Jan 25 '15 at 05:45 AM

The only problem with Rotators is gimbal lock. It is literally unavoidable and really becoming a critical issue in VR, where you can look straight up or straight down (these are the most gimbal-lock-prone points). Man I am sick of it already. In C++ you can workaround many cases of gimbal lock by converting them into Quaternions (even, though, most of the rotations are still stored as rotators, such as ViewRotation or ControlRotation); no such luck in Blueprints. This really should be addressed if you are seriously targeting UE4 for VR (and you better do!)

avatar image KITATUS Sep 11 '15 at 10:46 PM

Gimbal lock is really annoying. Can we get Quat support in BP now? We've been good :(

avatar image Doublezer0 Nov 04 '15 at 07:06 PM

Have this issue right now. It's time Epic gave us an Advanced Exposed Blueprint API for those who wish to use it. I think we have earned it by now.

avatar image SIGage Nov 06 '15 at 11:32 AM

Yeah I'm completely blocked by this. Makes sense to hold people's hands if they don't know how to use quats and matrices but many of us do

avatar image CodeJingle Apr 20 '16 at 04:45 PM

We shouldn't be fighting for native Quaternion support. Quaternions should be the baseline. I am assuming by now this support is in there?

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

I think in the background the Rotator (sometimes in blueprint referred to as Rot) is in the background actually a Quaternion, but since most people don't feel like doing math with Quaternions, the only show Euler angles. Even if you break a Rotator it will output the Euler.

So in short, try using the Rotator functionality for anything you want to do with rotations.

more ▼

answered Mar 25 '14 at 09:05 AM

avatar image

2.4k 70 43 142

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

Bump! I need quaternions too.

more ▼

answered Aug 04 '17 at 07:59 AM

avatar image

Bartosz Kamol Kamiński
31 1 5

avatar image Hevedy Aug 18 '17 at 01:30 PM

Double bump

avatar image VRLABDEV Aug 25 '17 at 08:21 PM

Triple bump

avatar image EminorReal Sep 21 '18 at 01:03 PM

Quadruple bump

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

alt text


When composing a quaternion from two vectors, the first vector is the master vector which the new rotation will do its very best to adhere to! The second is the slave vector, which will supply all other rotation information. For example, by using the surface normal as the Z vector and forward as X, you can align a character with a surface using Compose from ZX!

more ▼

answered Sep 21 '18 at 05:26 PM

avatar image

23 1 5 8

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

Okay so I think what JamesG (https://answers.unrealengine.com/users/98/jamesg.html) was saying is that although Quats are not a Blueprint variable type, you can feed Euler-based Rotators into certain math functions such as CombineRotators and NegateRotator, and it will calculate them using Quaternions to output a new transformed Euler-based Rotator that didn't get gimbal-locked (did I understand that correctly?)

He says you can store rotations in a Transform, which stores them internally as Quats, and I think you feed that Euler angles too. So basically in Blueprint it sounds like you cannot create or edit Quaternions, but you CAN get equivalent Euler angles without gimbal lock issues by doing all your rotator transformations via the math nodes that use Quaternions internally. You input Eulers to them and they output Eulers, but they use Quats to calculate so they should avoid gimbal lock. It's blackboxed but you can used it to get the same results. Did I understand that correctly?

more ▼

answered Aug 25 '17 at 04:46 PM

avatar image

3.7k 18 23 20

avatar image Osakanone Oct 10 '17 at 10:17 AM

You don't get the same results. If you have several stages of operation in which the variable passes through the rotator variable type (aka, it comes out of any of those functions) you are immediately welcomed back to gimball hell.

avatar image mightyenigma Oct 10 '17 at 07:17 PM

Darn. I was hoping...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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