Problems with CollisionResponseAnimator and movement

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Aerinai
Posts: 5
Joined: Wed Nov 22, 2006 8:50 pm

Problems with CollisionResponseAnimator and movement

Post by Aerinai »

What I am trying to do is run a character from point A to point B along a sloped mesh. The collision response animator does its job and checks collision when the model is stationary. When I move my model, it 'floats' slowly down. So running up the slope, no big deal. Running down the mesh is floating. The game logic is as follows:

vector Hero;
vector position = model->getPosition //this gets the current position of model
if(moveLeft)
position.X -=1;
if(moveRight)
position.X +=1;
Hero = Position;
model->setPosition(Hero);

Why is my model Floating???
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Possibly your gravity isn't strong enough? Try increasing it in the animator.
Image Image Image
Aerinai
Posts: 5
Joined: Wed Nov 22, 2006 8:50 pm

Post by Aerinai »

Gravity isn't the problem. If the model isn't running it falls too fast for 'true' gravity. So I don't want to fudge that factor to make the other part work.
jun
Posts: 12
Joined: Thu Dec 07, 2006 5:00 pm

Post by jun »

the last value in CreateCollisionResponseAnimator() is the slide factor. Maybe that's it. Might help if you post your call to that function.
bgsteffens
Posts: 39
Joined: Wed Oct 04, 2006 8:00 am

Post by bgsteffens »

Do you mean that as you run uphill everything works fine and the hero stays on the ground and climbs but when you go downhill he stays at the same Y value so he just sort of walks into the air?

If so, here's a -very- quick somewhat-fix that you could mess with. Somewhere in your main game loop put:

Code: Select all

vector3df position = model->getPosition();
position.Y -= 2;
model->setPosition(position);
He'll always fall until he hits the ground, at which point the collision detection will take over and hold him there. Of course this is pretty messy logic, but maybe you could work with it :P And of course, if you're standing still on a steep slope he'll slowly slide down, but that effect may be desirable.
Post Reply