-
This is sort of a two-part question. Godot allows for enabling back-face collision for its So I guess my first question is: Is this the way I should be doing it, or is there a better way to achieve it? If this is indeed how it should be done, then this approach seems to run up against a problem with regards to retrieving the surface normal from a ray-cast. As per your documentation I'm using One way of resolving this could be for me to just check if the normal is facing in the same direction as the ray itself, in which case I just flip it, but I figured I should check to see what ideas you might have. I'd be happy to throw together a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The first thing that comes to mind is to create a For CastShape you can use a similar trick on the |
Beta Was this translation helpful? Give feedback.
The first thing that comes to mind is to create a
DecoratedShape
for this. ThisDecoratedShape
would directly forward all collision queries to its child and only override theCastRay
andCollisionDispatch::sRegisterCastShape
methods. TheCastRay
function can copy theRayCastSettings
object but setmBackFaceMode
toEBackFaceMode::CollideWithBackFaces
to make the mesh double sided. You would indeed need to flip the normal yourself based on the ray cast direction or you could add an extra bit to theSubShapeID
to identify a back facing hit by wrappingCastRayCollector
, adding the bit and then forwarding it to the user providedCastRayCollector
. OverrideShape::GetSurfaceNormal
to read this b…