Skip to content

Commit

Permalink
not colliding shapes done
Browse files Browse the repository at this point in the history
CompundShapes collision fixed
  • Loading branch information
cyrilgramblicka committed Jan 12, 2018
1 parent a196cd4 commit 007d2f2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/otbullet/discrete_dynamics_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ namespace ot {
uint tri_count = 0;

for (uints j = 0; j < _cow_internal.size(); j++) {

if (_cow_internal[j]._shape->getUserIndex() & 1) { // do not collide with terrain
continue;
}
btCollisionObjectWrapper internal_obj_wrapper(_cow_internal[j]._parent,
_cow_internal[j]._shape,
obj,
Expand Down
5 changes: 5 additions & 0 deletions src/otbullet/ot_terrain_contact_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ void ot_terrain_contact_common::collide_convex_triangle(const bt::triangle & tri


btCollisionObjectWrapper triObWrap(_manifold->getBody1Wrap(), &tm, _manifold->getBody1Wrap()->getCollisionObject(), _manifold->getBody1Wrap()->getWorldTransform(), 0, triangle.tri_idx);//correct transform?

const btCollisionObjectWrapper * curr_col_obj_wrapper = _manifold->getBody0Wrap();
_manifold->setBody0Wrap(_convex_object);

btCollisionAlgorithm* colAlgo = _collision_world->getDispatcher()->findAlgorithm(_manifold->getBody0Wrap(), &triObWrap, _manifold->getPersistentManifold());

const btCollisionObjectWrapper* tmpWrap = 0;
Expand All @@ -341,6 +345,7 @@ void ot_terrain_contact_common::collide_convex_triangle(const bt::triangle & tri

colAlgo->processCollision(_manifold->getBody0Wrap(), &triObWrap, _collision_world->getDispatchInfo(), _manifold);

_manifold->setBody1Wrap(curr_col_obj_wrapper);
_manifold->setBody1Wrap(tmpWrap);

colAlgo->~btCollisionAlgorithm();
Expand Down
29 changes: 17 additions & 12 deletions src/otbullet/otbullet.intergen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,29 @@ class physics_dispatcher : public physics
///Cleanup routine called from ~physics()
static void _cleaner_callback( physics* m, intergen_interface* ifc ) {
::physics* host = m->host<::physics>();
if (host) host->_ifc_host = ifc;
if (host) host->_ifc_host.assign_safe(ifc);
}

static iref<physics> _generic_interface_creator( ::physics* host, physics* __here__)
{
//cast to dispatch to sidestep protected access restrictions
physics_dispatcher* __disp__ = static_cast<physics_dispatcher*>(__here__);
if (!__disp__)
__disp__ = new physics_dispatcher;

__disp__->_host.create(host);
__disp__->_vtable = _capture ? get_vtable_intercept() : get_vtable();
if (!host->_ifc_host) {
__disp__->_cleaner = &_cleaner_callback;
host->_ifc_host = __disp__;
iref<physics> rval;
if (host->_ifc_host && !__here__)
rval.create(static_cast<physics_dispatcher*>(host->_ifc_host.get()));

if (rval.is_empty()) {
physics_dispatcher* dispatcher = __here__ ? static_cast<physics_dispatcher*>(__here__) : new physics_dispatcher;
rval.create(dispatcher);
dispatcher->_host.create(host);
dispatcher->_vtable = _capture ? get_vtable_intercept() : get_vtable();
}

return __disp__;
if (!host->_ifc_host.assign_safe(rval.get()))
rval.create(static_cast<physics_dispatcher*>(host->_ifc_host.get()));
else
static_cast<physics_dispatcher*>(rval.get())->_cleaner = &_cleaner_callback;

return rval;
}

public:
Expand Down

0 comments on commit 007d2f2

Please sign in to comment.