GL - adjusting in GL, added forcepushData struct for passing args when shooting. connect changes in network
This commit is contained in:
parent
4df6b849a6
commit
16a342da49
|
@ -91,8 +91,8 @@ GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* Key
|
|||
|
||||
if( KeyInput->IsKeyPressed(DIK_G))
|
||||
{
|
||||
if(!DanBias::GameServerAPI::GameStart())
|
||||
return GameClientState::ClientState_Same;
|
||||
//if(!DanBias::GameServerAPI::GameStart())
|
||||
//return GameClientState::ClientState_Same;
|
||||
return ClientState_Game;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ GameClientState::ClientState LoginState::Update(float deltaTime, InputClass* Key
|
|||
if( KeyInput->IsKeyPressed(DIK_J))
|
||||
{
|
||||
// game ip
|
||||
nwClient->Connect(15151, "194.47.150.56");
|
||||
nwClient->Connect(15151, "193.11.184.109");
|
||||
|
||||
if (!nwClient->IsConnected())
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "AttatchmentMassDriver.h"
|
||||
#include "PhysicsAPI.h"
|
||||
#include "GameLogicStates.h"
|
||||
|
||||
using namespace GameLogic;
|
||||
|
||||
|
@ -45,13 +46,14 @@ 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::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::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;
|
||||
forcePushData args;
|
||||
args.pushForce = pushForce;
|
||||
|
||||
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&arg,ForcePushAction);
|
||||
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction);
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
|
|
|
@ -81,20 +81,13 @@ using namespace GameLogic;
|
|||
|
||||
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void *args)
|
||||
{
|
||||
Oyster::Math::Float3 pushForce = Oyster::Math::Float4(1,0,0) * (500);
|
||||
Oyster::Physics::ICustomBody::State state;
|
||||
Object *realObj = (Object*)obj->GetCustomTag();
|
||||
if(realObj->GetObjectType() == OBJECT_TYPE_BOX)
|
||||
{
|
||||
state = obj->GetState();
|
||||
state.SetOrientation(Oyster::Math::Float3(1,0.5,1),Oyster::Math::Float3(1,0.5,1));
|
||||
obj->SetState(state);
|
||||
}
|
||||
|
||||
if(realObj->GetObjectType() == OBJECT_TYPE_PLAYER || realObj->GetObjectType() == OBJECT_TYPE_WORLD)
|
||||
return;
|
||||
|
||||
state = obj->GetState();
|
||||
state.ApplyLinearImpulse(pushForce);
|
||||
state.ApplyLinearImpulse(((forcePushData*)(args))->pushForce);
|
||||
obj->SetState(state);
|
||||
//((Object*)obj->GetCustomTag())->ApplyLinearImpulse(pushForce);
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef GAMELOGICSTATES_H
|
||||
#define GAMELOGICSTATES_H
|
||||
#include "OysterMath.h"
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
@ -46,6 +47,12 @@ namespace GameLogic
|
|||
WEAPON_STATE_RELOADING = 2,
|
||||
};
|
||||
|
||||
struct forcePushData
|
||||
{
|
||||
Oyster::Math::Float3 pushForce;
|
||||
};
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ Game::PlayerData::PlayerData()
|
|||
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
||||
sbDesc.centerPosition = Oyster::Math::Float3(0,320,0);
|
||||
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
||||
sbDesc.mass = 10;
|
||||
sbDesc.mass = 90;
|
||||
//create rigid body
|
||||
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ void Level::InitiateLevel(float radius)
|
|||
sbDesc_TestBox.centerPosition = Oyster::Math::Float4(4,320,0,0);
|
||||
sbDesc_TestBox.ignoreGravity = false;
|
||||
sbDesc_TestBox.mass = 10;
|
||||
sbDesc_TestBox.size = Oyster::Math::Float4(0.5f,0.5f,0.5f,0);
|
||||
sbDesc_TestBox.size = Oyster::Math::Float4(4,4,4,0);
|
||||
|
||||
ICustomBody* rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release();
|
||||
rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel);
|
||||
|
|
Loading…
Reference in New Issue