Actor facing direction equivalent to gamepad analogue stick

Have any questions or problems in making your game, subscribing and/or using our software? Post here.
Forum rules
Make sure you are using the newest version. This can be downloaded at the top of the site via the "downloads" link.

Use a very good subject. "Problem" or "Help" are unacceptable titles.

Use the search feature before posting a question, as the answer is probably already here.

Subscript out of range error 9: This is a generic error, and we'll need way more information than that to figure out the problem. If you get this, strongly consider following the instructions of submitting your project through the Submit Bug feature within the editor.
User avatar
JimmySterylian
001 Fanatic
 
Joined: Tue Jul 29, 2014 2:28 pm
Location:  ­ 

Actor facing direction equivalent to gamepad analogue stick

Postby JimmySterylian » Sun Sep 25, 2016 1:01 pm

I'm not 100% sure if requesting a math formula fits the Resource Disussion so if you think it's wrong please move it.
Now, my math skills are quite high, almost close to calculus level, but most of the time I can only solve given problems, not figure out which formula I have to use where(I hope you can understand what I'm implying).

So, what I'm trying to do is make the player face a direction according to a gamepad's analogue stick rotation(e.g. If I push the analogue stick to 9 o' clock, the player has to face left, rotation Z of 2,8 to be more specific).

Here's the difficult part, 001 has 2 use values for each analogue stick, X and Y.
The X value changes on horizontal stick push, it has a positive value to the right side(ranging from -1 to 0,9)
The Y value changes on vertical stick push and has a positive value when stick is pushed below the center.(ranging from -1 to 0,9)

Here's a video demonstrating these values(RX is for X value and RY is for Y value, the value below them shows the player's rotation on the Z axis).



This is going to be the base script:


The tricky math that needs to be done is on the direction of the Rotation Z event(the website for some reason interperts it as Change Facing Angle Direction but whatever).

As a side note, I know that every controller's different but for now stick with how the Xbox 360 one works.
Image

User avatar
Mr.Numbers
001 Support
 
Joined: Wed Feb 28, 2007 1:50 am
Location: Alberta, Canada

Re: Actor facing direction equivalent to gamepad analogue st

Postby Mr.Numbers » Mon Sep 26, 2016 2:53 am

Moved topic to technical support as it is definitely a technical support question :P

This might work:
Last edited by Mr.Numbers on Mon Sep 26, 2016 2:53 am, edited 1 time in total.
Reason: Automatically merged double post.
Image
I AM THE ALL MIGHTY SCRIPTING MASTER
Please do not PM me with Engine 001 related questions, rather post on the forums. ;)

dragonnutds
001 Subscriber
 
Joined: Tue Oct 27, 2009 2:06 pm

Re: Actor facing direction equivalent to gamepad analogue st

Postby dragonnutds » Tue Sep 27, 2016 1:17 am

er, not sure what you are trying to do,

if you want to make a actor face the same direction you push on a analog stick just set up your actor to face direction using the use value "direction" under "geometry. have the source x/y be 0 and the destination be the joystick.

i would also set up a deadzone using comparison branches.
Image

User avatar
JimmySterylian
001 Fanatic
 
Joined: Tue Jul 29, 2014 2:28 pm
Location:  ­ 

Re: Actor facing direction equivalent to gamepad analogue st

Postby JimmySterylian » Tue Sep 27, 2016 12:22 pm

Thanks a lot Numbers, that works perfectly :D Again, my problem just required a use of proper tools, nothing too complicated, so thanks for making realize geometry fuctions power and their existence too :-P
Image


Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users

cron