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

[Bullet] 3D - Raycasting onto a capsule collision, is very inacurrate, compared to a box collision #45451

Open
Tracked by #45022
Dragon20C opened this issue Jan 25, 2021 · 7 comments

Comments

@Dragon20C
Copy link

I am still new to godot so if a setting/option exists that makes the capsule have accurate collision mesh that would be great if not then this is an issue.

Godot version:
3.2.3 GLES3

OS/device including version:
Manjaro Linux , GTX 1650, 16GB ddr4, R5 1600 AF

Issue description:
when using a ray cast against a capsule it is very inaccurate on the edges of the capsule, I also tested a simpler cube collision and that produced better results

Steps to reproduce:
create a capsule with collision and use a raycast against the capsules edges

Minimal reproduction project:
Video Evidence: one box and other capsule

Box.mp4
Capsule.mp4
@Calinou
Copy link
Member

Calinou commented Jan 25, 2021

@Dragon20C Can you reproduce this after switching the physics engine from Bullet (the default) to GodotPhysics?

Also, please upload a minimal reproduction project to make this easier to troubleshoot.

@Dragon20C
Copy link
Author

@Calinou Hello, thanks for replying I have changed the physics engine to GodotPhysics and the accuracy is a lot better but the movement of my player feels very stuttery and sometimes the movement of my player just moves by its self probably something to do with my modeled maps, Is the physics engine(GodotPhysics) being worked on in 3.2.3 or is it a lot better in 4.0, I would love to add a reproduction project but that takes time, and I dont have a lot of it

@Dragon20C
Copy link
Author

@Calinou Hello I took the time to make a reproduction project, the issue still exists but only on the bullet physics engine
here is the project:
Issue Project.zip

@Calinou
Copy link
Member

Calinou commented Jan 25, 2021

Is the physics engine(GodotPhysics) being worked on in 3.2.3 or is it a lot better in 4.0,

GodotPhysics is receiving fixes for 4.0 and will likely become the default physics engine again (like it was in 2.x).

@Calinou Calinou changed the title 3D - Raycasting onto a capsule collision, is very inacurrate, compared to a box collision [Bullet] 3D - Raycasting onto a capsule collision, is very inacurrate, compared to a box collision Jan 25, 2021
@Zylann
Copy link
Contributor

Zylann commented Jan 25, 2021

How small is your capsule? Did you scale it? Maybe it is too small, or your margin is too high. Here is what I can see with Collision Scanner, using Bullet:

image

The grid matches world units.
As you can see the raycasts are not absolutely perfect, but still fairly accurate, at least for a game like yours. The default margin (0.04) is only a few pixels. It even tends to hit a bit earlier than missing.

image

@Dragon20C
Copy link
Author

@Zylann I have added a reproducable project, can you test you scanner to see if the issue still there maybe this issue only happens when running the game or maybe its where the raycast is located in the code.

@e344fde6bf
Copy link
Contributor

I ran the test project and the issue is that you set the scale of the collision shape to (0.8, 0.8, 1), collision detection works again after resetting the scale.

Currently non-uniform scaling of collision shapes isn't supported by the physics engine see: #41685, #32975

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

4 participants