Replies: 1 comment
Unfortunately I can't. I made Jolt Physics and I've mainly done bugfixes in godot related to Jolt, but I'm definitively not an expert on how you would implement something like this in godot. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I think the vehicle constraints from Jolt are really good, way superior to current vehicle body in Godot. I have already made a full implementation for my own project, here: https://github.com/almic/godot/tree/2f8420d62324acabb4d76c346ccc4bc2e5b38de5/scene/3d/physics/jolt_vehicle
(Please understand I have some additional engine changes, and some changes to Jolt, to support a few extra things I wanted.)
I provide this purely to show I have the code, not that it works or is representative of what the PR would look like. I wrote this in a hurry several months ago and there are some things I would change already.
It probably doesn't fit with the "ideal" implementation that Godot would expect. My implementation currently makes the assumption that the engine WILL run with Jolt and so it just slams all the Jolt types into the main
scene/3d/physicspath. This should instead be first moved to themodules/jolt_physicspath. Then, similar to the vorbis module, register aJoltVehicleclass which would effectively be no-ops without enabling the Jolt physics server.I would like to stress very very much that the api/ implementation is not the problem stopping me right now. Names are the problem I am facing that is preventing me from really going forward with just making my changes and sending it as a PR.
Jolt vehicles are very different in setup and there's just no possible way to add it to generic interfaces similar to how joints are done, or as methods on
PhysicsServer3Dsingleton, all interactions with the underlying Jolt types would be handled through theJoltVehicleand related types exposed to the editor. Right now, my implementation lacks a few things in Jolt, like motorcycle and tracked vehicles, but those can be trivially added with the setup I propose. However, there are still a LOT of types hereAntiRollBarSettingsJoltVehicleJoltVehicleSettingsVehicleControllerVehicleControllerSettingsWheeledVehicleControllerWheeledVehicleControllerSettingsVehicleDifferentialSettingsVehicleEngineSettingsVehicleTransmissionSettingsWheelBaseSettingsWheelSettingsYou should hopefully be recoiling at the amount of Jolt-only global names that could be added with a hasty implementation following current Godot development patterns. I am particularly bothered by
WheelSettings, as anyone upgrading to a version of Godot that contains these new types will be forced to change the names of their own classes and resources that happen to conflict with these names. This could be """alleviated""" by spammingJoltprefixes everywhere... but I think the current Godot-way to make everything a top-level name is generally the issue here.So I bring an additional proposal for this, expose only one top-level name
JoltVehicleand have all related classes be "namespaced" similar to how GDScript has theclasskeyword to create subclasses likeMyClass.SubClass. I had hoped to find an example in Godot where a class name was nested as a sub-class type, but I couldn't find one. Technically all enums do this, but I have no clue if that's really the same thing. This would be my dream (as gdscript sudo-code):This would result in only
JoltVehiclebeing added as a top-level name. But, I have no clue how or if that could work in Godot's source code.I'm going to tag the physics guy himself, @jrouwe, so he can hopefully help me come up with a good solution to this. I would really like to avoid adding several names into global scope, but I think my implementation (with some tweaking) is already close to ready for a PR.
All reactions