GL - merge

This commit is contained in:
lindaandersson 2014-01-30 12:01:48 +01:00
commit 2a69af5c9f
7 changed files with 13 additions and 44 deletions

View File

@ -132,7 +132,7 @@ namespace DanBias
scale.v[0].x = 8;
scale.v[1].y = 8;
scale.v[2].z = 8;
world = world * scale;
//world = world * scale;
Protocol_ObjectPosition p(world, 0);
GameSession::gameSession->Send(p.GetProtocol());
}

View File

@ -24,39 +24,11 @@ using namespace GameLogic;
namespace DanBias
{
//TEST SHIT
GameAPI *game = &GameAPI::Instance();
DynamicArray<IPlayerData*> players;
//TEST SHIT
bool GameSession::DoWork( )
{
if(this->isRunning)
{
//TEST SHIT
//player creation and testing
//players.Resize(10);
//for(int i = 0; i < 10; i++)
//{
// players[i] = game->CreatePlayer();WWW
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_BACKWARD);
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_FORWARD);
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_JUMP);
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_LEFT);
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_RIGHT);
// //using weapon testing
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS);
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_PRIMARY_RELEASE);
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS);
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_SECONDARY_RELEASE);
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS);
//}
//TEST SHIT
double dt = this->timer.getElapsedSeconds();
gameInstance.SetFrameTimeLength((float)dt);

View File

@ -46,14 +46,12 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float dt)
{
//Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500 * dt);
Oyster::Math::Float3 weaponPos;
weaponPos = owner->GetPosition() + 5 * owner->GetLookDir();
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), weaponPos);
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition());
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));
int arg = 0;
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,NULL, ForcePushAction);
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&arg,ForcePushAction);
}
/********************************************************

View File

@ -20,6 +20,7 @@ using namespace GameLogic;
Player *player = ((Game::PlayerData*)(rigidBodyPlayer->GetCustomTag()))->player;
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
return;
switch (realObj->GetObjectType())
{
case OBJECT_TYPE::OBJECT_TYPE_GENERIC:
@ -78,9 +79,9 @@ using namespace GameLogic;
return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
}
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void* args)
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void *args)
{
Oyster::Math::Float3 pushForce = Oyster::Math::Float4(1,0,0) * (20);
Oyster::Math::Float3 pushForce = Oyster::Math::Float4(1,0,0) * (1);
Oyster::Physics::ICustomBody::State state;
state = obj->GetState();
state.ApplyLinearImpulse(pushForce);

View File

@ -7,7 +7,7 @@ Game::PlayerData::PlayerData()
{
//set some stats that are appropriate to a player
Oyster::Physics::API::SimpleBodyDescription sbDesc;
sbDesc.centerPosition = Oyster::Math::Float3(0,15,0);
sbDesc.centerPosition = Oyster::Math::Float3(0,165,0);
sbDesc.size = Oyster::Math::Float3(4,7,4);
//create rigid body

View File

@ -25,7 +25,7 @@ void Level::InitiateLevel(float radius)
API::SphericalBodyDescription sbDesc;
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
sbDesc.ignoreGravity = true;
sbDesc.radius = 8;
sbDesc.radius = 150;
sbDesc.mass = 10e12f;
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
@ -59,7 +59,7 @@ void Level::InitiateLevel(float radius)
// add gravitation
API::Gravity gravityWell;
gravityWell.gravityType = API::Gravity::GravityType_Well;
gravityWell.well.mass = 10e12f;
gravityWell.well.mass = 10e16f;
gravityWell.well.position = Oyster::Math::Float4(0,0,0,1);
API::Instance().AddGravity(gravityWell);
}

View File

@ -95,16 +95,14 @@ void Player::MoveBackwards()
void Player::MoveRight()
{
//Do cross product with forward vector and negative gravity vector
Oyster::Math::Float3 r = Oyster::Math::Float4(1, 0, 0);
//Oyster::Math::Float4 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir);
Oyster::Math::Float3 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir);
setState.ApplyLinearImpulse(r * 20 * this->gameInstance->GetFrameTime());
}
void Player::MoveLeft()
{
//Do cross product with forward vector and negative gravity vector
Oyster::Math::Float3 r = Oyster::Math::Float4(1, 0, 0 );
//Oyster::Math::Float4 r1 = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); //Still get zero
Oyster::Math::Float3 r = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); //Still get zero
setState.ApplyLinearImpulse(-r * 20 * this->gameInstance->GetFrameTime());
}