How to make InputAxis axis value go up to 360 degrees?

I’m having an issue when wanting to make my Gamepad’s left thumbstick be able to aim 360 degrees on a 2D shooter game of mine. My scripting is on the right track, but I noticed that my InputAxis axis value only goes up to 90 degrees and down to -90 when using ASIN(degrees). I want it to be able to go up to 180 and down to -180. Is it possible? Any advice is greatly appreciated.

In a word - ‘you can’t’

That’s two words, right?

The problem is, when using SetRotation nodes, it will automatically switch between 180 and -180 whenever the engine feels like it.

The way around the problem, is to use ‘AddLocalRotation’, which is often why you see this in pawn control code.

PS: It is possible to do this sort of thing, but only if you use quaternions.

The default movement for the player character uses it, and this is why… ( well, it uses AddControllerYaw, the point being it doesn’t use a Set node.

Quaternions:

or, if you don’t like plugins, there’s always C++.

How and where would I use a AddLocalRotation node? Wouldn’t that just make the weapon spin uncontrollably?

Also, what are quaternions?

Do you own the plugin Quaternions? If so, do you know which nodes would help me? I may purchase the plugin, but I don’t want to get it if I have no idea how it works.

I don’t have it, no.

I would definitely suggest being clear about how they work before getting it. All I know, is you don’t get this kind of problem with them.

In the meantime, it’s much easier to just add local rotation instead :wink:

If you can have only 90 degrees and you need 360 - multiply the Axis Float times 4 and you got your number

Could you provide an image on how to implement adding local rotation? When I try I can’t get it to not spin rapidly and I can’t figure out what to do. I’m relatively new to UE4.

Like this

346295-screenshot-1.jpg

346296-360.gif

I see where you’re going with this, but I want the rotation to point wherever the thumbstick is pointing to at all times, not continually rotate whichever direction. Got any help for that?

I don’t have a controller handy, but off the top of my head, something maybe like

Untested…

Basically did the exact same thing you showed me before haha. Rotated continuously. Didn’t matter where I pointed the thumbstick, it just changed from clockwise and counter-clockwise whichever side you pointed. Thanks for the effort though!

Yah, sorry… :-/