Skip to content

Back-face collisions and ray-cast surface normals #672

Answered by jrouwe
mihe asked this question in Q&A
Discussion options

You must be logged in to vote

The first thing that comes to mind is to create a DecoratedShape for this. This DecoratedShape would directly forward all collision queries to its child and only override the CastRay and CollisionDispatch::sRegisterCastShape methods. The CastRay function can copy the RayCastSettings object but set mBackFaceMode to EBackFaceMode::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 the SubShapeID to identify a back facing hit by wrapping CastRayCollector, adding the bit and then forwarding it to the user provided CastRayCollector. Override Shape::GetSurfaceNormal to read this b…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mihe
Comment options

@mihe
Comment options

@AndreaCatania
Comment options

Answer selected by mihe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants