Hi all, I'm trying to work out how I can compute the coordinates of the "lowest" point in an object/shape in the world, by which I mean the point with the lowest y-coordinate.
Now, clearly I can get the lowest y-coordinate from the AABB, but I can't see how I would then proceed to get the x- and z- coordinates.
Can anyone point me in the right direction?
Getting coordinates of lowest point on object
-
- Posts: 47
- Joined: Mon Aug 16, 2010 10:43 am
Re: Getting coordinates of lowest point on object
I think you'll have to loop through every vertex and compare to find lowest one.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Getting coordinates of lowest point on object
It depends on the collision shape type. For convex objects (btBoxShape, btSphereShape, btConvexHullShape, btCylinderShape etc), you can use the 'getSupportingVertex' method:
Given a convex shape and a world transform, you can try something like:
For compound shapes and triangle meshes, it requires a bit more work.
Thanks,
Erwin
Given a convex shape and a world transform, you can try something like:
Code: Select all
btVector3 direction(0,-1,0);
btVector3 supportAxisInA = (direction)* worldTransform.getBasis();
btVector3 pInA = convexShape->localGetSupportVertexWithoutMarginNonVirtual(supportAxisInA);
btVector3 pointInWorld = worldTransform(pInA);
Thanks,
Erwin