• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

3D Player collision in GMNewton

M

Mooshim

Guest
Right now I am creating a body with collisions for the player (like so):
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);

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))

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!
 
M

Mooshim

Guest
(I couldn't find a rule against bumping - Sorry if this is breaking any)
 
Top