playMaker

Author Topic: Twin stick rotation [SOLVED]  (Read 956 times)

agito1987

  • Playmaker Newbie
  • *
  • Posts: 37
    • View Profile
Twin stick rotation [SOLVED]
« on: May 31, 2018, 11:10:45 AM »
Hey

I was trying to set up the twin-stick control system.
I get the axes values from -1 to 1 for both my vertical and horizontal axis.

I couldn't figure out how to convert these 2 values into a 360-degree rotation value.
so I made a target object that I move with set position, using the 2 float values.
Now I use a smooth look at, referring to this target object to have a smooth and nice looking rotation of my player object.

The problem:
The player returns to the start position once you release the stick and the values return to 0.0.0.
I can't figure out how to bypass this problem with my setup.

My question now is, is there a way to work around this issue with my setup?
Or do I need to set this up differently?

I saw a couple of other posts about this problem, but to be honest I don't quite understand them.
« Last Edit: June 06, 2018, 03:01:29 AM by agito1987 »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 5105
    • View Profile
    • jinxtergames
Re: Twin stick rotation
« Reply #1 on: June 01, 2018, 03:09:23 PM »
Hi.
I found an action on the Ecosystem called "Get Axis Vector Extended"

The action gets the magnitude and angle.
But it had the same issue when axis's are both to 0

So i tried getting the magnitude and a float compare, that worked (kinda)
but when i released the controller stick fast then i did not work most of the time.

So then i looked in the action script and i added an option to check or not to check the action if axis are 0.

It is default set to true so that the action still works the same as before.

in your case you will need to set it to false (un-check)

Let me know if it worked :)

agito1987

  • Playmaker Newbie
  • *
  • Posts: 37
    • View Profile
Re: Twin stick rotation
« Reply #2 on: June 05, 2018, 03:16:24 AM »
Sorry for the late reply, I was away for a couple of days.

Ok, I tried the action from the ecosystem but doesn't work for me.
I use the unity plugin rewired for my controller setup.

I get the error "Input Axis not setup".
First I call 2 rewired actions to get the values of the axes.
Now I put them in the horizontal and vertical axis values of the "Get Axes Vector Extended"

From here the state doesn't advance because of the axis setup error.
rewired has set up more than 400 input items. so it is not really an option to search for the right axes info based on the controller type u use.

Or maybe I do something wrong?
Because when I feat the float value from rewired to axis extended it converts the value.

Oh, and thank you for you're time and help ^^



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 5105
    • View Profile
    • jinxtergames
Re: Twin stick rotation
« Reply #3 on: June 05, 2018, 08:18:17 AM »
Hi,
The Action will only work for the build in unity input.
I did not know you are using rewired :)

The Horizontal axis and Vertical Axis are string variables to get the name from the input where the action should get the value from the input manager from unity.

You are probably using playmaker 1.9 as you could place the values in the action.
which in this case, convert your float value into a string value and looks in the input manager for that string name.

But no worries
I made a custom version from the action which you can feed the float variables now :) so this could work with any 3rd party input control.

I won't place it yet on the ecosystem (i will to some more testing) but you can get it from the attachment below.
Let me know if it worked.

agito1987

  • Playmaker Newbie
  • *
  • Posts: 37
    • View Profile
Re: Twin stick rotation
« Reply #4 on: June 06, 2018, 03:00:41 AM »
You are my HERO!

This Works perfect!
It takes the angel from my float values and doesn't snap back to its start position.

Thank you very much for the help! ;D


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 5105
    • View Profile
    • jinxtergames
Re: Twin stick rotation [SOLVED]
« Reply #5 on: June 06, 2018, 03:43:10 AM »
Hi.
Happy to help :)