GML Physics player gets glitchy around other Physics objects


I'm working on a platformer that makes use of GM's integrated physics. Despite my lack of experience with physics, I'm really happy with the result.
While most of the movement works really well, whenever the player is ontop of another physics object without unlimited mass, everything's a little glitchy. When I jump ontop of boxes sometimes the player just goes crazy and flies all over the place, so do the boxes from time to time. But even just moving on the boxes makes the player spaz out etc... Most of the time it's fine, but it just doesn't feel good.
Btw, the player is moved from left to right using it's phy_position_x variable, it only jumps / falls using an impulse and gravity.

As I'm really new to GM physics I still have hope that I'm missing something or doing something essential wrong, and it's not my whole movement system that's bad. Again, apart from interacting with moving objects the whole game is really smooth.

EDIT: The player seems to be glitchy even when just touching other physics entities, it doesn't have to be ontop, however movement is required.


predictably random
Forum Staff
Btw, the player is moved from left to right using it's phy_position_x variable (snip)
That approach can cause erratic behaviour -- especially when the move causes two fixtures to overlap slightly in a single step. When you move a fixtured object abruptly, rather than by applying a force or impulse, you can break the simulation.


If you use physics you should not modify manually the coords variables (phy_position_x/y). However, i found that you can actually modify the speed variables with no errors.


Thanks! I'm using phy_speed_x now and most of the issues are gone, just the ones with the jumping are left. However now I can tell what actually causes the problem. Whenever I jump while the player's rotation is not exactly 0, it flies off extremely fast in the direction it's tipping towards (speed increases the more the player is tipped). I want the player to tip a little bit though as that causes him to slowly fall when standing on an edge and stuff, so I don't want to fix it's rotation. Why exactly does this happen? I use physics_apply_impulse(), I thought the rotation only matters when using physics_apply_local_impulse(), or am I not seeing the actual problem here?
Any other way to fix this?