godot-jolt / godot-jolt

Godot Jolt is a Godot extension that integrates the Jolt physics engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`get_slide_collision_count()` not returning correct count.

RatDotRaw opened this issue · comments

commented

The get_slide_collision_count() does not report the correct number of collisions.

In the GDscript player3d1rdPTank.gd is a function called friction(), this function checks if the player is touching anything.
In this case, it is used to determine if the player is airborne or not.

In the output console is the collision count logged.

Steps to reproduce:

  1. open and run the project.
  2. Walk to a wall and push yourself against the wall.
  3. Walk away from the wall.

You should be sliding around now.
It is pretty inconsistent.

Version information:

  • Godot version: V4.2.1.stable.official [b09f793f5]
  • Godot jolt version: 0.12.0 (downloaded from Assetlib tab in Godot)

Here is a stripped down project file: godotProj_v4.2.zip
(sorry in advance)

If there are any questions, I'll do my best to answer them.

There does seem to be some sort of discrepancy with Godot Physics here, but I'm not sure if there's necessarily a correct count for get_slide_collision_count().

The problem here seems more to have to do with the fact that you're mixing not is_on_floor() and get_slide_collision_count() == 0 to mean the same thing. If you change your usage of get_slide_collision_count() == 0 to not is_on_floor() (or vice versa) then things seems to work correctly.

Although I'm realizing now that you obviously only want air friction when not touching anything, including walls/ceilings. It might be better to replace that get_slide_collision_count() == 0 with not is_on_floor() and not is_on_wall() and not is_on_ceiling() perhaps.

commented

Sounds like a good solution for the problem.

After some testing and searching on the internet, I found some post with the same problem with the build in physics, might be an issue with the Godot engine itself.

Anyway, thanks for the effort for implementing and maintaining Godot jolt.
I'm not sure if the issue should be closed, so I'm going to leave it for someone else to close.