btConvexPointCloudShape not scaling

Post Reply
mgs_oleg
Posts: 10
Joined: Mon Jun 08, 2015 6:25 pm

btConvexPointCloudShape not scaling

Post by mgs_oleg »

When I am using btConvexPointCloudShape and setting localScaling it is not afftected
How properly scale btConvexPointCloudShape object ?
my scale is
vec3(3.000000, 6.000000, 1.000000)
mgs_oleg
Posts: 10
Joined: Mon Jun 08, 2015 6:25 pm

Re: btConvexPointCloudShape not scaling

Post by mgs_oleg »

can someone help me here how to properly use this collision shape ?
niad
Posts: 7
Joined: Sun Mar 11, 2018 9:34 am

Re: btConvexPointCloudShape not scaling

Post by niad »

I don't use that class, but glancing at the code(localGetSupportingVertexWithoutMargin) I'd say the scaling is applied too late-- shouldn't matter if you are doing uniform scaling but with (3,6,1) I'd guess it would produce incorrect results.

Try changing this code in localGetSupportingVertexWithoutMargin:


int index = (int)vec.maxDot(&m_unscaledPoints[0], m_numPoints, maxDot); //FIXME: may violate encapsulation of m_unscaledPoints
return getScaledPoint(index);

To This:

vec = vec * m_localScaling;
int index = (int)vec.maxDot(&m_unscaledPoints[0], m_numPoints, maxDot); //FIXME: may violate encapsulation of m_unscaledPoints
return getScaledPoint(index);
mgs_oleg
Posts: 10
Joined: Mon Jun 08, 2015 6:25 pm

Re: btConvexPointCloudShape not scaling

Post by mgs_oleg »

thanks niad. let me try. I will get back in short with results
Post Reply