Jump to content

[Solved] Stop at once :)


Roland
 Share

Recommended Posts

Hi .. a simple question.

 

I have my character driven by a TContoller. Everything works as it should but there is one thing that I cant seem to fix. When stopping after have been walking (the move parameter to UpdateController is set to 0), my character does not stop at once, but continues sliding forward a little bit like she walks on ice.

 

 

// _height = 1.7
// _modelPos is the postion of my character model

TController _controller = CreateController( _height );
PositionEntity(_controller, modelPos );
SetBodyMass(_controller, 60);
SetBodyGravityMode(_controller, 1 );

 


// _walker.GetWalkSpeed() gives a speed factor
// _jumpHeight is a scale factor
// _rotY is amount of rotation around Y

float move = static_cast<float>(KeyDown( BackKey ) - KeyDown( ForwardKey )) * _walker.GetWalkSpeed();
float strafe = static_cast<float>(KeyDown( RightKey ) - KeyDown( LeftKey ));
float jump = static_cast<float>(KeyHit(JumpKey))*_jumpHeight;
UpdateController( _controller,
 _rotY*timeFactor,
 move*timeFactor,  // contiues to move a bit event with move=0
 strafe,
 jump,
5,
  10,
0 );

RotateEntity( _model, EntityRotation(_controller ) );
PositionEntity( _model, EntityPosition(_controller) );

 

I have tested with various body parameters like increasing the friction, but with no effect.

 

Any idea?

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...