Hi,
i'm using OpeneSceneGraph, .osg-models and the osgBullet-method btConvexHullCollisionShapeFromOSG(...). I have the problem, that all the convex hull shapes are larger than the models. but i 've no idea why...
if i use convex trimeshes instead the dynamic bodies always float above the ground. i've found out, that i can set the margin to zero. but then the bodies "bounce" i a strange way although there are no collisions...
does anybody know these problems? i don't know how to solve this and would be very happy if someone could help me!
thank you in advance,
Daniel
convex hull collision shape is larger than model
-
- Posts: 33
- Joined: Tue Jun 05, 2012 8:43 am
convex hull collision shape is larger than model
You do not have the required permissions to view the files attached to this post.
-
- Posts: 65
- Joined: Fri May 13, 2011 1:11 pm
Re: convex hull collision shape is larger than model
use the halfextend of your cylinder collision shape to create a bullet cylinder.
ie: btCollisionShape * myCollisionShape = new btCylinderShape(osgbCollision::btCylinderCollisionShapeFromOSG( yourOsgCylinder)->getHalfExtentsWithoutMargin());
assuming your osg cylinder is the trimesh as shown in the picture.
ie: btCollisionShape * myCollisionShape = new btCylinderShape(osgbCollision::btCylinderCollisionShapeFromOSG( yourOsgCylinder)->getHalfExtentsWithoutMargin());
assuming your osg cylinder is the trimesh as shown in the picture.
-
- Posts: 33
- Joined: Tue Jun 05, 2012 8:43 am
Re: convex hull collision shape is larger than model
well, the white trimeshes are the whireframe models of the collision shapes that i get with osgNodeFromBtCollisionShape(...) for debug purposes. so the upper picture of my initial post shows the convex hull shapes that are too large and the lower one shows the convex trimeshes that float above the ground...
if i use cylinder shapes for the wheels, they always have a wrong orientation and wrong dimensions as shown in the picture below.
so your approach doesn't work, Karrok. but nevertheless thank you for now.
do i have to build the models originally with the correct orientation to solve this problem?
that the convex trimeshes are floating has probably to do with the margin of the shape as Paul Martz told me. and as i mentioned before setting the margin to zero prevents the floating. but then it comes to strange behaviour and unexpected bouncing. i've read something about the internal edge problem, could it have do with that?
and can anyone tell me, why my convex hull collision shapes are too large?
if i use cylinder shapes for the wheels, they always have a wrong orientation and wrong dimensions as shown in the picture below.
so your approach doesn't work, Karrok. but nevertheless thank you for now.
do i have to build the models originally with the correct orientation to solve this problem?
that the convex trimeshes are floating has probably to do with the margin of the shape as Paul Martz told me. and as i mentioned before setting the margin to zero prevents the floating. but then it comes to strange behaviour and unexpected bouncing. i've read something about the internal edge problem, could it have do with that?
and can anyone tell me, why my convex hull collision shapes are too large?
You do not have the required permissions to view the files attached to this post.
-
- Posts: 65
- Joined: Fri May 13, 2011 1:11 pm
Re: convex hull collision shape is larger than model
the orientation is wrong because in your case you did not set it to suit your needs.
OSGBCOLLISION_EXPORT btCylinderShape* btCylinderCollisionShapeFromOSG( osg::Node* node, AXIS axis=Y );
from the osgb collisionShapes. Just adjust the last parameter to X or Z instead of the default Y axis it takes.
And it'll be fixed. So my approach does work, infact I've been using it myself for months. Try dig into the documentation a bit next time ?
Additionally, to get the debug wireframes you don't need to make osgnodes from your collisionnodes manually.
osgb has an implementation of the bullet debugdrawer available.
OSGBCOLLISION_EXPORT btCylinderShape* btCylinderCollisionShapeFromOSG( osg::Node* node, AXIS axis=Y );
from the osgb collisionShapes. Just adjust the last parameter to X or Z instead of the default Y axis it takes.
And it'll be fixed. So my approach does work, infact I've been using it myself for months. Try dig into the documentation a bit next time ?
Additionally, to get the debug wireframes you don't need to make osgnodes from your collisionnodes manually.
osgb has an implementation of the bullet debugdrawer available.
-
- Posts: 33
- Joined: Tue Jun 05, 2012 8:43 am
Re: convex hull collision shape is larger than model
ok, thank you. when i set the axis the cylinder shapes are correct. but they're made of only a few vertices. i think that has to do with the scaling of my objects, is that right? the wheels have a diameter of 50cm but the exported models have meter as unit, so the values are in the 0.-range...
the problem of strange behaviour and inexplainable bounces still occurs...could this also have to do with scaling? oder is this a problem of the internal edges?
the problem of strange behaviour and inexplainable bounces still occurs...could this also have to do with scaling? oder is this a problem of the internal edges?
You do not have the required permissions to view the files attached to this post.
-
- Posts: 65
- Joined: Fri May 13, 2011 1:11 pm
Re: convex hull collision shape is larger than model
Nope, that has nothing to do with the scaling. Internally (in Bullet) but rather how osgBullet converts a bullet cylinder.
In osgNodeFromBtCollisionShape( const btCylinderShape * btCylinder, const btTransform& trans )
the detail ratio is set to .2f
You can change this to have the debug osg node more closely resemble a cylinder. However again, just using the bullet debugdrawer implementation from osgBullet will be a lot easier (and also it actually creates a cylinder from your cylinders
In osgNodeFromBtCollisionShape( const btCylinderShape * btCylinder, const btTransform& trans )
the detail ratio is set to .2f
You can change this to have the debug osg node more closely resemble a cylinder. However again, just using the bullet debugdrawer implementation from osgBullet will be a lot easier (and also it actually creates a cylinder from your cylinders
-
- Posts: 33
- Joined: Tue Jun 05, 2012 8:43 am
Re: convex hull collision shape is larger than model
ok, so the problem of the collision shapes is solved. Thanks!
But there's still the strange behaviour...
But there's still the strange behaviour...