Jump to content
  • Advertisement
Sign in to follow this  

Physx PxBoxGeometry always get bias from original Boundingbox

This topic is 1148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to attach a PxBoxGeometry to the PxRigidDynamic as a simulation data because Physx doesn't allow TriangleMesh being simulated in a simulated PxRigidDynamic.
So I create a PxShape with a PxBoxGeometry like this:
vec3 halfSize = boundingBox.GetHalfSize();
PxBoxGeometry boxGeometry = PxBoxGeometry(halfSize.x, halfSize.y, halfSize.z);
PxShape* boxShape = physics->createShape(boxGeometry, *material);
After that I found the boxShape got bias from the original. In order to prove that, I also created a ConvexMesh using the box's vertices:
convexDesc.points.count = 8;
convexDesc.points.stride = sizeof(vec3);
convexDesc.points.data = boundingBox.GetAllCorners();
convexDesc.flags = PxConvexFlag::eCOMPUTE_CONVEX;
PxDefaultMemoryOutputStream  stream;
if(cooking->cookConvexMesh(convexDesc, stream))
PxDefaultMemoryInputData input(stream.getData(), stream.getSize());
PxConvexMesh* convexMesh = physics->createConvexMesh(input);
PxConvexMeshGeometry convexGeomtry = PxConvexMeshGeometry(convexMesh);
PxShape *convexShape = physics->createShape(convexGeomtry, *material);
The code above worked very well. The Convex really surrounded the original boundingbox(It actually was the original boundingbox).
That is how the two bounding box get different position:
Note that for both the PxBoxGeometry  Shape and the PxConvexMeshGeometry Shape I haven't set localPosition beacuse it's not necessary.
That's is very confusing! After that I also created a PxSphereGeometry and found it also got bias from original.
What is the reason?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!