Joystick Character relation

Player_EPlayer_E Member, PRO Posts: 604
edited November -1 in Working with GS (Mac)
I went through the how to's section and made myself a joystick control for my character.

i am using one joystick that moves my character and changes the way he is facing.
one thing that it does not specify is this, when I let go of the joy stick my character faces to the right.

Is there a way to make it so your character will continue facing the direction he was facing once you let go of the joystick or will they alway snap back to the right?

Comments

  • TboneTbone Member Posts: 49
    HI,

    Im doing the same thing at the moment. I've used a rule that checks if the joystick has been let go and then changes the rotation to the correct angle. Also I offseft my vectorTo Angle by 90 degrees too.

    My problem is that I want to constrict the range of motion from the joystick to 180 degrees ie I don't want my actor to face backwards.
  • synthesissynthesis Member Posts: 1,693
    Constrain the actor's self.rotation to whatever "driveAngle" the joystick is feeding to the game. However...only constrain when the "joystickIsGrabbed". Use a boolean attribute to track when the joystick is touched. True when pressed...False when released.

    If you leave the constrain in place the entire time...then when the joystick snaps to center...it register a ZERO angle which makes the character always point right (0 degrees).

    Then when joystickIsGrabbed=True...constrain the angle...otherwise CHANGE the angle when the value = False. This will force the character to remain in its current direction at release of the joystick until it is touched again.

    When using the boolean switch, use a delayed release (which I did in mine...I used a .25 second timer delay on release before snapping back to center on the joystick). This will allow the FALSE value to register to the character...allow the character to freeze its direction...and give a slight pause before snapping back to a center position...which makes the stick "feel" better in gameplay in case the player's thumb drifts off temporarily. It also makes the joystick a tad more forgiving to the player and the character actor will remain pointed at the angle of release.

    At least that is how I did it in mine (Bumper Derby X-Treme) and it works fairly well.
Sign In or Register to comment.