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 m_raycastInfo in VehicleWheel3D to scripting #10106

Open
TestSubject06 opened this issue Jul 3, 2024 · 1 comment · May be fixed by godotengine/godot#93900
Open

Expose m_raycastInfo in VehicleWheel3D to scripting #10106

TestSubject06 opened this issue Jul 3, 2024 · 1 comment · May be fixed by godotengine/godot#93900

Comments

@TestSubject06
Copy link

TestSubject06 commented Jul 3, 2024

Describe the project you are working on

I'm working on a vehicular combat game with lots of verticality. The vehicles are in the air quite a bit, and the suspensions are taxed a lot.

Describe the problem or limitation you are having in your project

The current implementation of the VehicleBody3D and VehicleWheel3D makes it impossible to collect the raycast information from the suspension. I have no good way to place the tire marks on the ground without being able to collect the collision point and normal from the wheels.

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

Exposing the raycast information that's already present in the wheel will make it easy to implement this feature, as I will know the collision point and normal that the wheel has detected.

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

Either a collection of methods like get_contact_normal() or get_contact_position(), or simply exposing the entire m_raycastInfo struct to scripting will work fine. The data is already there and maintained as seen in https://github.com/godotengine/godot/blob/master/scene/3d/physics/vehicle_body_3d.h. It should be trivial for a C++ engineer to go in and expose these.

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

The current workaround is to create a second raycast for each of the wheels to re-do the work, or attempt to reverse the collision point (but crucially not the normal) from the wheel's rendered position.

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

I'm not aware of an asset library or addon that can reach into the C++ code and expose properties like this.

@Calinou Calinou changed the title Expose m_raycastInfo in VehicleWheel3D to GDScript. Expose m_raycastInfo in VehicleWheel3D to scripting Jul 3, 2024
@TestSubject06
Copy link
Author

Added a possible implementation here: godotengine/godot#93900

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.

2 participants