Example #1
0
void CODEGeom::destroy()
{
	if(!m_geom_transform) return;
	if(geom())
	{
		dGeomDestroyUserData(geom());
		dGeomDestroy(geom());
		dGeomTransformSetGeom(m_geom_transform,0);
	}
	dGeomDestroyUserData(m_geom_transform);
	dGeomDestroy(m_geom_transform);
	m_geom_transform=NULL;
}
void destruirMundo()
{
    for(int i=0; i < 6; i++)//destruir Robos
    {
        dGeomDestroy (robot[i].box[0]);
        dGeomDestroy (robot[i].box[1]);
        dGeomDestroy (robot[i].cylinder[0]);
        dGeomDestroy (robot[i].cylinder[1]);
    }

    bola.destruir();

    for(int i=0; i < 6; i++) //destruir Campo
        dGeomDestroy(wall[i]);

    for(int i=0; i < 3; i++) //destruir Gols
    {
        dGeomDestroy(goalR[i]);
        dGeomDestroy(goalL[i]);
    }

    for(int i=0; i < 4; i++)//destruir Quinas
    {
        dGeomDestroy(triangle[i]);
    }

    dJointGroupDestroy(contactgroup);		// Destrói o grupo de juntas de contato
    dSpaceDestroy (space);					// Destrói o espaço
    dWorldDestroy (world);					// Destrói o mundo
}
Example #3
0
void SkidSteeringVehicle::destroy() {
    dBodyDestroy(this->vehicleBody);
    dGeomDestroy(this->vehicleGeom);
    
    for(int fr = 0; fr < 2; fr++) {
        for(int lr = 0; lr < 2; lr++) {
            dBodyDestroy(this->wheelBody[fr][lr]);
            dGeomDestroy(this->wheelGeom[fr][lr]);
            dJointDestroy(this->wheelJoint[fr][lr]);
        }
    }
    
    dRigidBodyArrayDestroy(this->bodyArray);
}
Example #4
0
void Machine::destroy(void)
{
	int i;
	dBodyDestroy(body[0]);
	dBodyDestroy(body[1]);
	dGeomDestroy(geom[0]);
	dJointDestroy(joint);
	for(i=0; i<2; i++)
		dGeomDestroy(geom[i+2]);
	for(i=0; i<3; i++)
	{
		dBodyDestroy(wheel[i]);
		dGeomDestroy(sphere[i]);
	}
}
Example #5
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
CollisionShape::~CollisionShape()
{
    if( m_geometryId != NULL )
    {
        dGeomDestroy( m_geometryId );
    }
}
Example #6
0
	std::vector<RaycastResult> & ODESimulator::internal_fireRay(const Rayr& r,
	        real length, const Solid* attachedSolid,
	        unsigned int rayContactGroup)
	{
		Point3r origin = r.getOrigin();
		Vec3r dir = r.getDir().unit();

		mRaycastResults.clear();
		mSensorSolid = attachedSolid;
		mRayContactGroup = rayContactGroup;

		// Create an ODE ray geom.  Make sure its user data pointer is
		// NULL because this is used in the collision callback to
		// distinguish the ray from other geoms.
		dGeomID rayGeomID = dCreateRay(mRootSpaceID, length);
		dGeomRaySet(rayGeomID, origin[0], origin[1], origin[2], dir[0],
		             dir[1], dir[2]);
		dGeomSetData(rayGeomID, NULL);

		// Check for collisions.  This will fill mRaycastResult with valid
		// data.  Its Solid pointer will remain NULL if nothing was hit.
		dSpaceCollide2(rayGeomID, (dGeomID) mRootSpaceID, this,
		                &ode_hidden::internal_raycastCollisionCallback);

		// Finished with ODE ray, so destroy it.
		dGeomDestroy(rayGeomID);

		return mRaycastResults;
	}
Example #7
0
void stop()
{
    dGeomDestroy(mesh_geom);
    dGeomTriMeshDataDestroy(mesh_data);

    dBodyDestroy(ball1_body);
    dBodyDestroy(ball2_body);

    dGeomDestroy(ground);

    dJointGroupDestroy(contact_group);

    dSpaceDestroy(space); // will destroy all geoms

    dWorldDestroy(world);
}
Example #8
0
void	CPHGeometryOwner::	DestroyGroupSpace()
{
	if(m_group){
		dGeomDestroy((dGeomID)m_group);
		m_group=NULL;
	}
}
Example #9
0
 void cPhysicsObject::DestroyGeom()
 {
   if (geom != NULL) {
     dGeomDestroy(geom);
     geom = NULL;
   }
 }
Example #10
0
void ComponentPhysicsGeom::load(const PropertyBag &data)
{
	resetMembers();

	desiredHeight = data.getFloat("height");
	collisionRadius = data.getFloat("radius");

	// Create as physics geometry
	if(geom){dGeomDestroy(geom);} geom=0;
	createGeom(data.getString("physicsGeometryType"));

	// Set initial position
	{
		vec3 position;
		if(data.get("position", position)) // optional tag
		{
			setPosition(position);
		}
	}

	// Declare the initial state
	getParentBlackBoard().relayMessage(MessagePositionHasBeenSet(getPosition()));
	getParentBlackBoard().relayMessage(MessageOrientationHasBeenSet(getOrientation()));
	getParentBlackBoard().relayMessage(MessageRequestSetHeight(desiredHeight));
}
Example #11
0
LaserBeam::~LaserBeam()
{
    dGeomDestroy(geom);
    dBodyDestroy(me);

    printf("Good bye....\n");
}
Example #12
0
//==============================================================================
OdeMesh::~OdeMesh()
{
  dGeomDestroy(mGeomId);

  if (mOdeTriMeshDataId)
    dGeomTriMeshDataDestroy(mOdeTriMeshDataId);
}
Example #13
0
Body* SimObjectRenderer::selectObject(const Vector3<>& projectedClick)
{
  if(&simObject != Simulation::simulation->scene)
    return nullptr;

  class Callback
  {
  public:
    Body* closestBody;
    float closestSqrDistance;
    const Vector3<>& cameraPos;

    Callback(const Vector3<>& cameraPos) : closestBody(0), cameraPos(cameraPos) {}

    static void staticCollisionCallback(Callback* callback, dGeomID geom1, dGeomID geom2)
    {
      ASSERT(!dGeomIsSpace(geom1));
      ASSERT(!dGeomIsSpace(geom2));
      ASSERT(dGeomGetBody(geom1) || dGeomGetBody(geom2));
      dContact contact[1];
      if(dCollide(geom1, geom2, 1, &contact[0].geom, sizeof(dContact)) < 1)
        return;

      dGeomID geom = geom2;
      dBodyID bodyId = dGeomGetBody(geom2);
      if(!bodyId)
      {
        bodyId = dGeomGetBody(geom1);
        geom = geom1;
      }
      const dReal* pos = dGeomGetPosition(geom);
      float sqrDistance = (Vector3<>((float) pos[0], (float) pos[1], (float) pos[2]) - callback->cameraPos).squareAbs();
      if(!callback->closestBody || sqrDistance < callback->closestSqrDistance)
      {
        callback->closestBody = (Body*)dBodyGetData(bodyId);
        callback->closestSqrDistance = sqrDistance;
      }
    }

    static void staticCollisionWithSpaceCallback(Callback* callback, dGeomID geom1, dGeomID geom2)
    {
      ASSERT(!dGeomIsSpace(geom1));
      ASSERT(dGeomIsSpace(geom2));
      dSpaceCollide2(geom1, geom2, callback, (dNearCallback*)&staticCollisionCallback);
    }
  };

  Callback callback(cameraPos);
  dGeomID ray = dCreateRay(Simulation::simulation->staticSpace, 10000.f);
  Vector3<> dir = projectedClick - cameraPos;
  dGeomRaySet(ray, cameraPos.x, cameraPos.y, cameraPos.z, dir.x, dir.y, dir.z);
  dSpaceCollide2(ray, (dGeomID)Simulation::simulation->movableSpace, &callback, (dNearCallback*)&Callback::staticCollisionWithSpaceCallback);
  dGeomDestroy(ray);

  if(!callback.closestBody)
    return nullptr;
  Body* body = callback.closestBody;
  return body->rootBody;
}
Example #14
0
MyODEGeom::~MyODEGeom() {
    if (mBody) {
        dBodyDestroy(mBody);
    }
    if (mODEGeom) {
        dGeomDestroy(mODEGeom);
    }
}
Example #15
0
File: dm6.cpp Project: Ry0/ODE
// ジオメトリのみの物体を破壊する関数。例:ブロック崩しのブロック等
void dmDestroyBox0(dmObject *obj)
{
	if (obj->geom != NULL)  // ジオメトリが存在していれば
	{
		dGeomDestroy(obj->geom); // ジオメトリを破壊
		obj->geom = NULL;            // ポインタにNULLを設定
	}
}
Example #16
0
void CShape::Detach()
{
	n_assert(IsAttached());
	n_assert(ODEGeomID);
	dGeomDestroy(ODEGeomID);
	ODEGeomID = NULL;
	ODESpaceID = NULL;
}
Example #17
0
ODE_Particle::~ODE_Particle()
{
    /*printf("Particle=%u destructor!\n",id);
    fflush(stdout);*/
        
    dBodyDestroy(body);
    dGeomDestroy(geom);   
}
CollidableObject::~CollidableObject()
{
	//Disconnect any objects in the scene
	mSceneNode->removeAndDestroyAllChildren();
	mSceneNode->getParentSceneNode()->removeAndDestroyChild(mSceneNode->getName());
	if(isInWorld)
		dGeomDestroy(mGeom);
}
Example #19
0
File: M3.cpp Project: jbongard/ISCS
void Simulator_Destroy(void) {

	dGeomDestroy(ground);
	dJointGroupDestroy (contactgroup);
	dSpaceDestroy (space);
	dWorldDestroy (world);
	dCloseODE();
}
 Primitive::~Primitive () {
   QMP_CRITICAL(8);
   // 20091023; guettler:
   // hack for tasked simulations; there are some problems if running in parallel mode,
   // if you do not destroy the geom, everything is fine (should be no problem because world is destroying geoms too)
   if(destroyGeom && geom) dGeomDestroy( geom );
   if(body && ((mode & _Transform) == 0) ) dBodyDestroy( body );
   QMP_END_CRITICAL(8);
 }
Example #21
0
void BoxObstacle::remove() {
	dGeomDestroy(boxGeom_);
	if (box_ != 0) {
		for(int i=0; i< dBodyGetNumJoints(box_); i++) {
			dJointDestroy(dBodyGetJoint(box_, i));
		}
		dBodyDestroy(box_);
	}
}
void CollidableObject::SetCollideShapeCapsule(dReal radius, dReal length)
{
	//Register a Capsule geom with ODE and link it to the collidable object
	if(isInWorld)
		dGeomDestroy(mGeom);
	mGeom = PhysWorld::GetSingletonPtr()->AddCapsule(radius, length);
	dGeomSetData(mGeom, (void*)this);
	isInWorld = true;
	Update(0.0f); //Ensure the geom's position and orientation match the attached scene node
}
void CollidableObject::SetCollideShapeBox(dReal lx, dReal ly, dReal lz)
{
	//Register a Box geom with ODE and link it to the collidable object
	if(isInWorld)
		dGeomDestroy(mGeom);
	mGeom = PhysWorld::GetSingletonPtr()->AddBox(lx, ly, lz);
	dGeomSetData(mGeom, (void*)this);
	isInWorld = true;
	Update(0.0f); //Ensure the geom's position and orientation match the attached scene node
}
Example #24
0
void IoODEPlane_free(IoODEPlane *self)
{
	if(GEOMID)
	{
		dGeomDestroy(GEOMID);
		GEOMID = 0;
	}

	free(IoObject_dataPointer(self));
}
Example #25
0
void Wheel::reset() {
  dSpaceID space = dGeomGetSpace(ph.geom);
  dGeomDestroy(ph.geom);
  dBodyDestroy(ph.body);

  Utils::Xml x(cst.xmlFile, "wheel");
  
  createPhysics(x, space);
  disposePhysics(x);
}
PhysicsActor::~PhysicsActor(){

if (joint>0)
    dJointDestroy(joint);
if (geom>0)
    dGeomDestroy(geom);
if (body>0)
    dBodyDestroy(body);

}
Example #27
0
OdeInit::~OdeInit()
{
    delete _wrld;
    delete _iCub;
    delete[] _controls;
    
    dGeomDestroy(ground);
    dJointGroupDestroy(contactgroup);
    dSpaceDestroy(space);
    dWorldDestroy(world);
}
Example #28
0
void TrackedVehicle::destroy() {
    this->leftTrack->destroy();
    dJointDestroy(this->leftTrackJoint);
    this->rightTrack->destroy();
    dJointDestroy(this->rightTrackJoint);

    dBodyDestroy(this->vehicleBody);
    dGeomDestroy(this->vehicleGeom);
    
    dRigidBodyArrayDestroy(this->bodyArray);
}
Example #29
0
Simulation::~Simulation()
{
	// delete everything

	dGeomDestroy(ground);

	delete car;
	dJointGroupDestroy(contactgroup);
	dSpaceDestroy(space);
	dWorldDestroy(world);
}
void CPHActivationShape::	Destroy	()
{
	VERIFY(m_geom&&m_body)				;
	spatial_unregister		()			;
	CPHObject::deactivate	()			;
	dGeomDestroyUserData	(m_geom)	;
	dGeomDestroy			(m_geom)	;
	m_geom					=NULL		;
	dBodyDestroy			(m_body)	;
	m_body					=NULL		;
}