Quaternion in blueprint

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.

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.

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!

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

&d=1402641939

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?

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

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

What are you even trying to achieve with pointless filter?

…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.

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 :slight_smile:

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.

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.

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:

@

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.

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.

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.

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

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.

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

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.

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. =)