Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

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

Open
luluxia opened this issue Sep 10, 2023 · 2 comments
Open

Comments

@luluxia
Copy link
Contributor

luluxia commented Sep 10, 2023

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 kaboom@3000.0.0-beta.2, but on versions newer than kaboom@3000.0.0-beta.2, something strange happens as the onFallOff and onGround get triggered repeatedly. I found the [commit](1739d72) 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?

@slmjkdbtl
Copy link
Contributor

slmjkdbtl commented Oct 14, 2023

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

@luluxia
Copy link
Contributor Author

luluxia commented Oct 14, 2023

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Bugs
Development

No branches or pull requests

2 participants