GL - explosive crate testing
This commit is contained in:
parent
bab3af787c
commit
25b0162b59
|
@ -95,8 +95,28 @@ using namespace GameLogic;
|
||||||
{
|
{
|
||||||
int forceThreashHold = 200000; //how much force for the box to explode of the impact
|
int forceThreashHold = 200000; //how much force for the box to explode of the impact
|
||||||
|
|
||||||
|
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
|
||||||
|
|
||||||
if(kineticEnergyLoss > forceThreashHold)
|
switch (realObj->GetObjectType())
|
||||||
|
{
|
||||||
|
case ObjectSpecialType::ObjectSpecialType_Generic:
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType::ObjectSpecialType_StandardBox:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ObjectSpecialType::ObjectSpecialType_Player:
|
||||||
|
ExplosiveCrate* crate = ((ExplosiveCrate*)rigidBodyCrate->GetCustomTag());
|
||||||
|
|
||||||
|
|
||||||
|
Oyster::Math::Float3 pos = rigidBodyCrate->GetState().centerPos;
|
||||||
|
Oyster::Collision3D::Sphere *hitSphere = new Oyster::Collision3D::Sphere(pos,crate->ExplosionRadius);
|
||||||
|
|
||||||
|
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,crate,Explode);
|
||||||
|
|
||||||
|
delete hitSphere;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*if(kineticEnergyLoss > forceThreashHold)
|
||||||
{
|
{
|
||||||
ExplosiveCrate* crate = ((ExplosiveCrate*)rigidBodyCrate->GetCustomTag());
|
ExplosiveCrate* crate = ((ExplosiveCrate*)rigidBodyCrate->GetCustomTag());
|
||||||
|
|
||||||
|
@ -107,7 +127,7 @@ using namespace GameLogic;
|
||||||
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,crate,Explode);
|
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,crate,Explode);
|
||||||
|
|
||||||
delete hitSphere;
|
delete hitSphere;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExplosiveCrate::Explode(Oyster::Physics::ICustomBody *obj, void* args)
|
void ExplosiveCrate::Explode(Oyster::Physics::ICustomBody *obj, void* args)
|
||||||
|
@ -123,7 +143,7 @@ using namespace GameLogic;
|
||||||
{
|
{
|
||||||
Player *hitPlayer = (Player*)realObj;
|
Player *hitPlayer = (Player*)realObj;
|
||||||
|
|
||||||
hitPlayer->DamageLife(ExplosionSource->getExtraDamageOnCollision());
|
//hitPlayer->DamageLife(ExplosionSource->getExtraDamageOnCollision());
|
||||||
//do shredding damage
|
//do shredding damage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,12 @@ Game::PlayerData::PlayerData()
|
||||||
//sbDesc.quaternion = Oyster::Math::Float3(0, Oyster::Math::pi, 0);
|
//sbDesc.quaternion = Oyster::Math::Float3(0, Oyster::Math::pi, 0);
|
||||||
|
|
||||||
//create rigid body
|
//create rigid body
|
||||||
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCharacter(2.0f, 0.5f, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
||||||
rigidBody->SetAngularFactor(0.0f);
|
rigidBody->SetAngularFactor(0.0f);
|
||||||
//create player with this rigid body
|
//create player with this rigid body
|
||||||
this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player,0,0);
|
this->player = new Player(rigidBody, Player::PlayerCollision, ObjectSpecialType_Player,0,0);
|
||||||
|
|
||||||
this->player->GetRigidBody()->SetCustomTag(this);
|
//this->player->GetRigidBody()->SetCustomTag(this);
|
||||||
player->EndFrame();
|
player->EndFrame();
|
||||||
}
|
}
|
||||||
Game::PlayerData::PlayerData(int playerID,int teamID)
|
Game::PlayerData::PlayerData(int playerID,int teamID)
|
||||||
|
|
|
@ -57,11 +57,7 @@ Object* Level::createGameObj(ObjectHeader* obj, ICustomBody* rigidBody)
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_StandardBox:
|
case ObjectSpecialType_StandardBox:
|
||||||
{
|
{
|
||||||
int dmg = 50;
|
gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
|
||||||
Oyster::Math::Float force = 50;
|
|
||||||
int radie = 10;
|
|
||||||
gameObj = new ExplosiveCrate(rigidBody, (ObjectSpecialType)obj->specialTypeID, objID++, dmg, force, radie);
|
|
||||||
//gameObj = new DynamicObject(rigidBody, Object::DefaultCollisionAfter, (ObjectSpecialType)obj->specialTypeID, objID++);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ObjectSpecialType_RedExplosiveBox:
|
case ObjectSpecialType_RedExplosiveBox:
|
||||||
|
|
|
@ -17,20 +17,6 @@ Player::Player()
|
||||||
Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID)
|
Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID)
|
||||||
:DynamicObject(rigidBody, EventOnCollision, type, objectID)
|
:DynamicObject(rigidBody, EventOnCollision, type, objectID)
|
||||||
{
|
{
|
||||||
this->rigidBody = rigidBody;
|
|
||||||
|
|
||||||
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(0,400,0);
|
|
||||||
|
|
||||||
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,1.0f,0.5f);
|
|
||||||
Oyster::Math::Float mass = 60;
|
|
||||||
Oyster::Math::Float restitutionCoeff = 0.5;
|
|
||||||
Oyster::Math::Float frictionCoeff_Static = 0.4;
|
|
||||||
Oyster::Math::Float frictionCoeff_Dynamic = 0.3;
|
|
||||||
|
|
||||||
|
|
||||||
this->rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
|
||||||
this->rigidBody->SetAngularFactor(0.0f);
|
|
||||||
|
|
||||||
weapon = new Weapon(2,this);
|
weapon = new Weapon(2,this);
|
||||||
|
|
||||||
this->life = 100;
|
this->life = 100;
|
||||||
|
@ -52,20 +38,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)
|
||||||
Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID)
|
Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID)
|
||||||
:DynamicObject(rigidBody, EventOnCollision, type, objectID)
|
:DynamicObject(rigidBody, EventOnCollision, type, objectID)
|
||||||
{
|
{
|
||||||
this->rigidBody = rigidBody;
|
|
||||||
|
|
||||||
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(0,400,0);
|
|
||||||
|
|
||||||
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,1.0f,0.5f);
|
|
||||||
Oyster::Math::Float mass = 60;
|
|
||||||
Oyster::Math::Float restitutionCoeff = 0.5;
|
|
||||||
Oyster::Math::Float frictionCoeff_Static = 0.4;
|
|
||||||
Oyster::Math::Float frictionCoeff_Dynamic = 0.3;
|
|
||||||
|
|
||||||
|
|
||||||
this->rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
|
||||||
this->rigidBody->SetAngularFactor(0.0f);
|
|
||||||
|
|
||||||
weapon = new Weapon(2,this);
|
weapon = new Weapon(2,this);
|
||||||
|
|
||||||
this->life = 100;
|
this->life = 100;
|
||||||
|
@ -81,7 +53,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustom
|
||||||
this->moveDir = Oyster::Math::Float3(0,0,0);
|
this->moveDir = Oyster::Math::Float3(0,0,0);
|
||||||
this->moveSpeed = 100;
|
this->moveSpeed = 100;
|
||||||
this->previousMoveSpeed = Oyster::Math::Float3(0,0,0);
|
this->previousMoveSpeed = Oyster::Math::Float3(0,0,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player(void)
|
Player::~Player(void)
|
||||||
|
|
Loading…
Reference in New Issue