GL - merge
This commit is contained in:
commit
2a69af5c9f
|
@ -132,7 +132,7 @@ namespace DanBias
|
||||||
scale.v[0].x = 8;
|
scale.v[0].x = 8;
|
||||||
scale.v[1].y = 8;
|
scale.v[1].y = 8;
|
||||||
scale.v[2].z = 8;
|
scale.v[2].z = 8;
|
||||||
world = world * scale;
|
//world = world * scale;
|
||||||
Protocol_ObjectPosition p(world, 0);
|
Protocol_ObjectPosition p(world, 0);
|
||||||
GameSession::gameSession->Send(p.GetProtocol());
|
GameSession::gameSession->Send(p.GetProtocol());
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,39 +24,11 @@ using namespace GameLogic;
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
//TEST SHIT
|
|
||||||
GameAPI *game = &GameAPI::Instance();
|
|
||||||
DynamicArray<IPlayerData*> players;
|
|
||||||
|
|
||||||
//TEST SHIT
|
|
||||||
|
|
||||||
bool GameSession::DoWork( )
|
bool GameSession::DoWork( )
|
||||||
{
|
{
|
||||||
if(this->isRunning)
|
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();
|
double dt = this->timer.getElapsedSeconds();
|
||||||
gameInstance.SetFrameTimeLength((float)dt);
|
gameInstance.SetFrameTimeLength((float)dt);
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,12 @@ 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::Float3 weaponPos;
|
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition());
|
||||||
weaponPos = owner->GetPosition() + 5 * owner->GetLookDir();
|
|
||||||
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), weaponPos);
|
|
||||||
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;
|
||||||
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,NULL, ForcePushAction);
|
|
||||||
|
|
||||||
|
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&arg,ForcePushAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
|
|
|
@ -20,6 +20,7 @@ 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:
|
||||||
|
@ -78,12 +79,12 @@ using namespace GameLogic;
|
||||||
return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
|
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;
|
Oyster::Physics::ICustomBody::State state;
|
||||||
state = obj->GetState();
|
state = obj->GetState();
|
||||||
state.ApplyLinearImpulse(pushForce);
|
state.ApplyLinearImpulse(pushForce);
|
||||||
obj->SetState(state);
|
obj->SetState(state);
|
||||||
//((Object*)obj->GetCustomTag())->ApplyLinearImpulse(pushForce);
|
//((Object*)obj->GetCustomTag())->ApplyLinearImpulse(pushForce);
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ 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,15,0);
|
sbDesc.centerPosition = Oyster::Math::Float3(0,165,0);
|
||||||
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
||||||
|
|
||||||
//create rigid body
|
//create rigid body
|
||||||
|
|
|
@ -25,7 +25,7 @@ void Level::InitiateLevel(float radius)
|
||||||
API::SphericalBodyDescription sbDesc;
|
API::SphericalBodyDescription sbDesc;
|
||||||
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
|
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
|
||||||
sbDesc.ignoreGravity = true;
|
sbDesc.ignoreGravity = true;
|
||||||
sbDesc.radius = 8;
|
sbDesc.radius = 150;
|
||||||
sbDesc.mass = 10e12f;
|
sbDesc.mass = 10e12f;
|
||||||
|
|
||||||
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
|
@ -59,7 +59,7 @@ void Level::InitiateLevel(float radius)
|
||||||
// add gravitation
|
// add gravitation
|
||||||
API::Gravity gravityWell;
|
API::Gravity gravityWell;
|
||||||
gravityWell.gravityType = API::Gravity::GravityType_Well;
|
gravityWell.gravityType = API::Gravity::GravityType_Well;
|
||||||
gravityWell.well.mass = 10e12f;
|
gravityWell.well.mass = 10e16f;
|
||||||
gravityWell.well.position = Oyster::Math::Float4(0,0,0,1);
|
gravityWell.well.position = Oyster::Math::Float4(0,0,0,1);
|
||||||
API::Instance().AddGravity(gravityWell);
|
API::Instance().AddGravity(gravityWell);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,16 +95,14 @@ void Player::MoveBackwards()
|
||||||
void Player::MoveRight()
|
void Player::MoveRight()
|
||||||
{
|
{
|
||||||
//Do cross product with forward vector and negative gravity vector
|
//Do cross product with forward vector and negative gravity vector
|
||||||
Oyster::Math::Float3 r = Oyster::Math::Float4(1, 0, 0);
|
Oyster::Math::Float3 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir);
|
||||||
//Oyster::Math::Float4 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir);
|
|
||||||
setState.ApplyLinearImpulse(r * 20 * this->gameInstance->GetFrameTime());
|
setState.ApplyLinearImpulse(r * 20 * this->gameInstance->GetFrameTime());
|
||||||
|
|
||||||
}
|
}
|
||||||
void Player::MoveLeft()
|
void Player::MoveLeft()
|
||||||
{
|
{
|
||||||
//Do cross product with forward vector and negative gravity vector
|
//Do cross product with forward vector and negative gravity vector
|
||||||
Oyster::Math::Float3 r = Oyster::Math::Float4(1, 0, 0 );
|
Oyster::Math::Float3 r = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); //Still get zero
|
||||||
//Oyster::Math::Float4 r1 = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); //Still get zero
|
|
||||||
setState.ApplyLinearImpulse(-r * 20 * this->gameInstance->GetFrameTime());
|
setState.ApplyLinearImpulse(-r * 20 * this->gameInstance->GetFrameTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue