Open 19PHOBOSS98 opened 4 years ago
@pouleyKetchoupp What's your opinion on this?
Yes, it's a desirable feature and it's not difficult to add to Physics2DDirectBodyState
and to 3D as well.
yay :)
so is it added ?
so is it added ?
No, not yet. This requires a motivated contributor to do the work, but pouleyKetchoupp is no longer available to work on Godot. I can't do it myself as I have no experience working on physics engines.
Describe the project you are working on: A portal system to accommodate large composite physics bodies
Describe the problem or limitation you are having in your project: My system involves 2 identical rigidbodies as the portal travelling agent, the original and its duplicate. As the original would pass half way thru the first portal it's duplicate mimics it's movement on the other portal giving the illusion of being its other half. If anything interacts with either one (walls, bullets etc.) they would move in sync as one object.
I did it by having the duplicant pool its collision parameters(collision_bodies,_normals,_position) to its original, having it recalculate and add the duplicants collision response to itself as if it was its own. The duplicant is forced to mimic its original by global_transform manipulation (I know, its taboo but it works better than manipulating velocities and somehow it even detects KinematicBodies better by doing this).
I got the collision response to work (static2rigid & rigid2rigid) but I have a hard time implementing positional correction(to stop stuff from sinking into stuff). To do that i need to recalculate each of the bodies "manifolds" to get the penetration_depth which is a pain since the engine already calculated it when it calculated the collision normal.
if I had to, I'd have to dig thru the colliding bodies to find their aabbs and calculate the penetration depth from there, and that'll work right, only if it collides with a box (my game involves more complex shapes than that).
Describe the feature / enhancement and how it helps to overcome the problem or limitation: It would be easier to write custom physics if the penetration_depth was exposed. The code wouldn't have to dig thru collision shapes and body states twice each physics frame just for a single float value.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: just like how collision normal is: "get_contact_local_normal()"
If this enhancement will not be used often, can it be worked around with a few lines of script?: It can be worked around, but the script has to consider the object's shapes and also offsets. Besides, the engine already calculate this for the Physics to run.
Is there a reason why this should be core and not an add-on in the asset library?: The fact that the engine is already doing the calculation is the reason that this feature should be in the core and not as an add-on