Merge branch 'GameLogic' of https://github.com/dean11/Danbias into GameLogic
This commit is contained in:
commit
e3376eba7c
|
@ -46,7 +46,11 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
|
||||||
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float dt)
|
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float dt)
|
||||||
{
|
{
|
||||||
//Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500 * dt);
|
//Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500 * dt);
|
||||||
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition());
|
|
||||||
|
Oyster::Math::Float3 look = owner->GetLookDir();
|
||||||
|
Oyster::Math::Float3 up = -owner->GetRigidBody()->GetGravityNormal();
|
||||||
|
Oyster::Math::Float3 pos = owner->GetPosition();
|
||||||
|
Oyster::Math::Float4x4 aim = Oyster::Math3D::OrientationMatrix_LookAtDirection(owner->GetLookDir(), -owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition());
|
||||||
Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/4,1,1,20);
|
Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/4,1,1,20);
|
||||||
Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace));
|
Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace));
|
||||||
int arg = 0;
|
int arg = 0;
|
||||||
|
|
|
@ -20,7 +20,6 @@ using namespace GameLogic;
|
||||||
Player *player = ((Game::PlayerData*)(rigidBodyPlayer->GetCustomTag()))->player;
|
Player *player = ((Game::PlayerData*)(rigidBodyPlayer->GetCustomTag()))->player;
|
||||||
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
|
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
|
||||||
|
|
||||||
return;
|
|
||||||
switch (realObj->GetObjectType())
|
switch (realObj->GetObjectType())
|
||||||
{
|
{
|
||||||
case OBJECT_TYPE::OBJECT_TYPE_GENERIC:
|
case OBJECT_TYPE::OBJECT_TYPE_GENERIC:
|
||||||
|
@ -69,6 +68,10 @@ using namespace GameLogic;
|
||||||
{
|
{
|
||||||
return Physics::ICustomBody::SubscriptMessage_none;
|
return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
}
|
}
|
||||||
|
Oyster::Physics::ICustomBody::SubscriptMessage Object::DefaultCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
||||||
|
{
|
||||||
|
return Physics::ICustomBody::SubscriptMessage_none;
|
||||||
|
}
|
||||||
//Oyster::Physics::ICustomBody::SubscriptMessage
|
//Oyster::Physics::ICustomBody::SubscriptMessage
|
||||||
Oyster::Physics::ICustomBody::SubscriptMessage Level::LevelCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj)
|
Oyster::Physics::ICustomBody::SubscriptMessage Level::LevelCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,9 +7,9 @@ Game::PlayerData::PlayerData()
|
||||||
{
|
{
|
||||||
//set some stats that are appropriate to a player
|
//set some stats that are appropriate to a player
|
||||||
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
||||||
sbDesc.centerPosition = Oyster::Math::Float3(0,320,0);
|
sbDesc.centerPosition = Oyster::Math::Float3(10,350,0);
|
||||||
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
||||||
sbDesc.mass = 10;
|
sbDesc.mass = 70;
|
||||||
//create rigid body
|
//create rigid body
|
||||||
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
|
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
|
|
||||||
|
|
|
@ -41,18 +41,18 @@ void Level::InitiateLevel(float radius)
|
||||||
|
|
||||||
// add box
|
// add box
|
||||||
API::SimpleBodyDescription sbDesc_TestBox;
|
API::SimpleBodyDescription sbDesc_TestBox;
|
||||||
sbDesc_TestBox.centerPosition = Oyster::Math::Float4(4,320,0,0);
|
sbDesc_TestBox.centerPosition = Oyster::Math::Float4(0,320,0,0);
|
||||||
sbDesc_TestBox.ignoreGravity = false;
|
sbDesc_TestBox.ignoreGravity = false;
|
||||||
sbDesc_TestBox.mass = 10;
|
sbDesc_TestBox.mass = 50;
|
||||||
sbDesc_TestBox.size = Oyster::Math::Float4(0.5f,0.5f,0.5f,0);
|
sbDesc_TestBox.size = Oyster::Math::Float4(1,1,1,0);
|
||||||
|
|
||||||
ICustomBody* rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release();
|
ICustomBody* rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release();
|
||||||
rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel);
|
rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel);
|
||||||
|
|
||||||
testBox = new DynamicObject(rigidBody_TestBox, OBJECT_TYPE::OBJECT_TYPE_BOX);
|
testBox = new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX);
|
||||||
rigidBody_TestBox->SetCustomTag(testBox);
|
rigidBody_TestBox->SetCustomTag(testBox);
|
||||||
rigidBody_TestBox->GetState(state);
|
rigidBody_TestBox->GetState(state);
|
||||||
state.ApplyLinearImpulse(Oyster::Math::Float3(0,20,0));
|
state.ApplyLinearImpulse(Oyster::Math::Float3(0,0,0));
|
||||||
rigidBody_TestBox->SetState(state);
|
rigidBody_TestBox->SetState(state);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace GameLogic
|
||||||
void setAfterCollisonFunc(Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss));
|
void setAfterCollisonFunc(Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss));
|
||||||
|
|
||||||
static Oyster::Physics::ICustomBody::SubscriptMessage DefaultCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj);
|
static Oyster::Physics::ICustomBody::SubscriptMessage DefaultCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj);
|
||||||
|
static Oyster::Physics::ICustomBody::SubscriptMessage DefaultCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
||||||
private:
|
private:
|
||||||
OBJECT_TYPE type;
|
OBJECT_TYPE type;
|
||||||
int objectID;
|
int objectID;
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace
|
||||||
ICustomBody::State protoState; proto->GetState( protoState );
|
ICustomBody::State protoState; proto->GetState( protoState );
|
||||||
ICustomBody::State deuterState; deuter->GetState( deuterState );
|
ICustomBody::State deuterState; deuter->GetState( deuterState );
|
||||||
|
|
||||||
Float4 protoG = protoState.GetLinearMomentum( worldPointOfContact.xyz ),
|
Float4 protoG = protoState.GetLinearMomentum(worldPointOfContact.xyz ),
|
||||||
deuterG = deuterState.GetLinearMomentum( worldPointOfContact.xyz );
|
deuterG = deuterState.GetLinearMomentum( worldPointOfContact.xyz );
|
||||||
|
|
||||||
// calc from perspective of deuter
|
// calc from perspective of deuter
|
||||||
|
|
Loading…
Reference in New Issue