Character Movement, collisions

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Character Movement, collisions

Postby Spek » Sun Jun 07, 2009 2:16 pm

Hi,

Howto implement character movement/collision detection? I tried using an elipsoid like one of the demo's did. It works, although stair climbing still feels like pushing 400 kg forward. Is there a simple trick to improve this?

However, my real problem is collision detection with bullets or applying ragdolls. Elipsoids can be used for moving around and detecting collisions. But when raycasting bullets or letting an object die/launch, its detailed collision hull(s) should be used instead of the elipsoid. Is there any way to switch between these 2 hulls quickly? Or is it possible to connect a body on 2 collisions?


BTW, are there more advanced character movement demo's, including source?

Greetings,
Rick
Spek
 
Posts: 66
Joined: Sat Oct 04, 2008 8:54 am

Re: Character Movement, collisions

Postby Spek » Sun Jun 14, 2009 3:25 pm

Allright, I improved the character controller myself a bit. I use an elipsoid like the Newton demo does. When hitting stairsteps (detected via contact callback) it will lift himself by adding an upward force for a short while.

Now the movement itself is still... like driving a truck. I set (not add) force while walking:
Code: Select all
...Force/Torque callback
if (moving)
   NewtonBodySetForce( body, moveDirection * speed );

... Contact Processing
if (moving)
{
    NewtonMaterialSetContactFrictionState( material, 0,0 ); // disable friction
    NewtonMaterialSetContactFrictionState( material, 0,1 );
} else

    // High friction
    NewtonMaterialSetContactFrictionState( material, 1, 0 ); // enable
    NewtonMaterialSetContactFrictionState( material, 1, 1 ); // enable

    NewtonMaterialSetContactStaticFrictionCoef(   material, 2, 0);
    NewtonMaterialSetContactKineticFrictionCoef(  material, 2, 0);
    NewtonMaterialSetContactStaticFrictionCoef(   material, 2, 1);
    NewtonMaterialSetContactKineticFrictionCoef(  material, 2, 1);
}


While moving the friction is 0, otherwise 2. It helps, but it still takes a while before the player is accelerated to his maximum speed, and worse, it also takes a while before the player has stopped moving. When I release the move button it should (almost) directly stop, but it doesn't. Because of that, steering while walking gets very difficult.

Another thing I noticed is that the body elipsoid keeps rotating after hitting something. I stop the rotation by setting omega on zero each frame, but I guess this is not normal behavior... When the body rotates it gets even more difficult to steer the player. He walks as if he was drunk :)


BTW, any idea when Newton 2 gets an official release or at least Delphi headers? I heard it has quite some improvements, including with terrains. But I can't use it for my Delphi program for now.
Spek
 
Posts: 66
Joined: Sat Oct 04, 2008 8:54 am

Re: Character Movement, collisions

Postby JernejL » Sun Jun 14, 2009 3:31 pm

Delphi headers (2.0 aswell, see the last post):
viewtopic.php?p=36179#p36179

Newton 2.0 (2.01 currently) beta:
viewtopic.php?f=9&t=4922&start=0
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Character Movement, collisions

Postby Spek » Sun Jun 14, 2009 6:42 pm

Nice! Is it smart to start switching over to Newton 2 already, or is it still in an early test state? It's just a hobby project I'm doing, but nevertheless... Anyway, is there also a demo about the new character control functions?
Spek
 
Posts: 66
Joined: Sat Oct 04, 2008 8:54 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron