GL - Creation of objects kinda sorted
This commit is contained in:
parent
121fd51c45
commit
bd739f8acb
|
@ -25,18 +25,19 @@ void Level::InitiateLevel(float radius)
|
|||
sbDesc.radius = 8; //radius;
|
||||
sbDesc.mass = 10e12f;
|
||||
//sbDesc.mass = 0; //10^16
|
||||
sbDesc.subscription_onCollisionResponse = Level::LevelCollision;
|
||||
levelObj = new StaticObject(OBJECT_TYPE::OBJECT_TYPE_WORLD);
|
||||
|
||||
|
||||
|
||||
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||
rigidBody->SetCustomTag(levelObj);
|
||||
API::Instance().AddObject(rigidBody);
|
||||
|
||||
ICustomBody::State state;
|
||||
rigidBody->GetState(state);
|
||||
state.SetRestitutionCoeff(0.1);
|
||||
rigidBody->SetState(state);
|
||||
|
||||
levelObj = new StaticObject(rigidBody, LevelCollision, OBJECT_TYPE::OBJECT_TYPE_WORLD);
|
||||
|
||||
API::Gravity gravityWell;
|
||||
|
||||
gravityWell.gravityType = API::Gravity::GravityType_Well;
|
||||
|
|
|
@ -49,6 +49,17 @@ Object::Object(void* collisionFunc, OBJECT_TYPE type)
|
|||
this->type = type;
|
||||
}
|
||||
|
||||
Object::Object(ICustomBody *rigidBody ,void* collisionFunc, OBJECT_TYPE type)
|
||||
{
|
||||
Oyster::Physics::API::Instance().AddObject(rigidBody);
|
||||
|
||||
rigidBody->SetSubscription((Oyster::Physics::ICustomBody::EventAction_Collision)(collisionFunc));
|
||||
|
||||
this->objectID = GID();
|
||||
|
||||
this->type = type;
|
||||
}
|
||||
|
||||
void Object::ApplyLinearImpulse(Oyster::Math::Float4 force)
|
||||
{
|
||||
setState.ApplyLinearImpulse(force);
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace GameLogic
|
|||
public:
|
||||
Object();
|
||||
Object(void* collisionFunc, OBJECT_TYPE type);
|
||||
Object(Oyster::Physics::ICustomBody *rigidBody ,void* collisionFunc, OBJECT_TYPE type);
|
||||
~Object(void);
|
||||
|
||||
OBJECT_TYPE GetType() const;
|
||||
|
|
|
@ -18,8 +18,6 @@ Player::Player()
|
|||
lookDir = Oyster::Math::Float4(0,0,-1,0);
|
||||
setState.SetCenterPosition(Oyster::Math::Float4(0,15,0,1));
|
||||
setState.SetReach(Oyster::Math::Float4(2,3.5,2,0));
|
||||
|
||||
|
||||
}
|
||||
|
||||
Player::~Player(void)
|
||||
|
|
|
@ -19,6 +19,11 @@ StaticObject::StaticObject(OBJECT_TYPE type)
|
|||
:Object(NULL,type)
|
||||
{
|
||||
|
||||
}
|
||||
StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody,void* collisionFunc, OBJECT_TYPE type)
|
||||
:Object(rigidBody,collisionFunc,type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace GameLogic
|
|||
public:
|
||||
StaticObject();
|
||||
StaticObject(void* collisionFunc, OBJECT_TYPE type);
|
||||
StaticObject(Oyster::Physics::ICustomBody *rigidBody,void* collisionFunc, OBJECT_TYPE type);
|
||||
StaticObject(OBJECT_TYPE type);
|
||||
~StaticObject(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue