-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Expose Surface Normals as part of Contact Data 3D #8324
Comments
To give a much needed summary of the issue linked there, the problem is that with collision/contact normals being what they are (and correct me if I'm wrong) meaning the best (?) direction by which to separate the two bodies/shapes, combined with the fact that things like In some cases though, you simply just want the normal of the surface at that contact point, without having to consider all the ins-and-outs of how the underlying collision detection works, like for example the shape margins used by GJK-EPA. I would even go so far as to argue that it's probably what most users think they're actually getting when they're making use of the current collision/contact normal in Godot.
I think it should be. Whichever way you slice it you're going to have surface normals as part of the shared API, which definitely should be populated by Godot Physics as well. If nothing else, it's (as you say) a useful piece of contact information that can likely benefit many other use-cases, including Actually calculating the surface normals for all the shape types in Godot Physics should be fairly straight-forward, if it's not readily available already. It's more just about someone sitting down and actually doing it and then running the PR gauntlet with it. |
The reason why I thought it didn't need to be was because I thought there were plans to replace Godot Physics 3D with your addon. I may have misunderstood though. In my mind, it didn't make sense to make satisfying this request more complicated by requiring more work on Godot Physics if it plans to be deprecated soon anyway. I don't know if the deprecation is a 4.x thing or a 5.0+ idea though. If it does plan to be a 5.0+ deprecation, I hope there is another way to satisfy this proposal before then. Also, thanks for providing more context, and thanks for that article! |
I agree, as expressed in the quote in the OP. In Godot Physics I think it could be done by calculating the surface normal in the |
Yeah. We I been too trying to dig into this to see if i could make a better integration of sliding a collision handling myself to being able to keep testing Godot Jolt without the current implementation problems. This combined with
With this, my intention is just to point that maybe the adoption of Godot Jolt and the physics systems is being slowed down because of clarity about what the engine is exactly doing. I think it may be worth it to check and clarify this things to help future contributors understand with what they are working and get a better picture of the whole thing. |
While the physics server interface certainly has some quirks, I don't think there's anything particularly odd about the type of normals you currently get in the contact data. If you're looking to solve the collision between the two bodies/shapes then that's what you'd need to use, along with the contact depth. It's what pretty much all physics engines provide as the normal in their contact data and seems like a reasonable thing for Godot to do as well. The problem is that they're often treated as surface normals. Frankly, there might even be a reasonably strong argument against this proposal for that exact reason, as other third-party physics engine integrations (PhysX, Rapier, etc.) might not be able to provide surface normals as easily. This becomes especially problematic if first-party scene nodes in Godot would ever start relying on them, like |
I personally dont think that we should concern ourselves with what future engines might be able to do with ease. I only really agree with
I could see this being a problem if |
@TechnikEmpire yes, because it returns the collision normal of something you consider a floor. It does not actually return the surface normal. |
@Gamepro5 hmmm ok, I'll have to dig into the source code for it because if that's the case, then the docs need their language updated as well. "the surface normal of the floor at the last collision point" - to me would mean that you're getting the surface normal of the surface last collided with. |
… but rather the collision normal. Also see godotengine/godot-proposals#8324
Describe the project you are working on
A multiplayer FPS with quake style movement that uses Godot Jolt to handle collisions.
Describe the problem or limitation you are having in your project
After several months of debugging with the generous help of @mihe and @jrouwe, I believe that my project and many other projects would benefit from being able to use surface normals. The Jolt physics engine is able to give surface normals, not just collision normals. Godot Physics is not able to do this, and as such, the Godot Jolt addon is unable to allow users to use this normal.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Too many to list here. The belief is that this problem for
move_and_collide()
would not be an issue if I could just use surface normals. But it would mean that character controllers made could, if the third party physics engine supports it, use surface normals instead of collision normals. Jolt uses GJK-EPA, which from what I understand struggles with reporting accurate collision normals on sharp edges. Thus, being able to access the surface normals it already provides through godot's physics server api would (presumably) be a solution to the problem. Even if it doesn't, having access to surface normals would still be beneficial for other uses, as right now the only way to get this info is by using raycasts.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I'm not qualified to say how this would work, so I talked to @rburing about it. Here's what I gathered from that:
Quote from @rburing:
This isn't a request to add surface normals to Godot Physics. It would be odd to have a property in the default KinematicCollision3D that isn't used unless a third party physics engine uses it, so I think that a more flexible api for this would be required. I am not sure though and am open to discussion.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No.
Is there a reason why this should be core and not an add-on in the asset library?
n/a
The text was updated successfully, but these errors were encountered: