Steve_Yorkshire Posted April 16, 2018 Share Posted April 16, 2018 Okeedokee, here's a funny little thing I found. If you exit a level whilst still having the gamepad stick in movement, the input locks and is remembered when you start a new mission the movement input restarts.How to test in default Torque:1) Have a gamepad (durrrr)2) Load a mission and start moving. 3) Keep pressure on the thumbstick and exit using the Back button on gamepad, or Esc/select quit/yes with mouse (keep that thumbstick in move position)4) At Main Menu release gamepad5) Start new mission6) See player start moving from leftover inputSolution:in scripts/client/default.bind.cs, add this new function (anywhere is fine)//to stop movement being left over, after death or end of mission function gamePadEnd() { $mvYawLeftSpeed = 0; $mvYawRightSpeed = 0; $mvPitchUpSpeed = 0; $mvPitchDownSpeed = 0; $mvRightAction = 0; $mvLeftAction = 0; $mvForwardAction = 0; $mvBackwardAction = 0; } In scripts/server/gameCore.cs, add this at the bottom of onMissionEndedfunction GameCore::onMissionEnded(%game) { //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::onMissionEnded"); // Called by endMission(), right before the mission is destroyed // Normally the game should be ended first before the next // mission is loaded, this is here in case loadMission has been // called directly. The mission will be ended if the server // is destroyed, so we only need to cleanup here. physicsStopSimulation("server"); %game.endGame(); cancel($Game::Schedule); $Game::Running = false; $Game::Cycling = false; //new from here echo("c\4End any left over gamepad input"); gamePadEnd();//in default.bind.cs } You could probably also include a var to see if there is a gamepad connected or even cycle through gamepad inputs to see if any are still active, but this works fine. Quote Link to comment Share on other sites More sharing options...
JeffR Posted April 18, 2018 Share Posted April 18, 2018 Not a bad workaround :)Still, feels like a bug in the input in general if we consider that the other keybinds don't have a similar sticking effect. Something we'll have to double-check on.I know with the SDL stuff the core input handling is different(and we're still reviewing the gamepad side) so that may well be a non-issue when we get it all wrapped up, but this is definitely useful for people still rocking the windows platform layer. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.