Skip to content

Issues implementing CastShape function for custom shape #1381

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

You must be logged in to vote

I would suggest to create a debug probe like the Samples to test your CastShape function.

Looking at the code, I think the problem is that you're not making the cast shape relative to the box: https://github.com/JuanDiegoMontoya/Frogfood/blob/45275d1874af6e84e74e446bcdc56c41594eb060/src/Voxels/Physics/TwoLevelGridShape.cpp#L117

This inCastShape should be replaced by something like:

ShapeCast shape_cast = inShapeCast.PostTranslated({-x - 0.5f, -y - 0.5f, -z - 0.5f});

sCastShapeVsShapeLocalSpace takes a local space cast as the function name suggests, the center of mass transform that is being passed in is only used to transform the normals and contact points to world space.

Another suggest…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@JuanDiegoMontoya
Comment options

Answer selected by JuanDiegoMontoya
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1378 on December 06, 2024 15:43.