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 to make a 360 one way roll?

How can i make my pawn roll 360°? I want to make it roll in one way without going "reverse" like "Interp to" does.

I was trying few things but it has to many bugs and will take like 60+ nodes or more, i just want to ask here if there is a simpler way to do it.

Product Version: UE 4.20
more ▼

asked Sep 05 '18 at 01:22 AM in Blueprint Scripting

avatar image

36 3 4 13

avatar image ThompsonN13 Sep 05 '18 at 01:34 AM

whats the context? is it a one time thing or continuous? is it a click event where you press a button once to make it happen or are you looking for a axis event where it will keep rolling as long as the buttons down?

avatar image G1K777 Sep 05 '18 at 01:38 AM

If you press a button it makes one roll and then i add a delay between the rolls.

avatar image ThompsonN13 Sep 05 '18 at 01:49 AM

what is "it"? the player character? or a mesh?

in any event have you looked into using a timeline or adding rotation on tick. those would be a few simple ways to accomplish this.

avatar image G1K777 Sep 05 '18 at 05:12 AM

I wrote at the beginning "Pawn roll".

avatar image G1K777 Sep 05 '18 at 04:43 PM

I edited the one above, i mean the second comment here.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

to accomplish a basic roll that allows you to roll from any rotation you just need to lerp from your current rotation to current + or - 360 using a timeline, timer, or tick. below i show a method to do this. the first part of the script is just a little flow control so that the player cant do a constant roll, modify this as you like (maybe use a can roll variable). the next part saves the current roll rotation to a variable so we have a static position to work from later, this keeps the script from creating exponential acceleration due to shrinkage. next in this case i used a timeline to control the lerp alpha basically the change over time. the trickiest part for most people is next, this is where we control the positions for the lerp rotation. for the roll axis we want to go from set point to set point hence the variable, in this case we want to go from the current roll to a value + 360, this could be a value over 360 if needed. for the other axis we want to use the current rotation of the character or pawn so that we dont get weird jumping around. for this we just use the get actor rotation so it sets those to the current value each update. the last thing to do is to actually set the actors rotation.

note that the engine doesnt care if a rotation value is above 360 or below 0 it will work in either case. -90 is the same as 270 but it just gives the roll direction.

alt text

capture.png (395.4 kB)
more ▼

answered Sep 08 '18 at 12:57 AM

avatar image

10.1k 33 10 25

avatar image G1K777 Sep 08 '18 at 08:43 AM

How did you set the timeline? 0-1 or 0-360 ?

avatar image G1K777 Sep 08 '18 at 08:58 AM

It work, it spins my whole plane but, the problem is that the whole view spins. I was looking only to spin the plane. It also don't work when i get my mesh and then "SetRelativeRotation" nor it works with "SetWorldRotation".

avatar image ThompsonN13 Sep 08 '18 at 01:33 PM

the timeline is a 0-1 float value.

as for your camera spinning that could be many settings but the first thing to look at would be what is your camera parented to? if its parented to the mesh then you may need to add in a layer between what comes before the mesh and the mesh itself, basically add a scene component that you camera is parented to and your mesh is parented to. the result is that your camera and mesh are on the same level so to speak. this all may be a moot point after the next section.

now for moving just the mesh instead of the whole actor you need to be working in relative space so that all the movement is in the local space of the actor. if you were to use world space in this case then you would get weird results where the plane would roll forward or at weird angles depending on your world direction. back to what to do though, basically you need to do the same thing but eliminate a few parts like the variable at the start and the adding the variable to 360. instead we need to get the mesh, get the meshes relative rotation, and use that for the lerp pitch and yaw. for the roll we will use the values 0 and 360 (remember this is all relative space so its 0 degrees different from the actors rotation so theres no snapping to worry about).

also note ive been doing all this in the third person character from the template since i dont have your exact setup for cameras and things results may vary.

alt text

capture.png (270.5 kB)
avatar image G1K777 Sep 08 '18 at 03:00 PM

I have it like this

alt text

untitled.png (8.3 kB)
avatar image ThompsonN13 Sep 08 '18 at 03:05 PM

im assuming that the plane pawn shown in your picture is just a dummy mesh it doesnt actually have anything it renders right. if thats the case you should be good by just targeting the planemesh. though i dont know how it will react with your current movement system though thats a bit outside the scope of the original question.

avatar image G1K777 Sep 08 '18 at 07:06 PM

It's like this from the start, this is also why the plane moves like it moves :)

avatar image G1K777 Sep 08 '18 at 09:48 PM

Fixed it by letting the plane roll in the direction where the mouse is.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

This is really all you need to do for a basic system. The timeline length determines how much roll is added each time the player wants to "roll".

alt text

roll-plane.jpg (68.5 kB)
more ▼

answered Sep 05 '18 at 07:31 PM

avatar image

Nebula Games Inc
5.4k 28 9 15

avatar image Nebula Games Inc Sep 05 '18 at 07:32 PM

If you want to more easily specify the roll amount you could make a variable and have it increment each tick of the timeline and when it reaches a certain point stop the timeline.

avatar image G1K777 Sep 06 '18 at 05:01 AM

Yeah i thought of that and i was doing this, but i'm not sure if this wont get too heavy when the game becomes multiplayer.

avatar image Nebula Games Inc Sep 06 '18 at 05:29 AM

This isn't very performance heavy. It's a simple timeline that does a very basic thing with negligible calculations

avatar image G1K777 Sep 06 '18 at 09:05 AM

I wanted to add a value of 360 over a specific time to the "roll" variable. So it would make a 360 :D Then check with boolean if it's 0. I would have 2 local variables inside a function and then 360*delta seconds and add it to the roll. Then after adding adding the same value to another variable that will go from 0->360 and when it hits 360 it will stop adding to the roll.

avatar image G1K777 Sep 06 '18 at 10:55 AM

It doesn't work with adding 360.. nothing happens i don't understand this lol. alt text

lol.jpg (449.3 kB)
avatar image G1K777 Sep 06 '18 at 05:26 PM

I tried it with timeline but it doesn't work like i would like. I need to add a value to the current rotation so the "starting" and the "ending" will be the same and not just a 0-360 rotation... for example starting from 70 + 360 ending at 70. I did a timeline with 0 -> 1 and then outside the timeline i did it * 360 = made a roll but the plane was buggy and when it had some angle it like snap to horizontal at the start and end.

avatar image Nebula Games Inc Sep 06 '18 at 05:39 PM

The timeline was just supposed to determine how long it takes to complete the rotation, whatever values you LERP between determine how much roll is added. Kind of confused by what you're trying to achieve to be honest. Anytime you add 360 degrees to the current rotation you end up exactly at the same spot. So I'm not sure what you mean by "start at 70 add 360 ending at 70" you can't end in any other position

avatar image G1K777 Sep 06 '18 at 09:44 PM

I'm also confused why you don't understand such simple thing. You think i'm that stupid to do "CurrentRotation + 360"? You can be sure that this is done over a set time. It just doesn't go from 0 - > 360 in 1ms. Because how you said, this wouldn't make sense. You should also think that intelligent people don't start developing games. It's now almost midnight for me, i can upload a video later and my "simple roll" is more advanced and brain wrecking than you think.

avatar image Nebula Games Inc Sep 06 '18 at 10:01 PM

I apologize if I offended you in any way. I did not call you stupid, I made no mention of your intelligence and I did not expect an instantaneous "roll". I assumed you did it over time and I was just trying to say it's a moot point to say you want to end at the same spot you started if you do any rotation for 360 degrees. Expressing my confusion is not an assault on your intelligence and I never called what you're doing a "simple" roll. In fact I just provided an answer to your question and stated that my solution was a "basic" system. The only time I used the word "simple" was to describe the complexity of the timeline I used. You do understand I'm trying to help you and giving you my time for free. Why you are getting upset over this is beyond me. That being said, I will stop trying to offer solutions. Perhaps someone else will be better at understanding you than I.

avatar image G1K777 Sep 07 '18 at 04:12 PM

I see, sorry. I guess you don't know what game i'm creating :p You can use 360 for skills, functions or to dodge projectiles. There are many uses of 360 :) I will show you where my problem is.

I use the T(esting) button for testing. So if you see "T clicked" it means that i make the plane roll.

Look here. I turn right, it sets the old roll variable, then it makes the roll adding 360 to the current roll over time, after reaching 360 it sets the old roll variable as current roll = works like i want it to work. No bugs etc (but there is missing one thing, will tell it later).


Now the same thing when i turn left. It makes this "snap" and instead of setting it to -50 (or what ever the old roll value was) it goes from 0 -> (old value) instead setting it directly to this value.


The other thing is when i turn right and press T and then before the roll ends i turn left so the roll value becomes "negative" it also snaps. It snaps only going from right to left. but NOT from left to right. https://youtu.be/ohfhPOTcoDU

Goal: If i fly left or right the fade should be like this: https://youtu.be/tX9ZMl4ybwQ Yes i will later make also a left/right direction roll. But the idea is, when someone rolls right and then moves left, it should not snap like this. It should be smooth like the link above i showed you going from left to right. Just smooth.

I just thinking. Should i maybe and the rotation always at a horizontal position aka (0) and then add a Finterpt to from 0 -> old roll value ? It should look always "smoooooth". I guess. Doesn't sound bad but i guess it wouldn't fix that "snaping" when switching sides/directions left/right while rolling?

avatar image ksensenmann Sep 06 '18 at 09:54 PM

xD xoxoxoxo

avatar image G1K777 Sep 07 '18 at 04:14 PM

Es ist hier kein Kindergarten. Wenn du was beitragen möchtest dann mach dies, aber solche "XD xoxoxo" sind nicht nötig. MfG.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

hey, ich würd sagen dass es schwer ist das hier nachzuvollziehen. Es hat mir am meisten geholfen, sich weiter daran anzustrengen, da es meist bei mehreren Funktionen oft um ein Flüchtigkeitsfehler handelt. So kriegst du die Lösung bestimmt eher raus :)

more ▼

answered Sep 07 '18 at 11:00 PM

avatar image

26 5 6 8

avatar image G1K777 Sep 08 '18 at 08:39 AM

Ach ne, aber finde diesen Fehler und mache es evtl effizienter als was Ich mache.

(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