GameLogic - making sure GameLogic uses the new physics api
This commit is contained in:
parent
52ba5602d5
commit
586031aa94
|
@ -23,6 +23,8 @@ Object::Object()
|
||||||
this->objectID = GID();
|
this->objectID = GID();
|
||||||
|
|
||||||
this->type = OBJECT_TYPE::OBJECT_TYPE_UNKNOWN;
|
this->type = OBJECT_TYPE::OBJECT_TYPE_UNKNOWN;
|
||||||
|
|
||||||
|
rigidBody->GetState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::Object(void* collisionFunc, OBJECT_TYPE type)
|
Object::Object(void* collisionFunc, OBJECT_TYPE type)
|
||||||
|
@ -40,6 +42,8 @@ Object::Object(void* collisionFunc, OBJECT_TYPE type)
|
||||||
this->objectID = GID();
|
this->objectID = GID();
|
||||||
|
|
||||||
this->type = type;
|
this->type = type;
|
||||||
|
|
||||||
|
rigidBody->GetState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,15 +9,8 @@
|
||||||
|
|
||||||
#include "GameLogicStates.h"
|
#include "GameLogicStates.h"
|
||||||
#include "GameLogicDef.h"
|
#include "GameLogicDef.h"
|
||||||
|
#include <PhysicsAPI.h>
|
||||||
|
|
||||||
namespace Oyster
|
|
||||||
{
|
|
||||||
namespace Physics
|
|
||||||
{
|
|
||||||
class ICustomBody;
|
|
||||||
class State;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
class DANBIAS_GAMELOGIC_DLL Object
|
class DANBIAS_GAMELOGIC_DLL Object
|
||||||
|
@ -37,7 +30,7 @@ namespace GameLogic
|
||||||
int objectID;
|
int objectID;
|
||||||
protected:
|
protected:
|
||||||
Oyster::Physics::ICustomBody *rigidBody;
|
Oyster::Physics::ICustomBody *rigidBody;
|
||||||
Oyster::Physics::ICustomBody::State *state;
|
Oyster::Physics::ICustomBody::State state;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct Player::PrivateData
|
||||||
teamID = -1;
|
teamID = -1;
|
||||||
playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
|
|
||||||
lookDir = Oyster::Math::Float4(1,0,0);
|
lookDir = Oyster::Math::Float4(1,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
~PrivateData()
|
~PrivateData()
|
||||||
|
@ -75,23 +75,23 @@ void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||||
|
|
||||||
void Player::MoveForward()
|
void Player::MoveForward()
|
||||||
{
|
{
|
||||||
state->ApplyLinearImpulse(myData->lookDir * 100);
|
state.ApplyLinearImpulse(myData->lookDir * 100);
|
||||||
}
|
}
|
||||||
void Player::MoveBackwards()
|
void Player::MoveBackwards()
|
||||||
{
|
{
|
||||||
state->ApplyLinearImpulse(-myData->lookDir * 100);
|
state.ApplyLinearImpulse(-myData->lookDir * 100);
|
||||||
}
|
}
|
||||||
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::Float4 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)myData->lookDir);
|
Oyster::Math::Float4 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)myData->lookDir);
|
||||||
state->ApplyLinearImpulse(r * 100);
|
state.ApplyLinearImpulse(r * 100);
|
||||||
}
|
}
|
||||||
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::Float4 r = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)myData->lookDir);
|
Oyster::Math::Float4 r = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)myData->lookDir);
|
||||||
state->ApplyLinearImpulse(-r * 100);
|
state.ApplyLinearImpulse(-r * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::UseWeapon(const WEAPON_FIRE &fireInput)
|
void Player::UseWeapon(const WEAPON_FIRE &fireInput)
|
||||||
|
@ -101,7 +101,7 @@ void Player::UseWeapon(const WEAPON_FIRE &fireInput)
|
||||||
|
|
||||||
void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
||||||
{
|
{
|
||||||
//API::Instance().SetCenter(rigidBody,spawnPoint);
|
|
||||||
myData->life = 100;
|
myData->life = 100;
|
||||||
myData->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
myData->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
myData->lookDir = Oyster::Math::Float4(1,0,0);
|
myData->lookDir = Oyster::Math::Float4(1,0,0);
|
||||||
|
@ -109,7 +109,7 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
||||||
|
|
||||||
void Player::Jump()
|
void Player::Jump()
|
||||||
{
|
{
|
||||||
//API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),-Oyster::Math::Float3(0,1,0) * 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::IsWalking()
|
bool Player::IsWalking()
|
||||||
|
@ -127,8 +127,7 @@ bool Player::IsIdle()
|
||||||
|
|
||||||
Oyster::Math::Float3 Player::GetPos()
|
Oyster::Math::Float3 Player::GetPos()
|
||||||
{
|
{
|
||||||
//return rigidBody->GetCenter();
|
return (Oyster::Math::Float3)state.GetCenterPosition();
|
||||||
return Oyster::Math::Float3(0,0,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Oyster::Math::Float3 Player::GetLookDir()
|
Oyster::Math::Float3 Player::GetLookDir()
|
||||||
|
|
|
@ -35,8 +35,6 @@ namespace GameLogic
|
||||||
|
|
||||||
int GetCurrentSocketID();
|
int GetCurrentSocketID();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
PrivateData *myData;
|
PrivateData *myData;
|
||||||
|
|
Loading…
Reference in New Issue