Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_on_floor() doesn't work with _process(delta) and high FPS on trimesh collision #36009

Closed
JupiterRider opened this issue Feb 8, 2020 · 5 comments

Comments

@JupiterRider
Copy link

JupiterRider commented Feb 8, 2020

Godot version:
3.2 Stable

OS/device including version:
Linux 5.5.2-arch1-1

Issue description:
If you use is_on_floor() and the kinematic body is on a on an uneven trimesh collision, is_on_floor() returns false, if you call move_and_slide() with _process(delta) AND you have high FPS.

Steps to reproduce:

  1. Create a uneven mesh.

  2. Give the mesh a trimesh collision.

  3. Place a Kinematic body

  4. Attach a script to the Kinematic body

  5. Use _process(delta) instead of _physics_process(delta)

  6. Disable VSYNC to make sure having high FPS

Minimal reproduction project:
https://github.com/JupiterRider/is_on_floor_issue

Peek 2020-02-07 17-59

@KoBeWi
Copy link
Member

KoBeWi commented Feb 8, 2020

Well, it's rather expected that you need to use physics methods inside physics_process(delta).

@jamie-pate
Copy link
Contributor

Probably related? #35780

@Seel
Copy link

Seel commented Feb 11, 2020

Well, it's rather expected that you need to use physics methods inside physics_process(delta).

I use _process for the player because the camera scrolling and player movement is smoother when moving at 100+ fps. :/

However the minimal reproduction project has me standing on_floor when standing still and only lifting off the ground when moving.

@Calinou
Copy link
Member

Calinou commented Feb 11, 2020

I use _process for the player because the camera scrolling and player movement is smoother when moving at 100+ fps. :/

It's probably a better idea to use _physics_process() or _integrate_forces() with lawnjelly's smoothing-addon for physics interpolation. This prevents physics from behaving differently in subtle ways depending on the rendering FPS (this will happen even if you use delta consistently).

@KoBeWi
Copy link
Member

KoBeWi commented Dec 23, 2020

Closing, only do physic things in physics_process, otherwise the behavior is undefined (it might work or it might break).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants