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"

How can I rotate my flying pawn past 90°?

Im currently in the flying blueprint template messing around in blueprints trying to create a mechanic where upon hitting a key (in this case its Z) the ship will pitched up 180 degrees (a half loop) for you and will make the ship face the other way as a sort of evasive maneuver. However, no matter what I try, it'll only rotate by 90 degrees and no more. I have tried most of the rotation nodes like set actor local rotation but that just causes the ship to go mental. Any ideas? alt text

alt text alt text

Product Version: Not Selected
bug.png (203.4 kB)
bug-2.png (426.4 kB)
bug-3.png (434.7 kB)
more ▼

asked Jun 12 '18 at 02:34 PM in Blueprint Scripting

avatar image

18 1 6

avatar image mightyenigma Jun 12 '18 at 03:06 PM

are ypu able to accomplish the same manuever by directly controlling it rather than an automated lerp? If not then it is probably gimbal locked

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

5 answers: sort voted first

We can try to do it without Rinterpto, to find out if Rinterpto is the problem.

Timeline is pretty straightforward to use. You just Create a Timeline Node, double click it, then create a float track and set two or three keyframes in the graph that opens, Then use the float track's output as your new rotation value, and use SetActor Rotation, putting that float into the Pitch axis.

So Keyframe 1 is going to have a value of 0 so you start at 0 pitch. at time zero seconds. Keyframe 2 could have the -180 value at 5 seconds.

You could have more keyframes in between on the track like a middle one to make sure it rotates up to 90 or -90 degrees first before going to the full 180

hope it works

more ▼

answered Jul 14 '18 at 08:54 PM

avatar image

3.7k 17 18 14

avatar image FroyoBlaze Jul 15 '18 at 12:15 PM

Huzzah. Im pretty sure it works now. Must've been something with that Rinterp node. Kinda sucks that Rinterp has gimbal locking

avatar image FroyoBlaze Jul 15 '18 at 12:15 PM

Im going to to accept the answer now, thanks for sticking around so long :P. Lets hope I dont run into another issue again .-.

avatar image mightyenigma Jul 16 '18 at 04:40 PM

Maybe Rinterpto limits the rotation to 90 degrees on pitch in order to prevent gimbal lock or something. IDK. Glad the timeline worked!

avatar image FroyoBlaze Jul 17 '18 at 01:07 PM

Maybe I spoke too soon. A timeline isn't the best option so it seems. A timeline worked flawlessly until I realised that the key frames are all FIXED values. Unless you can edit them at will using C++, the maneuver will always start at zero degrees and end at 180, regardless of what angle you started in. I tried not using everything by simply adding a number to the pitch rotation every tick and EVEN THAT gets capped at 90. Im starting to think this is a serious bug or flaw with the engine at this point

avatar image mightyenigma Jul 18 '18 at 08:02 PM

Yes they are fixed values, but you can use those outputted fixed values to add to a StartingPitch var you set before the timeline starts playing, and set the Actor Rotation to THAT. Does that work?

avatar image FroyoBlaze Jul 27 '18 at 04:50 PM

Not perfect but it is something

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

You want the ship to do a 180 from its current rotation, right?

In your blueprint you're simply setting the pitch to 180 degrees instead of adding 180 degrees to the ship's current pitch.

more ▼

answered Jun 12 '18 at 03:08 PM

avatar image

370 2 7 12

avatar image mightyenigma Jun 12 '18 at 03:13 PM

oh wow. good catch! Perhaps jt is not gimbal lock after all :)

avatar image FroyoBlaze Jun 12 '18 at 07:36 PM

Well I was trying to have it lerp to the 180 rotation over a short amount of time instead of an immediate snap to 180. Unless you mean something else? How would I add it instead of setting it?

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

I believe this would do it, haven't tried it tho. Sorry if I'm already bringing up a solution that has already been submitted ;3

Please see this picture of my solution:


Also, if your pawn used pawn control rotation, this wouldn't allow you to turn more than 90% upwards, as no cameras controlled by player-input directly can't look backwards using only the pitch-axis. However, if your camera is controlled by the pawn, you can add rotation to the pawn further than 90% on the pitch, and the camera with follow along with it.

Hope this was helpful! :)

more ▼

answered Jul 14 '18 at 10:00 PM

avatar image

104 4 7 8

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

I think you are experiencing Gimbal Lock. This is a weakness in the Euler Rotators used by Unreal and most 3D engines.

I have heard there is a way to overcome it by using Combine Rotators node, supposing that it internally uses Quaternions to calculate the output Rotator. Perhaps that will work (I dont know for sure) to take your current rotation, and then put the added amou t to rotate on the second input of the Combine Rotators node and then do set Actor Rotation from that combine Rotators output.

Let me know if that works.

more ▼

answered Jun 12 '18 at 03:04 PM

avatar image

3.7k 17 18 14

avatar image FroyoBlaze Jun 12 '18 at 07:37 PM

Could you show me with an image or something? Sorry, I'm not the most skilled with ue4. :P

avatar image FroyoBlaze Jun 12 '18 at 07:37 PM

I'll give it a try however alt text

Something like this?

like-this.png (98.7 kB)
avatar image mightyenigma Jun 13 '18 at 05:30 PM

Not exactly.

There are lots of different ways to rotate an actor:

SetActorRotation uses absolute rotation values (world rotation)

SetActorRelativeRotation is a little different

AddToControlRotation will change the rotation values on the Controller and then the controller will decide how to apply that to the Pawn. It will do this incrementally though, rather than setting it to a specific rotation. This is great for controlling rotation with a mouse axis but not good for choreographed movements.

If you CombineRotators from your GetActorRotation to all the math you did on that Actor's rotation, it's going to accumulated extra rotation amounts. You should combine it with the starting rotation amount to aid the lerp.

But you only need to do that if you're getting gimbal locked (you might be but I don't know).

@Velrin is saying you might just be putting in the wrong target rotation. Try going back to your original way of doing it and changing it to 270 degrees instead of 180 and see if it gets past the vertical, before trying anything else.

avatar image FroyoBlaze Jun 13 '18 at 06:12 PM

I have tried changing the number to 270 but to no avail. It just is not happy with going past 90 degrees and you are right about Add To Control Rotation part. I've seen fixed that mentioned it but that node is normally for when you are inputting the movement itself, not done automatically with an event tick. In what way do you want me to combine the rotators? I've got a variable that now records the starting rotation. Do you want the starting rotation to be A or B? alt text

Forgive me if I am wrong

rotation-code.png (112.1 kB)
avatar image mightyenigma Jun 13 '18 at 06:44 PM

CombineRotators first applies A and then B on top of the first one from A using quaternions (which rules out the gimbal lock problem if that's what's happening to you).

So I think maybe it will work to apply first your Starting Rotation on the A, and then the change in pitch on top of that. But maybe don't use RInterpToConstant. Instead maybe try a single float value interp from 0 to 180 and feed that into the Pitch Component of the B on CombineRotators, and keep the other axes on B zero (because we don't need to alter the Starting rotation by anything but pitch, right?)

I don't know if this will work but I think we should try it.

avatar image mightyenigma Jun 13 '18 at 06:46 PM

Also make sure your Pawn is not a Character class or using CharacterMovement component, as that will limit your pitch to not be able to flip upside down. At least it seems to me that it does.

avatar image FroyoBlaze Jun 14 '18 at 03:41 PM

The character is definitely a pawn and does not use any type of a movement component. I assume you mean something like this?alt text

avatar image FroyoBlaze Jun 14 '18 at 03:45 PM

Well I did that but split up the starting rotation so it only combined the pitch from both A and B. It did the exact same thing as every other attempt ever has but refuses to go past 90. 90 is just its limit. Changing the plus from 180 to 270 still wont let it go past 90.alt text

hates-90.png (262.9 kB)
avatar image mightyenigma Jun 18 '18 at 06:34 PM

Yes that looks like how I would try to do it. I'm sorry that's not working. Are you able to pitch up until the ship turns upside-down if you are directly controlling it via InputAxis events rather than lerping the rotation over time?

If you can get direct pitch control to flip the airplane then we know it's not something else wrong with the airplane stopping it from rotating past the 90 degree mark; instead it must be something about how we're doing the math. Let's rule out that possibility if you haven't done so yet.

avatar image FroyoBlaze Jul 01 '18 at 01:40 PM

Yes, I can pitch the ship however much degrees I want in any direction but as soon as I use set rotation nodes of any kind or add control rotation to automate it instead of using input axis, it always tends to cap at 90.

avatar image mightyenigma Jul 01 '18 at 04:22 PM

Maybe before setrotation or setcontrolrotation node or addcontrolrotation node, you can test whether pitch is equal or Nearly Equal to 90 and if it is, set it to either 89.999 or 90.001 degrees instead, depending on what side of 90 the rotation is at before adding the further rotation. This might prevent the locking. I have overcome this problem before but.i dont remember how. i remember trying something like that though.

avatar image FroyoBlaze Jul 04 '18 at 01:00 PM

So you're saying to set it to a very small number above 90 before it actually reaches 90 to bypass the locking?

avatar image mightyenigma Jul 05 '18 at 03:59 PM

Yep. You can experience gimbal lock just in the level editor viewport by selecting an Actor, then right-clicking it and selecting "Pilot " from the pop up menu, and then holding the right mouse button to rotate it up or down as far as it will go, then trying to rotate another direction. It locks up at 90 degrees and changes the definition of all the other axis rotations to be all confused.

avatar image FroyoBlaze Jul 08 '18 at 01:27 PM

I'm not always 100% sure of what I'm doing but what I do know is that this gimbal lock nonsense is really irritating when i'm trying to have some fun and test stuff with the engine. I made a piece of code which does what you said, setting the pitch to be above 90 before it reaches more than 89 and the game seems to detect im trying to bypass the gimbal lock and pushes the number down before 90 again. alt text

gimbal-lock.png (86.8 kB)
avatar image FroyoBlaze Jul 08 '18 at 01:29 PM

Lets say I want to set it something above 90 like 95. Once that number is set it pushes the number back down to 85 ish. And if I try to set the pitch to 120, it sets it back down to 60 ish. The higher a degree in pitch above 90 I set it to, the more it pushes me down. It will not allow any case of me going beyond 90 and its really strange

avatar image mightyenigma Jul 08 '18 at 08:33 PM

that is strange. I know i got this to work in a past project. hopefully i still have that project and can help.

This pushing down problem is happening even without interpolation (like rinterpto?)

avatar image mightyenigma Jul 08 '18 at 08:51 PM

I found this in my projects. It allows manual pitch in a full loop: https://blueprintue.com/blueprint/ocjn9o0f/

But I know that's not your problem; your problem is when it's doing an interpolation or timeline kind of movement. It makes me think there must be something about the rinterpto that clamps the pitch at 90 degrees, maybe?

avatar image FroyoBlaze Jul 14 '18 at 02:14 PM

Yea as i've said, manual rotation past 90 is easily do-able but using a rinterp caps it at 90. I dont think I've used a timeline yet so how would I make it with one? I hope the rinterp node is the one causing the problem

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

I fixed gimbal lock in the flying template, see if this works for you


more ▼

answered Aug 01 '18 at 04:44 PM

avatar image

Nebula Games Inc
3.6k 20 9 14

(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