0 votes

Hi all,

I am seeing some odd behavior with kinematic bodies. One is a moving platform moving up, and one is the player that has velocity added down, so as to stick to the platform.

I am using a custom implementation of moveandcollide for the player object, and using the AnimationPlayer with 'sync to physics' on for the platform.

Essentially, I want to be able to leap above the platform even when it is moving up, and I do a collision test to see if the upward velocity for the player results in a collision with the platform. What should happen is that the collision test returns null, so I can exit the moving platform.

However, what I see in between frames, is that the player collision shape has merged a little bit into the moving platform that is moving up. Thus, all my collision tests with upward velocity fail, and my logic does not work.

Any help with this would be greatly appreciated. Thanks.


Godot version 3.5
in Engine by (29 points)

1 Answer

+1 vote

If I understand correctly, you have the problem with a physic body not colliding correctly with another physic body. If that's correct, you can try by setting the physics FPS (in project settings / physics) with a larger number. This can make the game run with less FPS so I don't recommend it that much, unless is something under the double. I hope I could help.

by (20 points)

Yes indeed.

I had implemented my own custom logic in 3.5 for my character, using moveandcollide(). For moving platforms however, my characters colliders would mesh together with the characters shape for certain frames, throwing off collisiond detection, especially if both were moving in the same direction.

In 4.0, I circumvented the entire issue with the now more powerful CharacterBody. Moveandslide() helped me, although I don't fully understand what it does under the hood to fix the bodies meshing together. Hopefully I never have to find out : )

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.