Gamepad Axis Deadzone

Get help using Construct 2

Post » Thu Aug 15, 2013 9:23 pm

I'm using the gamepad axis to aim (based on angle(0, 0, Gamepad.Axis(0, 0), Gamepad.Axis(0, 1)). However, when the stick is returned to the middle, the axis is set to 0 instead of leaving it at the previous axis. Is there a way to stop this from happening?
B
42
S
12
G
1
Posts: 544
Reputation: 4,219

Post » Fri Aug 16, 2013 4:49 am

I'm beginning to think this is impossible utilizing the gamepad object - there has to be a way to outsmart the plug-in into sending the angle and keeping said angle before hitting the deadzone.

I've tried creating a global variable and setting so if the gamepad x & y axis are > 25 (deadzone), set global variable to angle(gamepadaxis). Then then another event that states if the x & y axis are < 25, set angle(gamepadaxis) to global variable. But, of course, to no avail.

Anyone have any out-of-the-box suggestions?
B
42
S
12
G
1
Posts: 544
Reputation: 4,219

Post » Sat Sep 14, 2013 11:27 pm

I've been trying to figure this out as well, haven't come up with anything.
B
12
S
1
G
1
Posts: 10
Reputation: 1,075

Post » Sun Sep 15, 2013 12:13 am

Haha, actually I figured it out like 10 minutes after I posted that... Just had one thing wrong. We were both trying similar approaches.

If the angle of the Gamepad analog axis is outside the deadzone, store that angle in a variable on the object. Every Tick, rotate the object toward that variable, instead of the active angle. This way the variable will only be stored if its outside the dead zone, and not return to zero.

I'm sure there's a more optimized solution, but this is working at the moment.
B
12
S
1
G
1
Posts: 10
Reputation: 1,075

Post » Sun Sep 15, 2013 8:13 am

Click the Gamepad Object on the object list, and on the properties window there's an option for setting the deadzone! IIRC the default is 30.
B
125
S
43
G
41
Posts: 849
Reputation: 28,260


Return to How do I....?

Who is online

Users browsing this forum: danalog, dop2000 and 22 guests