kaboom icon indicating copy to clipboard operation
kaboom copied to clipboard

Player's Unexpected physical behavior when located on a moving object.

Open luluxia opened this issue 2 years ago • 2 comments

I would like to use moving platforms in the game. When a player jumps onto these platforms, the player can follow them along. As is shown in this [demo](https://jsfiddle.net/y4kvecLg/2/) I used before, when the player adds z(1), it can follow the moving platforms along. This works on [email protected], but on versions newer than [email protected], something strange happens as the onFallOff and onGround get triggered repeatedly. I found the [commit](https://github.com/replit/kaboom/commit/1739d72f5761b4783d1f6aaf6a33638f4de4c54c) that causes this problem, but I have no idea how to fix it.

Also, I would like to ask whether the method in this demo is correct to make a movable platform?

luluxia avatar Sep 10 '23 02:09 luluxia

Yes that commit breaks moving platforms, just reverted in v3000.1.13

Can't seem to open the fiddle link. For moving platforms you shouldn't be doing extra work, just move the platform and the player with body() component will stick to it, unless you pass the body({ stickToPlatform: false }) option

slmjkdbtl avatar Oct 14 '23 04:10 slmjkdbtl

thanks, It works now, but I've found that sometimes the z() component and the order in which objects are added still cause this problem when the player is standing on a vertically falling platform in my game. I tried to write the simplest case to reproduce the problem, but it hasn't worked yet.

I can fix this by adjusting the order in which objects are added or removing the z() component of some objects, but I'm still not sure what's causing the problem.

luluxia avatar Oct 14 '23 05:10 luluxia