Page 1 of 1

Physical response problem

PostPosted: Mon Dec 05, 2011 4:55 pm
by BogdansB
hey,
I was making a game where a player and a wall is. i made a physical response to them with no bouncing.
when th eplayer jumps (left) on the walls side, he stays on the side without moving, when you press "left" . when you stop to press he falls.

how can i change it so, that he doesn't stuck on the side and just slides down.

Re: Physical response problem

PostPosted: Mon Dec 05, 2011 5:08 pm
by jimmynewguy
Use this basic method made be pyro for collsions, it's simple and works pretty well. Use velocities for movement instead of just moving the coordinates (ie. no x+=1; or x = x +1;)
Collision->top side->ground->with repeat yes
Code: Select all
double mem = xvelocity;\\holds the current xvelocity
if(yvelocity >= 0)//if your falling
{
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000,1.000000, 0.000000, 1.000000);
xvelocity = mem;//reset the xvelocity so you don't glitch up
jump=1;//reset jump variable
}

Collision->bottom side->ground->with repeat yes
Code: Select all
double mem = xvelocity;
if(yvelocity < 0)//check if moving up
{
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000,1.000000, 0.000000, 1.000000);
xvelocity = mem;
}

Collision->left or right side->ground->with repeat yes
Code: Select all
double mem = yvelocity;
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000,1.000000, 0.000000, 1.000000);
yvelocity = mem;

Re: Physical response problem

PostPosted: Mon Dec 05, 2011 6:55 pm
by BogdansB
thank you very much, it works :D