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

3 1 1

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
Viewable by all users

2 answers: sort voted first

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

360 2 6 7

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
Viewable by all users

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

766 4 15 5

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 6 days ago

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.

(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