Zero Velocity = No Input

Masx

21-05-2008 18:28:29

I'm creating a racing game at the moment and using an xbox control pad with OIS for the input to the game, and the vehicle prefabs for movement.

The shoulder analogue buttons are used for the acceleration/brake input


if( mJoy ) LeftAxisValue = mJoy->getJoyStickState().mAxes[LEFT_THUMB_LR_AXIS].abs;
if( mJoy ) RightAxisValue = mJoy->getJoyStickState().mAxes[SHOULDER_ANALOGUE].abs;

if( mJoy ) LeftAxisValue = (LeftAxisValue / 32768);
if( mJoy ) RightAxisValue = (RightAxisValue / 32640);

if( mJoy ) goKart->setInputs(LeftAxisValue,RightAxisValue);


now this works fine no problem at all... until the velocity of the goKart (ODE prefab vehicle) reaches exactly 0. the inputs begin to have no effect on the vehicle, even though i can see the axis values of the inputs changing on screen.
if i use the keyboard input instead, and the vehicle reaches 0 velocity, upon pressing the acceleration key it moves.

so why does the controller have no effect on the vehicles input, only when, the velocity reaches 0?

rewb0rn

23-05-2008 10:31:18

as it works when you use the keyboard this has barely to do with ogreode... compare your keyboard function to your joystick function i am sure that will help.

eugen

28-05-2008 00:22:35

well , when u have sleep params set for a body and u apply a force when it is sleeping then it wont react, u need to call wake and then apply the force (weird since is working with the keys but not joystick)

Masx

28-05-2008 19:38:50

Yep, the autosleep call was causing my problem,

fixed, thanks for help.