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

Improve the data provided by PhysicsDirectSpaceState.get_rest_info() #9341

Open
yosoyfreeman opened this issue Mar 20, 2024 · 4 comments
Open

Comments

@yosoyfreeman
Copy link

Describe the project you are working on

An sliding algorithm.

Describe the problem or limitation you are having in your project

In order to implement a reliable work-flow for kinematic bodies i need to gather information about all the collision normals touching the shape + an margin. This can not be achieved right now with a simple test, because get_rest_info will only provide the nearest one. The solution is to create a whole shapeCast node (Intended for movement) and provide it a motion vector of zero. This adds unnecessary complexity to a check that is often frequently needed in order to implement proper collision response and depenetration for all kind of purposes. Also, this solution is not obvious to the end user, as they will look at the PhysicsDirectSpaceState documentation page, which is supposed to provide the most complete data about the state of a physics body.

It also lacks the margin that ShapeCast node provides, which helps detecting geometry very near to the shape and react to it.

Both of this features are already implemented, but they are only available on ShapeCast node.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

  • add a max_collisions parameter to get_rest_info, so it can be used to handle collision response against multiple contacts based on their position and normals.

  • Add a "margin" parameter. As it happens with ShapeCast.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

The Godot source code is still a bit confusing to me, but the ShapeCast node is providing this information already, so suspect there is already a way of gathering this data and adding this margin to the check on the code, just not exposed to the user.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No. Collision data is extremely complex to gather from scratch.

Just in case: Doing get_rest_info, add that body to the exceptions list and do it again is not equivalent. If the collisions are against the same body, you will get only one and there still is no margin.

Is there a reason why this should be core and not an add-on in the asset library?

Improving the usability and robustness of the collision data is core functionality of a 3D engine, as everything that interacts in a physical way relies on this methods.

@Calinou Calinou changed the title improve the data provided by get_rest_info. Improve the data provided by PhysicsDirectSpaceState.get_rest_info() Mar 26, 2024
@sinewavey

This comment was marked as off-topic.

@yosoyfreeman
Copy link
Author

Hi! When i made this post i was referring to the fact that a shape cast node would do the trick, but i was wrong.

The shapeCast node does not really provide enough information either. It will only give you one contact per object, so, unless every triangle is a different object, as far as i know, this is just not possible for the end user.

@sinewavey
Copy link

Unfortunate. Thanks for the investigation anyway. As someone making a Quake-like, I've been fiddling it for months now. I hope we can find a path forward soon for Godot (and perhaps Jolt, though I know there wasn't much success over there either from the GH issues).

If you would like to talk further sometime about things I would really like to perhaps see if we can figure anything else out, though GitHub is a bit awkward to communicate on sometimes. Please let me know if you'd be interested at all!

@DinkeyKing
Copy link

DinkeyKing commented Jan 19, 2025

I proposed a new method for getting all the contact infos from a shape intersection check, because I was told on Godot Contributors Chat to avoid breaking compatibility. /issues/11609

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