-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Return collided object for VehicleWheel #3640
Comments
I would be happy to implement this improvement to flex my C++ muscles if it gets accepted as something that's needed. |
Yeah, that sounds like a good idea! A PR would be welcome. I would go for adding a new method called See the body entered signal on rigid bodies as a reference for documentation: |
Great! I will get on it and hopefully I'll have something in the following days! |
hi I am arjun , I am having intermediate knowledge in C++ pls tell me what should I learn so that I can contribute . it would be very helpful if u can guide me. |
I successfully implemented this feature and sent in a PR here. |
Hi Arjun! You can read this article about contributing to the code. I would suggest to start with checking issues from the main repo with the |
Implemented by godotengine/godot#55723. |
Describe the project you are working on
I am working on a 3D racing game using the built in VehicleBody and VehicleWheel classes.
Describe the problem or limitation you are having in your project
I cannot get what the
VehicleWheel
is in contact with form the wheel itself.Describe the feature / enhancement and how it helps to overcome the problem or limitation
While I can check if a collision is happening with VehicleWheel's
is_in_contact()
, I can not get what the wheel is actually colliding with.By adding a new method we could return what object the wheel is colliding with.
A common use case for this would be to check if the wheel is on tarmac, dirt, grass, etc. and we could update it's
wheel_friction_slip
accordingly.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I can see two solutions for this:
is_in_contact()
to return eithernull
or the object the collision is happening with.null
or the object the collision is happening with.I have limited C++ knowledge, but it seems to me returning
wheel.m_raycastInfo.m_groundObject
would solve this.This is a piece of
real_t VehicleBody3D::_ray_cast(int p_idx, PhysicsDirectBodyState3D *s)
fromscene/3d/vehicle_body_3d.cpp
If this enhancement will not be used often, can it be worked around with a few lines of script?
A workaround could be achieved with adding a RayCast to each wheel manually, but it seems redundant if there's one already in the VehicleWheel class.
Is there a reason why this should be core and not an add-on in the asset library?
As the VehicleWheel is already in core it makes sense to add this improvement to core as well.
The text was updated successfully, but these errors were encountered: