# Quaternion in blueprint

**URL:** <https://forums.unrealengine.com/t/quaternion-in-blueprint/5793>\
**Category:** Feedback & Requests\
**Tags:** unreal-engine\
**Created:** [June 9, 2014, 3:36pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793 "2014-06-09T15:36:38Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Zeblote](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zeblote](https://forums.unrealengine.com/u/Zeblote)\
**Post date:** [June 12, 2014, 6:17pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/21 "2014-06-12T18:17:25Z")

</div>

> [@;74219](#):
>
> @Zeblote, ZoltanE and : Please stop trying to circumvent the word filter. 😛 Seriously, it’s kind of obviously against the rules. is your warning, I’m going to edit your posts as well.

Noone was trying to circumvent anything, I simply asked what 4 letter word goes there (as I seriously didn’t think of the 4 letter variant for a sec).

Also, your filter is nonsense. Almost on forum is an adult (or should be, and it’s not like those kids you’re trying to protect are the ones using the most “bad” words is it?). If someone takes random words people write on a forum not even directed at anyone as a personal insult then he should not be on the internet.

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [June 12, 2014, 9:13pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/22 "2014-06-12T21:13:46Z")

</div>

I like quaternions. I wouldn’t mind unit quaternions being the canonical representation of orientation. Right now, it seems “Rotator” is the representation, and as long as I can do whatever with Rotators that I can do with quats, I’m fine. (fast linear interpolation with renormalization, etc.)

Oops. I just looked at the code. FRotator is Euler Angles. That very seldom makes any sense when actually dealing with 3D math. If for some reason Quats are out of favor, 3x3 matrices are second best (although they over-specify the rotation, and can skew/denormalize.) Also, conversion to/from Euler is pretty expensive from a runtime perspective. I’d rather take out all the FRotators and put in all Quternions instead…

PS: Funny story: I once stayed at a farm. While the ■■■■ would wake me up in the morning, it was the braying of the \*\*\* that was the loudest farm noise.

---

<div class="post-metadata">

**Author:** ![ambershee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ambershee](https://forums.unrealengine.com/u/ambershee)\
**Post date:** [June 13, 2014, 6:19am UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/23 "2014-06-13T06:19:53Z")

</div>

> [@Whiting;74226](#):
>
> - “projecting from camera space, or working with actors based on their screen space coordinates has become a complete and utter nightmare” (are the Project / Deproject functions that are BP exposed insuffiient for your case?)

In case, the problem is that normal projection / deprojection functions aren’t exposed _at all_. There’s an interface in the player controller but a lot of that revolves around the mouse cursor (GetHitResultUnderCursor / DeprojectMousePositionToWorld). is obviously way too specific to meet the needs of anything except clicking on objects. There’s one function in the PlayerController called GetHitResultAtScreenPosition that is actually more versatile and is the only function that needed to be exposed, but somewhat perversely it’s the one that isn’t exposed to blueprints. There’s also a function in the HUD called Project, but it suffers from nasty UE3 hangovers and relies on the HUD (if there even is one) for a given player controller, and relies on the canvas being valid when you want to do the projection (the canvas is often not valid). Maybe I want to get screen space coordinates for objects, but don’t want to do gameplay stuff and not perform drawing operations?

In short, it’s not very well implemented and all of these functions are completely reliant on having a player controller. Some are reliant on having a HUD and being called at a time when the canvas is valid. The functions that are exposed to blueprint do not need to exist, and the function that should replace them is the one that isn’t.

In the player controller, GetHitResultAtScreenPosition should be exposed to blueprint and the under cursor / under finger functions can be removed. Functions to get the mouse coordinates and finger coordinates (with indices) already exist and can be just plugged directly into GetHitResultAtScreenPosition. By having the under cursor / under finger functions, you’ve made an assumption about what I intend to implement, and there’s a pretty good that assumption is wrong. Maybe I want to find what is on the screen at an arbitrary set of coordinates that are not the mouse or a finger? What if my game is split screen and I have one HUD, but two cameras? There are probably loads of other valid use cases where these functions aren’t useable.

What you should implement are standard projection / deprojection functions for any given camera via something like the scene manager. removes the reliance on player controllers, HUDs and the canvas - and at the end of the day these are the functions you’re using anyway, just via a chain of other actors that aren’t actually relevant.

TL;DR - The current philosophy for building game framework and other parts of the blueprint API are causing people issues because assumptions are being made that are resulting in highly specialised and completely inflexible nodes that do not meet the needs of a wide variety of use cases. Instead, blueprint should really mirror the C++ API for each actor / object / component class as much as possible and provide a static function library for certain gameplay specifics - it doesn’t matter if it takes three nodes to achieve something instead of one highly specialised node - what matters is that the user can actually achieve what they need to do.

Also, try and avoid hangups caused by Eldercode and awkward conventions from previous engine iterations. A lot of them did some real bad voodoo.

Thanks!

---

<div class="post-metadata">

**Author:** ![ryanjon2040](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ryanjon2040/32/906587_2.png) [@ryanjon2040](https://forums.unrealengine.com/u/ryanjon2040)\
**Post date:** [June 13, 2014, 6:46am UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/24 "2014-06-13T06:46:27Z")

</div>

> [@Whiting;74226](#):
>
> (are the Project / Deproject functions that are BP exposed insuffiient for your case?)

Am running 4.2.1 compiled from Github and i don’t have Deproject node in HUD Blueprint.

 ![NoDeproject.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/7/a/7aae933c5e2cb1206e91cbc5f7ed8dab9d5e1830.png)&d=1402641939

---

<div class="post-metadata">

**Author:** ![ambershee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ambershee](https://forums.unrealengine.com/u/ambershee)\
**Post date:** [June 13, 2014, 8:18am UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/25 "2014-06-13T08:18:21Z")

</div>

> [@;74785](#):
>
> Am running 4.2.1 compiled from Github and i don’t have Deproject node in HUD Blueprint.

Yeah, I went over all the options in my post. The Project node actually uses the HUD canvas, so it’s useless when not drawing the HUD. Maybe I want to project / deproject to a security camera, as an example?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_759e5c3a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_759e5c3a](https://forums.unrealengine.com/u/anonymous_user_759e5c3a)\
**Post date:** [June 13, 2014, 1:11pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/26 "2014-06-13T13:11:33Z")

</div>

> [@jwatte;74499](#):
>
> PS: Funny story: I once stayed at a farm. While the \*\*\*\* would wake me up in the morning, it was the braying of the \*\*\* that was the loudest farm noise.

Thanks for pointing that out. I found that word had been commented out of the list and added it back.

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [June 13, 2014, 4:32pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/27 "2014-06-13T16:32:19Z")

</div>

Thanks ! If you could also swap rotators to quaternions as easily, life would be sweet 🙂

---

<div class="post-metadata">

**Author:** ![Zeblote](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zeblote](https://forums.unrealengine.com/u/Zeblote)\
**Post date:** [June 13, 2014, 4:40pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/28 "2014-06-13T16:40:34Z")

</div>

> [@;74979](#):
>
> Thanks for pointing that out. I found that word had been commented out of the list and added it back.

What are you even trying to achieve with pointless filter?

---

<div class="post-metadata">

**Author:** ![ambershee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ambershee](https://forums.unrealengine.com/u/ambershee)\
**Post date:** [June 14, 2014, 1:49am UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/29 "2014-06-14T01:49:32Z")

</div>

> [@;74979](#):
>
> Thanks for pointing that out. I found that word had been commented out of the list and added it back.

…because it shouldn’t have been filtered in the first place. It’s two different nouns (as pointed out above), but it is also a perfectly valid verb.

If you want to censor out any word that may be taken in vulgar context, you’ll have none left. Just stick to the obvious cursewords that do not have multiple meanings, and leave it at that.

---

<div class="post-metadata">

**Author:** ![Nick\_Whiting](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nick\_Whiting](https://forums.unrealengine.com/u/Nick_Whiting)\
**Post date:** [June 16, 2014, 6:10pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/30 "2014-06-16T18:10:08Z")

</div>

I talked to , and he’s going to chime in when he gets back in the office, but apparently he has recently exposed the project / deproject functionality in a more direct way. That should be available soon!

As for other cases, again, we’re not assuming what people do with it, but we tend to expose as people have the need for it. So, the engine gets better and better as we have more use cases. If you find stuff like in the future, if you expose the functionality you want, let us know and provide a pull request! We’re happy to integrate 🙂

---

<div class="post-metadata">

**Author:** ![Dig\_Squid](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dig_squid/32/1145423_2.png) [@Dig\_Squid](https://forums.unrealengine.com/u/Dig_Squid)\
**Post date:** [June 17, 2014, 11:16am UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/31 "2014-06-17T11:16:08Z")

</div>

was the commit where I exposed ‘Deproject’ on HUD and ‘ConvertScreenLocationToWorldSpace’ to PlayerController:  
/EpicGames/UnrealEngine/commit/6fdefacb254c14b816dd946569e8389b7d4949be

On PC the name is ‘ConvertScreenLocationToWorldSpace’ to match the existing ‘ConvertMouseLocationToWorldSpace’ function. If there is another place where it would be useful please let us know and we can consider adding it!

I love using quaternions as well, but they do have some serious drawbacks in Blueprints - the most serious of which is the inability to enter meaningful literal values. There are lots of places where you want to quickly yaw/pitch/roll something by 90 degrees, or pull apart a Rotator and manipulate elements directly. Some of our functions actually convert to quats and back under the covers (e.g. CombineRotators) to give the ‘correct’ behavior.

---

<div class="post-metadata">

**Author:** ![ambershee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ambershee](https://forums.unrealengine.com/u/ambershee)\
**Post date:** [June 20, 2014, 6:25am UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/32 "2014-06-20T06:25:37Z")

</div>

I did reply to this, but here goes again!

Exposing those is a great move in the right direction and is helpful in the short term. In the long term, I’d propose the following changes:

1. HUD project and deproject functions either removed, modified, or will only compile when attached to an Event Draw HUD. The issue with these is that they are reliant on the HUD canvas, and as a result they will not return valid values if they are used with other events.
2. Expose projection and deprojection for any camera via the scene view. All projection / deprojection functions go via the scene view, so there’s nothing new here - you’re just removing the need for it to be piped through actors that may not be valid or relevant. means you’ll finally be able to deproject from cameras that aren’t associated with a player controller - something which would be pretty common. It would also make the HUD functions redundant.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33e74471](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33e74471](https://forums.unrealengine.com/u/anonymous_user_33e74471)\
**Post date:** [February 18, 2016, 9:59pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/33 "2016-02-18T21:59:30Z")

</div>

I can see the frustration with some quaternion functionality not being there for rotators in blueprints, but I think the much more sensible solution would be to add that functionality for rotators than to make quaternions accessible. I already find a bunch of the C++ interfaces annoying because I have to convert from FRotator to Quaternion and back when I really only need one. I don’t need that kind of annoyance added to blueprints too.

Quaternion is really only useful in performance intensive cases, and if you have those you probably don’t want that code to be in blueprints anyway. You’ll be losing more performance to having it in blueprints than you’ll gain replacing it with quats.

Quaternions are super complicated and I don’t really see any benefit to having them in blueprint vs making frotator versions of the functions that are missing in blueprint.

edit:

@

> [@](#):
>
> 1. Expose projection and deprojection for any camera via the scene view. All projection / deprojection functions go via the scene view, so there’s nothing new here - you’re just removing the need for it to be piped through actors that may not be valid or relevant. means you’ll finally be able to deproject from cameras that aren’t associated with a player controller - something which would be pretty common. It would also make the HUD functions redundant.

is actually way more complex than you might think. Cameras in unreal actually don’t have all the required information needed to do a valid projection/deprojection that a player might be experiencing. The sceneview is generated on the fly from a bunch of different things. That’s why it’s on the player controller. It would be nice if camera’s had simple deproject functions on them also using the info they do have, which should be possible and not super hard to make, but that would act totally differently than the project/deproject functions on the playercontroller.

---

<div class="post-metadata">

**Author:** ![zalo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zalo](https://forums.unrealengine.com/u/zalo)\
**Post date:** [February 23, 2016, 5:40am UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/34 "2016-02-23T05:40:09Z")

</div>

Well, since thread was bumped, I thought I’d chime in that it would be extremely useful to be able to turn Rotators into Quaternions (or even angle-axis representations) in BP so I can construct a decent rotation matrix for some… camera projection shader stuff I’ve been working on. Trying to construct one using the Axis from “Get Axes” and the “X (Roll)” seems to be a futile effort.

 ![Reproject.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/7/c/7c121d8ba78aeef4caac0084cb1d75cd34a9b2e8.png)

Also I have to agree with old and the gang that I’m disappointed that a large quantity of the useful helper functions were (and still are) left unexposed to blueprints.

---

<div class="post-metadata">

**Author:** ![Mewbits](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mewbits/32/1194714_2.png) [@Mewbits](https://forums.unrealengine.com/u/Mewbits)\
**Post date:** [May 6, 2017, 7:40am UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/35 "2017-05-06T07:40:09Z")

</div>

> [@ZoltanE](#):
>
> Here is a RotatorToQuat blueprint macro for those of us who do not know c++:  
> [http://zspline.net/files/RotatorToQuat.uasset](http://zspline.net/files/RotatorToQuat.uasset)

Would it be too difficult to also ask for a Quat to Rotator macro as well please? Thank you!

---

<div class="post-metadata">

**Author:** ![BlackFangTech](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlackFangTech](https://forums.unrealengine.com/u/BlackFangTech)\
**Post date:** [May 6, 2017, 4:43pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/36 "2017-05-06T16:43:02Z")

</div>

I really wish the engine devs would go the other way and expose quats to blueprints more. Not having quats basically makes using blueprints impossible for a lot of the things I work on. I despise rotators.

---

<div class="post-metadata">

**Author:** ![Lobotomy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lobotomy](https://forums.unrealengine.com/u/Lobotomy)\
**Post date:** [May 7, 2017, 7:32am UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/37 "2017-05-07T07:32:20Z")

</div>

Agreed, have you ever tried giving your character 360 degree movement? Absolutely impossible!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2a09f2b7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2a09f2b7](https://forums.unrealengine.com/u/anonymous_user_2a09f2b7)\
**Post date:** [May 10, 2017, 2:45pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/38 "2017-05-10T14:45:11Z")

</div>

> [@;705234](#):
>
> I really wish the engine devs would go the other way and expose quats to blueprints more. Not having quats basically makes using blueprints impossible for a lot of the things I work on. I despise rotators.

Things like custom gravity, spider-walking, 6DOF movement, all without C++ intervention?

---

<div class="post-metadata">

**Author:** ![BlackFangTech](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlackFangTech](https://forums.unrealengine.com/u/BlackFangTech)\
**Post date:** [May 10, 2017, 4:06pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/39 "2017-05-10T16:06:09Z")

</div>

> [@lunyBunny;707087](#):
>
> Things like custom gravity, spider-walking, 6DOF movement, all without C++ intervention?

I still wouldn’t want to do movement mechanics in blueprint, but it would sure help when making one-off things to use in a world with custom gravity.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2a09f2b7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2a09f2b7](https://forums.unrealengine.com/u/anonymous_user_2a09f2b7)\
**Post date:** [May 11, 2017, 3:24pm UTC](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793/40 "2017-05-11T15:24:15Z")

</div>

> [@;707119](#):
>
> I still wouldn’t want to do movement mechanics in blueprint, but it would sure help when making one-off things to use in a world with custom gravity.

Of course @ you’re right. Is much better to work with C++ movements/physics components, exposing many adjustable variables, than to create complex math and physics algorithms using blueprint only. =)

[Previous page](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793.md?page=1)

[Next page](https://forums.unrealengine.com/t/quaternion-in-blueprint/5793.md?page=3)
