I’ve been trying to implement a barrel roll dodge into the Flying Pawn BP in the Flying Template example project for a space-themed game I’m working on, which seemed like it would be fairly easy to do, but has proven to be pretty difficult for me.
What’s happening is that when the barrel roll is initiated, it seems like the ship spazzes out, but when I was working on the same project on a slightly slower computer, I was able to see that what was actually happening was that the ship was doing exactly what I wanted; however, it was snapping back to its original, upright position every other frame or so, making it look really bad.
What I’ve done so far, other than just tweaking a million settings without any results, is create a new pawn-class BP and carefully analyze chunks of the Flying Pawn BP as I copy them over to my new blueprint. The result is the same as before, so I’m worried that the problem lies in the C++ code, which I have no real experience with.
Here’s a screenshot of the barrel roll section of my BP (the alpha used for the lerp is a timeline that goes from zero to one):
I know. That is why I said it is weird. I tried to replicate it via flying template and my ship too did rotate like many times in 1 second via timeline from 0 to 1. (Assuming it is the spazing that alexundr is talking about) But weirdly when i put the delta seconds in the alpha It did only 1 rotation like supposed too. It was not perfect, but it did it and I was left with scraping my head.
Can you please provide us with the entire code related to this ? If you haven’t figured it out yet ?
EDIT - I guess, I see your problem. I’m also still guessing since we don’t have a full code.
I think what is causing the weird spassing is you possibly attaching the delay and SetRotation to 0,0,0 with the Update node of your timeline ? Since it is updating every tick the ship is spassing.
If this is the case, try attaching the Delay + Setting rotation to 0,0,0 to Finished node of your timeline.
So, I tried hooking up the delay and set rotation nodes up to the finished output of the timeline. It made me realize that it really was the cause of the snapping back to zero rotation every frame. I can’t believe I didn’t catch that, haha.
But it brought back the problem I was having before, with the ship seeming like it was spinning a whole bunch of times, instead of doing it just once.
Though, I don’t really understand why adding that delay and rotation nodes would stop that crazy rotation from happening and get it to behave correctly, besides the crazy snapping to zero thing.
I tried the world delta seconds alpha without resetting the rotation, and, like you said, it really did slow it down a lot, but it’s still rotating too much, and ends at a random awkward angle that just gets worse each time I roll. Additionally, it’s rotating around a weird pivot point, even though I know the pivot of my ships’ mesh is in the correct spot, which is really weird considering that I’m pretty sure the rotations pivot was fine when some other methods are used.
Man, this problem is so ridiculous. I feel like it’s so close, but it just doesn’t want to work!
I really appreciate all your help on this!
For the rotation, I would also delete the Lerp. If you know how long your timeline is, I would just add some degrees for every frame of the timeline. So if your timeline is 2 seconds long, you would take 360 / 2 * (delta seconds) and add that to the roll rotation.
The problem is the rotation. Even though I have it set to rotate one time, 360 degrees from where it’s at, it seems like it just rotates like crazy and ends up with some random rotation.
Before, I had a delay followed by a set rotation to 0,0,0 at the end of my timeline update output, in order to combat the weird leftover rotation, and that actually fixed all the problems I was having, but left me with a new one. It would do it every tick, leaving it to look like it was snapping back to zero rotation every other frame or so.
Alright, so it’s only rotating once now, which is awesome, but for some reason, it’s going slightly past the 360 degree mark. Also, I don’t have any clue why, but the rotation pivot looks like it’s on the tip of the left wing of my ship.