This project has moved and is read-only. For the latest updates, please go here.

Couple of problems with platform game

Sep 13, 2011 at 11:10 AM
Edited Sep 13, 2011 at 11:11 AM

Hi guys, im currently running into 3 problems with a platformer game im making.

1) I've created vertical moving platforms with dynamic bodies and fixed prismatic joints which works great, however if i make 2 directly next to each other, they sometimes get stuck on each other and either stop working or go out of time etc etc. I've tried messing about with their collision groups but it doesn't seem to be doing anything.

2) Another problem with the vertical platforms is that the weight of the player jumping onto the platform moves it down a tiny bit. I've tried messing about with the mass of both platforms and player and any other variables i thought might be the cause but nothing is working.

3) The player (made up of the usual ball and rectangle) has the ability to crouch which is done by removing the rectangle shape and replacing it with a square (the opposite happening when they stop crouching).


if (crouched && !lastCrouched)
        rj.LocalAnchorA = new Vector2(0, 0.48f);
        moveSpeed = crouchSpeed;


In the game i have a low roof that you're meant to crouch under however if the player has touched the wall with the big rectangle before hand, it still seems to think that the body is a rectangle rather than square... Hard to explain, hopefully the pictures will explain better.

Crouch working:

Contact made as rectangle:

Crouch not working:

I was looking for a way to clear the ContactList, but it seems to be get only.


Hopefully they're just simple problems that im over looking, but any help would be appreciated.

Sep 17, 2011 at 5:39 PM

Shameful bump.

Sep 17, 2011 at 6:30 PM

1) do something like platform.CollisionsGroup = 10; and platform.CollidesWith= 1;

2) use kinematic instead of dynamic

3) 403 error on all of the pics

Sep 18, 2011 at 5:14 PM
Edited Sep 18, 2011 at 5:18 PM

Opps didnt realise those links would break.

Crouch working

Contact made

Crouch not working

Not had a chance to try your other suggestions, but will do tomorrow. Ta!

Sep 19, 2011 at 9:47 AM

don't remove the rectangle / square every time. just deactivate him if you don't need him. also it looks like the square is just a little bit too tall

also make sure the big rectangle doesn't get stuck if he stops crouching

Sep 19, 2011 at 10:08 AM
Edited Sep 19, 2011 at 11:07 AM

The square is the right size to fit under it (as shown in the crouch working picture). I wasn't sure on the best way to make it swap fixture shapes, thats why i made it remove the rectangle and add the square when crouching. Is there a better way?

Regards to not making him stuck, i make it doe a raycast before uncrouching to make sure theres room so thats not a problem.


I've just tried setting the moving platform to kinematic, which fixes the problem of the player weight moving it, but it breaks them altogether due to joints only working on dynamic bodies. Does that mean i'd have to make the program calculate the platforms new position and set it every update? Theres no other way of making a dynamic body not be affected by the player?

Sep 21, 2011 at 5:39 PM

i don't know but you can try debuging the angle of the square and if its not 0f , set it to 0f


and i think you have to set the position of the kinematic body yourself (never really worked with kinematic)