changes in massdriver

This commit is contained in:
Erik Persson 2014-02-12 14:00:53 +01:00
parent 8f627f8a71
commit b95e1d6b7a
2 changed files with 9 additions and 14 deletions

View File

@ -60,17 +60,18 @@ void AttatchmentMassDriver::Update(float dt)
//update position of heldObject if there is an object being held //update position of heldObject if there is an object being held
if(hasObject) if(hasObject)
{ {
Oyster::Physics::ICustomBody::State state; //Oyster::Physics::ICustomBody::State state;
state = heldObject->GetState(); //state = heldObject->GetState();
Oyster::Math::Float3 ownerPos = owner->GetPosition(); Oyster::Math::Float3 ownerPos = owner->GetPosition();
Oyster::Physics::ICustomBody::State ownerState = owner->GetRigidBody()->GetState(); Oyster::Physics::ICustomBody::State ownerState = owner->GetRigidBody()->GetState();
Oyster::Math::Float3 up = -ownerState.GetOrientation().v[2]; Oyster::Math::Float3 up = -ownerState.GetOrientation().v[2];
up *= -0.3; up *= -0.3;
Oyster::Math::Float3 pos = ownerPos + up + (owner->GetLookDir().GetNormalized()*10); Oyster::Math::Float3 pos = ownerPos + (owner->GetLookDir().GetNormalized()*5);
state.centerPos = pos; //state.centerPos = pos;
heldObject->SetPosition(pos);
heldObject->SetState(state); //heldObject->SetState(state);
} }
} }
@ -86,10 +87,8 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
if(hasObject) if(hasObject)
{ {
Oyster::Physics::API::Instance().ReleaseFromLimbo(heldObject); Oyster::Physics::API::Instance().ReleaseFromLimbo(heldObject);
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (700); pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (100);
Oyster::Physics::ICustomBody::State state = heldObject->GetState(); heldObject->ApplyImpulse((Oyster::Math::Float3)pushForce);
//state.ApplyLinearImpulse((Oyster::Math::Float3)pushForce);
heldObject->SetState(state);
hasObject = false; hasObject = false;
heldObject = NULL; heldObject = NULL;

View File

@ -40,10 +40,6 @@ using namespace GameLogic;
PlayerVObject(*player,*realObj, kineticEnergyLoss); PlayerVObject(*player,*realObj, kineticEnergyLoss);
//player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING; //player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
break; break;
case OBJECT_TYPE::OBJECT_TYPE_JUMPPAD:
int i = 0;
// JUMP
break;
} }
//return Physics::ICustomBody::SubscriptMessage_none; //return Physics::ICustomBody::SubscriptMessage_none;
@ -144,7 +140,7 @@ using namespace GameLogic;
{ {
case OBJECT_TYPE::OBJECT_TYPE_BOX: case OBJECT_TYPE::OBJECT_TYPE_BOX:
//move obj to limbo in physics to make sure it wont collide with anything //move obj to limbo in physics to make sure it wont collide with anything
Oyster::Physics::API::Instance().MoveToLimbo(obj); // Oyster::Physics::API::Instance().MoveToLimbo(obj);
weapon->heldObject = obj; //weapon now holds the object weapon->heldObject = obj; //weapon now holds the object
weapon->hasObject = true; weapon->hasObject = true;