0 Favourites

Right Stick Axis Aiming

  • So I want to shoot a bullet in the direction of the right analog stick. This is what I have so far:

    Every Tick

    Set angle of 'Arm' toward X Gamepad.Axis(0,3) , Y -Gamepad.Axis(0.3)

    I then have if axis is < 0 , Mirror 'Arm'

    This sort of works, but not very well, the 'arm' glitches at the 0, 90, 180 and 270 angles.

    Has anyone got a more elegant way of doing this?

    Best,

    Mick

  • i think this example will help you : scirra.com/forum/topic57777.html

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • i think this example will help you : scirra.com/forum/topic57777.html

    Thanks I've looked at that but didn't get anything out of it really, I couldn't see how to transfer the touch mechanics to the gamepad object as the gamepad works with + and - rather than actual 360 degree axis.

  • Just going to bump this as I'm still totally stumped. I still can't get the right analog stick to aim properly like in a twin stick shooter.

  • I had a similar issue where it would kind of lock at 0, 90, 180, and 270 degrees. If that's the case then you just need to set the Analogue deadzone to 0 (click on gamepad in the projects window, and it should be there under gamepad properties). If that isn't the issue than I'm afraid I can't help..

    Cheers

  • CrudeMik could you send a stripped down version of capx that just focuses on the part you want working. I wouldn't mind trying to give this a shot. I want to make my game on the Ouya eventually and might come across a similar problem.

    Also if you need to figure out 360 degree in C2

    to 360: if(angle < 0) angle =+ 180

    to C2: angle =- 180

  • For me I have not found the right analog stick's index. 2 and 3 are the trigger buttons, i started going up from there but didn't get a response so I stopped. Not sure if it's my controller (xbox360 wireless).

    As for your original question (if you are still looking for an answer), Since the center of the stick is 0,0...

    I was going to try getting the angle like this:

    angle(0,0, Gamepad.Axis(0, 2), (Gamepad.Axis(0, 3))

    also, i was going to trigger it with an "OR" block. So that it would only calculate it when the user was moving the stick beyond the dead zone. I had put in a custom dead zone for both axi. (rightAnalogDeadX) and (rightAnalogDeadY).

    Condition:

    if right analog y axis is greater than "rightAnalogDeadY"

    or

    if right analog y axis is less than "-rightAnalogDeadY" (negative)

    or

    if right analog x axis is greater than "rightAnalogDeadX"

    or

    if right analog x axis is less than "-rightAnalogDeadX" (negative)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)