//------------------------------------------------------------- //Crea un body estático con un fixture poligonal //------------------------------------------------------------- b2Body* PhysicManager::CreatePolyStaticBody(b2Vec2 *v, int n){ b2Body* body= CreateDynamicBody(); b2FixtureDef tri=CreatePolyFixtureDef(v,n,0.0f,0.0f,0.0f); body->CreateFixture(&tri); return body; }
//------------------------------------------------------------- //Crea un body dinámico con un fixture poligonal //------------------------------------------------------------- b2Body* PhysicManager::CreatePolyDynamicBody(b2Vec2 *v, int n,float density, float friction, float restitution){ b2Body* body= CreateDynamicBody(); b2FixtureDef tri=CreatePolyFixtureDef(v,n,density,friction,restitution); body->CreateFixture(&tri); return body; }
//------------------------------------------------------------- //Crea un body dinámico con un fixture triangular centrado en el origen //------------------------------------------------------------- b2Body* PhysicManager::CreateTriangularDynamicBody(b2Vec2 center, float h,float density, float friction, float restitution){ b2Body* body= CreateDynamicBody(); b2FixtureDef tri=CreateTriangularFixtureDef(center,h,density,friction,restitution); body->CreateFixture(&tri); return body; }
//------------------------------------------------------------- //Crea un body dinámico con un fixture rectangular centrado en el origen //------------------------------------------------------------- b2Body* PhysicManager::CreateRectangularDynamicBody(float sizeX, float sizeY, float density, float friction, float restitution){ b2Body* body= CreateDynamicBody(); b2FixtureDef box=CreateRectangularFixtureDef(sizeX,sizeY,density,friction,restitution); body->CreateFixture(&box); return body; }
//------------------------------------------------------------- //Crea un body dinámico con un fixture circular centrado en el origen //------------------------------------------------------------- b2Body* PhysicManager::CreateCircularDynamicBody(float radius, float density, float friction, float restitution){ b2Body* body= CreateDynamicBody(); b2FixtureDef cir=CreateCircularFixtureDef(radius,density,friction,restitution); body->CreateFixture(&cir); return body; }
void dgWorld::AddSentinelBody() { dgCollision* const collision = new (m_allocator) dgCollisionNull (m_allocator, 0x4352fe67); dgCollisionInstance* const instance = CreateInstance(collision, 0, dgGetIdentityMatrix()); collision->Release(); m_sentinelBody = CreateDynamicBody(instance, dgGetIdentityMatrix()); instance->Release(); }