M
Mooshim
Guest
Right now I am creating a body with collisions for the player (like so):
And for movement I am using
Though this causes several problems such as the player rocking (as it is registered as a block) and bouncing when they jump/fall.
I was wondering if there was a different function I could use to create the player, or if there is a way I can change the settings of the body/collision to stop it from rocking and bouncing the way it does.
Thanks!
col = GmnCreateBox(global.set,1,1,10,0,0,5);
pl = GmnCreateBody(global.set,col);
GmnReleaseCollision(global.set,col);
GmnBodySetAutoMassMatrix(pl,2,false);
GmnBodySetPosition(pl,x,y,z);
pl = GmnCreateBody(global.set,col);
GmnReleaseCollision(global.set,col);
GmnBodySetAutoMassMatrix(pl,2,false);
GmnBodySetPosition(pl,x,y,z);
And for movement I am using
xv = 0;
yv = 0;
if player_forward {
xv += cos(degtorad(direction));
yv -= sin(degtorad(direction));
}
if player_left {
xv += cos(degtorad(direction+90));
yv -= sin(degtorad(direction+90));
}
if player_backward {
xv -= cos(degtorad(direction));
yv += sin(degtorad(direction));
}
if player_right {
xv += cos(degtorad(direction-90));
yv -= sin(degtorad(direction-90));
}
GmnBodySetVelocity(pl,xv*15,yv*15,GmnBodyGetVelocity(pl,2))
yv = 0;
if player_forward {
xv += cos(degtorad(direction));
yv -= sin(degtorad(direction));
}
if player_left {
xv += cos(degtorad(direction+90));
yv -= sin(degtorad(direction+90));
}
if player_backward {
xv -= cos(degtorad(direction));
yv += sin(degtorad(direction));
}
if player_right {
xv += cos(degtorad(direction-90));
yv -= sin(degtorad(direction-90));
}
GmnBodySetVelocity(pl,xv*15,yv*15,GmnBodyGetVelocity(pl,2))
Though this causes several problems such as the player rocking (as it is registered as a block) and bouncing when they jump/fall.
I was wondering if there was a different function I could use to create the player, or if there is a way I can change the settings of the body/collision to stop it from rocking and bouncing the way it does.
Thanks!