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

Expose PhysicsDirectSpaceState.intersect_point() to scripting #3262

Closed
fossegutten opened this issue Sep 6, 2021 · 3 comments · Fixed by godotengine/godot#54573
Closed

Comments

@fossegutten
Copy link

Describe the project you are working on

3D first person shooter

Describe the problem or limitation you are having in your project

When using RayCast that starts and ends inside a shape, an intersection is not detected.
I need to know if the raycast starts inside an Area or not.

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

Expose intersect_point from PhysicsDirectSpaceState to GDscript.
This is already exposed in 2D

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

PhysicsDirectSpaceState.intersect_point(.....)

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

Will be used often, cant be worked around.

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

It already exists in engine, just needs to be exposed.

@Xrayez
Copy link
Contributor

Xrayez commented Sep 7, 2021

When using RayCast that starts and ends inside a shape, an intersection is not detected.
I need to know if the raycast starts inside an Area or not.

Perhaps could be fixed by godotengine/godot#41347.

@Calinou Calinou changed the title Expose intersect_point to Gdscript Expose PhysicsDirectSpaceState.intersect_point() to scripting Sep 10, 2021
@Calinou
Copy link
Member

Calinou commented Sep 10, 2021

For the record, this is how intersect_point() is exposed in the 2D physics server:

This will require a bit of refactoring as no such method exists in 3D. Besides, if backporting this to 3.x is desired, it needs to be exposed in both Bullet and GodotPhysics.

@20kdc
Copy link

20kdc commented Sep 10, 2021

EDIT: these notes are for 3.x

Bullet and GodotPhysics seem to have intersect_point, and the class structure involved here suggests that exposing it in the base class would do so in both.

"common code" style for _intersect_ray: https://github.com/godotengine/godot/blob/3.x/servers/physics_server.cpp#L252

Implementations of intersect_point:
https://github.com/godotengine/godot/blob/3.x/modules/bullet/space_bullet.cpp#L65
https://github.com/godotengine/godot/blob/3.x/servers/physics/space_sw.cpp#L53

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

Successfully merging a pull request may close this issue.

4 participants