x

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 would I increase a value in relative to the rotation?

I'm just wondering how I would have say a float variable: currentRotation = 0 and increase it by 1 for every degree my character rotates to the right (in first person) and decrease it by 1 for every degree to the left? I done this in Gamemaker before to align the movement with the sprite but I can't figure it out in UE4. It's simple but I don't know if it can be done through blueprints.

I tried using the mouse axis that I added in the settings but that always gives weird values (ex: sometimes +1, other times +5, etc). Sadly I don't have any blueprints to show because I was just messing around with UE4.

Thank you.

Product Version: UE 4.11
Tags:
more ▼

asked Apr 30 '16 at 07:20 AM in Blueprint Scripting

avatar image

ArgenisXD
3 3 7 6

avatar image Nick Jackson May 01 '16 at 01:50 AM

What game play behavior are you trying to achieve? The answer to your question is use Get Relative Rotation and increment based on the value. But I suspect your real question is something else. Without knowing what game play behavior you're trying to achieve its hard to give you a better answer.

avatar image ArgenisXD May 01 '16 at 03:28 AM

I decided on making a bunnyhop game like in counter strike and so far everything works I just want to lose speed if I turn too much while in the air.

avatar image Nick Jackson May 01 '16 at 12:14 PM

I would probably not bother with that mechanic unless your jumps are exaggerated (zero gravity for example). Too much work for very little gain, you'll be hard pressed to notice a difference. If you are hellbent on pursuing that however, look at the CharacterMovement component on your characters.

There are two settings there: Air Control and Falling Lateral Friction. Take a snapshot of GetActorRotation on Jump event. Then on tick write code to compare that snapshot with actor's current rotation. If it differs more than by 10-20 degrees, you can lower progressively lower Air Control to 0 and increase Falling Lateral Friction upwards.

This would work in zero-gravity type simulations but I wouldn't try it in a normal game. When I played around with it - it just feels wrong.

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

2 answers: sort voted first

Hi man , i know unreal is not the most easy software on earth. some easy thing came out really complex sometime. I dont catch why you want to to this and how you want to procede once you char go 180° or make a full turn on the right. You can easily track the amount passed out from the mouseX, Y if you use them for the rotation of the char. Just make a variable and add the amount passed by those events (mouseXY). They work so , for every tick , the pass you the amount of movement of the mouse. If you dont move they pass you 0, you move slow, they pass you 0.2 , if you roll away the mouse 4 5. When you read the value you can have any number.

If is <0, you turned left. , if is < -180 you made at least 1 full turn on the left.

If is >0 you turned right, if is >+160 you made at least a full turn on right.

Its a bit Tricky...

Lets say that you can break the rotation of your actor anytime, and get a value from Z that go from -179 to 0 to +179. You cant count the full turn , but its usefull.

I often have to change back my project because i found that flipping all the problem upside down its more easy than solve some logic-problem. So dont be too obstinate , try also to avoid the walls on the way.

more ▼

answered Apr 30 '16 at 12:14 PM

avatar image

Est_engine
1.2k 58 12 62

avatar image ArgenisXD Apr 30 '16 at 08:32 PM

I have tried passing the mouseX and I can do a full 180 but it passes ~90. What im trying now is multiplying mouseX values by 2.

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

Hi man , here an example. as you can see i can say how much rotation was given to the actor reading the VAR_R. lets say a crazy thing, i have rotated a lot the actor and the value show 3333. I can divide the 333/360 and get 9.2... i have done 9 full turn on the right and 2/10 of another turn.

By the way reading for what you want to do . You can surely take a look at Nick Jackson post. I think you can also do this. Once you jump, save your vector in a variable (Start_Jump_vector). Now from there on, during the jump. Get the starting_Jump_vector and sutract it to your current vector. Then use the Lenght vector node , to the output. This will give you a float. that will be Greater as you turn away from the starting vector. Just use that to decrese what you want, and be sure to set every time the start jumping vector, to the current. You are Always working costantly . (tick_event)

alt text

turningvalue.jpg (164.7 kB)
more ▼

answered May 01 '16 at 01:00 PM

avatar image

Est_engine
1.2k 58 12 62

(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