Merge remote-tracking branch 'origin/New-inputsystem' into PlayerRunEdits
Conflicts: Code/Game/GameClient/GameClientState/GameState.cpp Code/Game/GameClient/GameClientState/GamingUI.cpp Code/Game/GameLogic/GameAPI.h Code/Game/GameLogic/Player.cpp Code/Game/GameLogic/Player.h Code/Game/GameServer/GameSession.h Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp Code/Physics/GamePhysics/Implementation/SimpleRigidBody.cpp Code/Physics/GamePhysics/Implementation/SimpleRigidBody.h
This commit is contained in:
commit
96cb865242
|
@ -752,6 +752,7 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
||||||
player = (this->privData->players)[decoded.objectID];
|
player = (this->privData->players)[decoded.objectID];
|
||||||
|
|
||||||
if( player )
|
if( player )
|
||||||
|
<<<<<<< HEAD
|
||||||
{
|
{
|
||||||
if( this->privData->myId == decoded.objectID )
|
if( this->privData->myId == decoded.objectID )
|
||||||
{
|
{
|
||||||
|
@ -820,6 +821,76 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
||||||
}
|
}
|
||||||
if( object )
|
if( object )
|
||||||
{
|
{
|
||||||
|
=======
|
||||||
|
{
|
||||||
|
if( this->privData->myId == decoded.objectID )
|
||||||
|
{
|
||||||
|
// dont delete my player
|
||||||
|
}
|
||||||
|
if( player )
|
||||||
|
{
|
||||||
|
player->SetVisible(false);
|
||||||
|
(this->privData->players)[decoded.objectID].Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GameClientState::event_processed;
|
||||||
|
case protocol_Gameplay_ObjectAction:
|
||||||
|
{
|
||||||
|
Protocol_ObjectAction decoded(data);
|
||||||
|
|
||||||
|
C_Player *player;
|
||||||
|
player = (this->privData->players)[decoded.objectID];
|
||||||
|
|
||||||
|
if( player )
|
||||||
|
{
|
||||||
|
if( this->privData->myId == decoded.objectID )
|
||||||
|
{
|
||||||
|
// my player animation
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// HACK for now animate my char
|
||||||
|
switch (decoded.animationID)
|
||||||
|
{
|
||||||
|
case GameLogic::PlayerAction::PlayerAction_Walk:
|
||||||
|
player->playAnimation(L"run_forwards", true);
|
||||||
|
break;
|
||||||
|
case GameLogic::PlayerAction::PlayerAction_Jump:
|
||||||
|
player->playAnimation(L"movement", true);
|
||||||
|
break;
|
||||||
|
case GameLogic::PlayerAction::PlayerAction_Idle:
|
||||||
|
player->playAnimation(L"idle", true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GameLogic::WeaponAction::WeaponAction_PrimaryShoot:
|
||||||
|
break;
|
||||||
|
case GameLogic::WeaponAction::WeaponAction_SecondaryShoot:
|
||||||
|
break;
|
||||||
|
case GameLogic::WeaponAction::WeaponAction_Reload:
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GameClientState::event_processed;
|
||||||
|
case protocol_Gameplay_ObjectCollision:
|
||||||
|
{
|
||||||
|
Protocol_ObjectCollision decoded(data);
|
||||||
|
C_Object *object;
|
||||||
|
object = (this->privData->players)[decoded.objectID];
|
||||||
|
if( !object)
|
||||||
|
{
|
||||||
|
// if it is not a player
|
||||||
|
object = (*this->privData->dynamicObjects)[decoded.objectID];
|
||||||
|
}
|
||||||
|
if( object )
|
||||||
|
{
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
switch (decoded.collisionID)
|
switch (decoded.collisionID)
|
||||||
{
|
{
|
||||||
case GameLogic::CollisionEvent::CollisionEvent_BasicCollision:
|
case GameLogic::CollisionEvent::CollisionEvent_BasicCollision:
|
||||||
|
|
|
@ -218,5 +218,8 @@ void GamingUI::OnMouseMoveVelocity ( Input::Struct::SAIPointInt2D coordinate, In
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
|
|
|
@ -30,7 +30,11 @@ namespace GameLogic
|
||||||
typedef void(*ObjectEnabledFunction)(IObjectData* object); // Callback method that recieves and object
|
typedef void(*ObjectEnabledFunction)(IObjectData* object); // Callback method that recieves and object
|
||||||
typedef void(*ObjectHpFunction)(IObjectData* object, float hp); // Callback method that sends obj HP
|
typedef void(*ObjectHpFunction)(IObjectData* object, float hp); // Callback method that sends obj HP
|
||||||
typedef void(*ObjectRespawnedFunction)(IObjectData* object, Oyster::Math::Float3 spawnPos ); // Callback method that sends spawnPos
|
typedef void(*ObjectRespawnedFunction)(IObjectData* object, Oyster::Math::Float3 spawnPos ); // Callback method that sends spawnPos
|
||||||
|
<<<<<<< HEAD
|
||||||
typedef void(*ObjectDeadFunction)(IObjectData* victim, IObjectData* killer, float seconds); // Callback method that sends killer and death timer
|
typedef void(*ObjectDeadFunction)(IObjectData* victim, IObjectData* killer, float seconds); // Callback method that sends killer and death timer
|
||||||
|
=======
|
||||||
|
typedef void(*ObjectDeadFunction)(IObjectData* object, IObjectData* killer, float seconds); // Callback method that sends death timer
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
typedef void(*PickupEventFunction)(IObjectData* player, int pickupEffectID ); // Callback method that sends killer and death timer
|
typedef void(*PickupEventFunction)(IObjectData* player, int pickupEffectID ); // Callback method that sends killer and death timer
|
||||||
typedef void(*AnimationEventFunction)(IObjectData* player, int actionID ); // Callback method that sends killer and death timer
|
typedef void(*AnimationEventFunction)(IObjectData* player, int actionID ); // Callback method that sends killer and death timer
|
||||||
typedef void(*CollisionEventFunction)(IObjectData*object, int collisionID);
|
typedef void(*CollisionEventFunction)(IObjectData*object, int collisionID);
|
||||||
|
|
|
@ -54,13 +54,18 @@ void Player::initPlayerData()
|
||||||
this->playerStats.hp = MAX_HP;
|
this->playerStats.hp = MAX_HP;
|
||||||
this->playerStats.movementSpeed = BASIC_SPEED;
|
this->playerStats.movementSpeed = BASIC_SPEED;
|
||||||
this->playerState = PLAYER_STATE_IDLE;
|
this->playerState = PLAYER_STATE_IDLE;
|
||||||
|
<<<<<<< HEAD
|
||||||
this->lookDir = Float3( 0.0f, 0.0f, -1.0f );
|
this->lookDir = Float3( 0.0f, 0.0f, -1.0f );
|
||||||
|
=======
|
||||||
|
this->lookDir = Oyster::Math::Float3(0,0,-1);
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
|
|
||||||
this->key_forward = 0;
|
this->key_forward = 0;
|
||||||
this->key_backward = 0;
|
this->key_backward = 0;
|
||||||
this->key_strafeRight = 0;
|
this->key_strafeRight = 0;
|
||||||
this->key_strafeLeft = 0;
|
this->key_strafeLeft = 0;
|
||||||
this->key_jump = 0;
|
this->key_jump = 0;
|
||||||
|
<<<<<<< HEAD
|
||||||
this->RecentlyAffected = 0;
|
this->RecentlyAffected = 0;
|
||||||
this->deathTimer = 0;
|
this->deathTimer = 0;
|
||||||
|
|
||||||
|
@ -70,11 +75,20 @@ void Player::initPlayerData()
|
||||||
state.staticFrictionCoeff = 0.0f;
|
state.staticFrictionCoeff = 0.0f;
|
||||||
state.dynamicFrictionCoeff = 0.0f;
|
state.dynamicFrictionCoeff = 0.0f;
|
||||||
this->rigidBody->SetState( state );
|
this->rigidBody->SetState( state );
|
||||||
|
=======
|
||||||
|
this->deathTimer = 0;
|
||||||
|
|
||||||
|
this->rotationUp = 0;
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::BeginFrame()
|
void Player::BeginFrame()
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
if( this->playerState != PLAYER_STATE_DEAD && this->playerState != PLAYER_STATE_DIED )
|
if( this->playerState != PLAYER_STATE_DEAD && this->playerState != PLAYER_STATE_DIED )
|
||||||
|
=======
|
||||||
|
if( this->playerState != PLAYER_STATE_DEAD && PLAYER_STATE_DIED)
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
{
|
{
|
||||||
static const Float maxSpeed = 30.0f;
|
static const Float maxSpeed = 30.0f;
|
||||||
|
|
||||||
|
@ -83,7 +97,10 @@ void Player::BeginFrame()
|
||||||
// Rotate player accordingly
|
// Rotate player accordingly
|
||||||
this->rigidBody->AddRotationAroundY(this->rotationUp);
|
this->rigidBody->AddRotationAroundY(this->rotationUp);
|
||||||
this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
|
this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
|
||||||
|
<<<<<<< HEAD
|
||||||
this->rotationUp = 0;
|
this->rotationUp = 0;
|
||||||
|
=======
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
|
|
||||||
// Direction data
|
// Direction data
|
||||||
Oyster::Math::Float4x4 orientation;
|
Oyster::Math::Float4x4 orientation;
|
||||||
|
@ -102,10 +119,15 @@ void Player::BeginFrame()
|
||||||
Float3 upVelocity = linearVelocity * Float3(fabs(upDir.x), fabs(upDir.y), fabs(upDir.z) );
|
Float3 upVelocity = linearVelocity * Float3(fabs(upDir.x), fabs(upDir.y), fabs(upDir.z) );
|
||||||
|
|
||||||
// Walking data
|
// Walking data
|
||||||
|
<<<<<<< HEAD
|
||||||
Float3 walkDirection = Float3( 0.0f );
|
Float3 walkDirection = Float3( 0.0f );
|
||||||
Float &walkSpeed = this->playerStats.movementSpeed;
|
Float &walkSpeed = this->playerStats.movementSpeed;
|
||||||
|
|
||||||
Float frameTime = gameInstance->GetFrameTime();
|
Float frameTime = gameInstance->GetFrameTime();
|
||||||
|
=======
|
||||||
|
Oyster::Math::Float3 walkDirection = Oyster::Math::Float3(0.0, 0.0, 0.0);
|
||||||
|
Oyster::Math::Float walkSpeed = this->playerStats.movementSpeed*0.2f;
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
|
|
||||||
// Check for input
|
// Check for input
|
||||||
if(key_forward > 0.001)
|
if(key_forward > 0.001)
|
||||||
|
@ -130,7 +152,11 @@ void Player::BeginFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dampen velocity if certain keys are not pressed
|
// Dampen velocity if certain keys are not pressed
|
||||||
|
<<<<<<< HEAD
|
||||||
if( key_jump <= 0.001 && IsWalking() )
|
if( key_jump <= 0.001 && IsWalking() )
|
||||||
|
=======
|
||||||
|
if(key_jump <= 0.001 && IsWalking())
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
{
|
{
|
||||||
if(key_forward <= 0.001 && key_backward <= 0.001)
|
if(key_forward <= 0.001 && key_backward <= 0.001)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +168,21 @@ void Player::BeginFrame()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
if( walkDirection == Float3::null )
|
if( walkDirection == Float3::null )
|
||||||
|
=======
|
||||||
|
if(walkDirection == Oyster::Math::Float3::null)
|
||||||
|
{
|
||||||
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
||||||
|
{
|
||||||
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_IDLE)
|
||||||
|
this->gameInstance->onActionEventFnc( this, PlayerAction::PlayerAction_Idle);
|
||||||
|
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Walk if walkdirection is something
|
||||||
|
if(walkDirection != Oyster::Math::Float3::null)
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
{
|
{
|
||||||
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
||||||
{
|
{
|
||||||
|
@ -180,7 +220,10 @@ void Player::BeginFrame()
|
||||||
rightVelocity += walkDirection*Oyster::Math::Float3(fabs(rightDir.x), fabs(rightDir.y), fabs(rightDir.z)) * walkSpeed*0.2f;
|
rightVelocity += walkDirection*Oyster::Math::Float3(fabs(rightDir.x), fabs(rightDir.y), fabs(rightDir.z)) * walkSpeed*0.2f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_JUMPING)
|
||||||
{
|
{
|
||||||
if(this->playerState != PLAYER_STATE::PLAYER_STATE_WALKING)
|
if(this->playerState != PLAYER_STATE::PLAYER_STATE_WALKING)
|
||||||
|
@ -199,8 +242,13 @@ void Player::BeginFrame()
|
||||||
//Jump
|
//Jump
|
||||||
if(key_jump > 0.001)
|
if(key_jump > 0.001)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
this->key_jump -= this->gameInstance->GetFrameTime();
|
this->key_jump -= this->gameInstance->GetFrameTime();
|
||||||
if(IsWalking())
|
if(IsWalking())
|
||||||
|
=======
|
||||||
|
this->key_jump -= this->gameInstance->GetFrameTime();
|
||||||
|
if(IsWalking())
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
{
|
{
|
||||||
Oyster::Math::Float3 up = this->rigidBody->GetState().centerPos.GetNormalized();
|
Oyster::Math::Float3 up = this->rigidBody->GetState().centerPos.GetNormalized();
|
||||||
this->rigidBody->ApplyImpulse(up*this->rigidBody->GetState().mass * 20);
|
this->rigidBody->ApplyImpulse(up*this->rigidBody->GetState().mass * 20);
|
||||||
|
@ -221,9 +269,13 @@ void Player::BeginFrame()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
void Player::EndFrame()
|
void Player::EndFrame()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
void Player::EndFrame() { /* do nothing .. for now */ }
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
|
|
||||||
void Player::Move(const PLAYER_MOVEMENT &movement)
|
void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +344,7 @@ void Player::SetLookDir(const Oyster::Math3D::Float3& lookDir)
|
||||||
}
|
}
|
||||||
void Player::TurnLeft(Oyster::Math3D::Float deltaRadians)
|
void Player::TurnLeft(Oyster::Math3D::Float deltaRadians)
|
||||||
{
|
{
|
||||||
this->rotationUp += deltaRadians;
|
this->rotationUp = deltaRadians;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Jump()
|
void Player::Jump()
|
||||||
|
@ -347,6 +399,7 @@ PLAYER_STATE Player::GetState() const
|
||||||
|
|
||||||
void Player::DamageLife(int damage)
|
void Player::DamageLife(int damage)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
if(damage != 0)
|
if(damage != 0)
|
||||||
{
|
{
|
||||||
this->playerStats.hp -= damage;
|
this->playerStats.hp -= damage;
|
||||||
|
@ -362,7 +415,33 @@ void Player::DamageLife(int damage)
|
||||||
this->playerStats.hp = 0;
|
this->playerStats.hp = 0;
|
||||||
this->playerState = PLAYER_STATE_DIED;
|
this->playerState = PLAYER_STATE_DIED;
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
this->playerStats.hp -= damage;
|
||||||
|
// send hp to client
|
||||||
|
this->gameInstance->onDamageTakenFnc( this, this->playerStats.hp);
|
||||||
|
|
||||||
|
if(this->playerStats.hp <= 0)
|
||||||
|
{
|
||||||
|
this->playerStats.hp = 0;
|
||||||
|
this->playerState = PLAYER_STATE_DIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Player::deathTimerTick(float dt)
|
||||||
|
{
|
||||||
|
this->deathTimer -= dt;
|
||||||
|
if( this->deathTimer <= 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
void Player::setDeathTimer(float deathTimer)
|
||||||
|
{
|
||||||
|
this->deathTimer = deathTimer;
|
||||||
|
this->playerState = PLAYER_STATE_DEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::deathTimerTick(float dt)
|
bool Player::deathTimerTick(float dt)
|
||||||
|
|
|
@ -10,7 +10,11 @@
|
||||||
#include "DynamicArray.h"
|
#include "DynamicArray.h"
|
||||||
|
|
||||||
const float MAX_HP = 100.0f;
|
const float MAX_HP = 100.0f;
|
||||||
|
<<<<<<< HEAD
|
||||||
const float BASIC_SPEED = 30.0f;// * 0.2f;
|
const float BASIC_SPEED = 30.0f;// * 0.2f;
|
||||||
|
=======
|
||||||
|
const float BASIC_SPEED = 30.0f;
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,7 +102,11 @@ namespace DanBias
|
||||||
static void ObjectEnabled ( GameLogic::IObjectData* movedObject );
|
static void ObjectEnabled ( GameLogic::IObjectData* movedObject );
|
||||||
static void ObjectDamaged ( GameLogic::IObjectData* movedObject, float hp );
|
static void ObjectDamaged ( GameLogic::IObjectData* movedObject, float hp );
|
||||||
static void ObjectRespawned ( GameLogic::IObjectData* movedObject, Oyster::Math::Float3 spawnPos );
|
static void ObjectRespawned ( GameLogic::IObjectData* movedObject, Oyster::Math::Float3 spawnPos );
|
||||||
|
<<<<<<< HEAD
|
||||||
static void ObjectDead ( GameLogic::IObjectData* victim, GameLogic::IObjectData* killer, float seconds );
|
static void ObjectDead ( GameLogic::IObjectData* victim, GameLogic::IObjectData* killer, float seconds );
|
||||||
|
=======
|
||||||
|
static void ObjectDead ( GameLogic::IObjectData* movedObject, GameLogic::IObjectData* killer, float seconds );
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
static void PickupEvent ( GameLogic::IObjectData* movedObject, int pickupEffectID );
|
static void PickupEvent ( GameLogic::IObjectData* movedObject, int pickupEffectID );
|
||||||
static void ActionEvent ( GameLogic::IObjectData* movedObject , int actionID );
|
static void ActionEvent ( GameLogic::IObjectData* movedObject , int actionID );
|
||||||
static void CollisionEvent ( GameLogic::IObjectData* Object , int collisionID );
|
static void CollisionEvent ( GameLogic::IObjectData* Object , int collisionID );
|
||||||
|
|
|
@ -162,7 +162,11 @@ using namespace DanBias;
|
||||||
{
|
{
|
||||||
GameSession::gameSession->Send(Protocol_ObjectRespawn(movedObject->GetID(), spawnPos).GetProtocol());
|
GameSession::gameSession->Send(Protocol_ObjectRespawn(movedObject->GetID(), spawnPos).GetProtocol());
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
void GameSession::ObjectDead( GameLogic::IObjectData* victim, GameLogic::IObjectData* killer, float seconds )
|
void GameSession::ObjectDead( GameLogic::IObjectData* victim, GameLogic::IObjectData* killer, float seconds )
|
||||||
|
=======
|
||||||
|
void GameSession::ObjectDead( GameLogic::IObjectData* movedObject, GameLogic::IObjectData* killer, float seconds )
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
{
|
{
|
||||||
GameSession::gameSession->Send(Protocol_ObjectDie(victim->GetID(), killer->GetID(), seconds).GetProtocol());
|
GameSession::gameSession->Send(Protocol_ObjectDie(victim->GetID(), killer->GetID(), seconds).GetProtocol());
|
||||||
}
|
}
|
||||||
|
@ -181,6 +185,21 @@ using namespace DanBias;
|
||||||
// send action protocol
|
// send action protocol
|
||||||
GameSession::gameSession->Send(Protocol_ObjectCollision(movedObject->GetID(), collisionID).GetProtocol());
|
GameSession::gameSession->Send(Protocol_ObjectCollision(movedObject->GetID(), collisionID).GetProtocol());
|
||||||
}
|
}
|
||||||
|
void GameSession::PickupEvent( GameLogic::IObjectData* movedObject, int pickupEffectID )
|
||||||
|
{
|
||||||
|
// send pickup protocol
|
||||||
|
GameSession::gameSession->Send(Protocol_ObjectPickup(movedObject->GetID(), pickupEffectID).GetProtocol());
|
||||||
|
}
|
||||||
|
void GameSession::ActionEvent( GameLogic::IObjectData* movedObject , int actionID )
|
||||||
|
{
|
||||||
|
// send action protocol
|
||||||
|
GameSession::gameSession->Send(Protocol_ObjectAction(movedObject->GetID(), actionID).GetProtocol());
|
||||||
|
}
|
||||||
|
void GameSession::CollisionEvent( GameLogic::IObjectData* movedObject , int collisionID )
|
||||||
|
{
|
||||||
|
// send action protocol
|
||||||
|
GameSession::gameSession->Send(Protocol_ObjectCollision(movedObject->GetID(), collisionID).GetProtocol());
|
||||||
|
}
|
||||||
//*****************************************************//
|
//*****************************************************//
|
||||||
//****************** Protocol methods *****************//
|
//****************** Protocol methods *****************//
|
||||||
//******************************************************************************************************************//
|
//******************************************************************************************************************//
|
||||||
|
|
|
@ -239,6 +239,7 @@ void SimpleRigidBody::SetUp(::Oyster::Math::Float3 up)
|
||||||
btQuaternion newRotation;
|
btQuaternion newRotation;
|
||||||
btTransform trans;
|
btTransform trans;
|
||||||
trans = this->rigidBody->getWorldTransform();
|
trans = this->rigidBody->getWorldTransform();
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
btVector3 v1 = trans.getBasis().getColumn(1);
|
btVector3 v1 = trans.getBasis().getColumn(1);
|
||||||
btVector3 v2(up.x, up.y, up.z);
|
btVector3 v2(up.x, up.y, up.z);
|
||||||
|
@ -247,17 +248,35 @@ void SimpleRigidBody::SetUp(::Oyster::Math::Float3 up)
|
||||||
btVector3 a = v1.cross(v2);
|
btVector3 a = v1.cross(v2);
|
||||||
|
|
||||||
if (v1.dot(v2) < -0.999999)
|
if (v1.dot(v2) < -0.999999)
|
||||||
|
=======
|
||||||
|
|
||||||
|
btVector3 v1 = trans.getBasis().getColumn(1);
|
||||||
|
btVector3 v2(up.x, up.y, up.z);
|
||||||
|
|
||||||
|
btQuaternion q;
|
||||||
|
btVector3 a = v1.cross(v2);
|
||||||
|
|
||||||
|
if (v1.dot(v2) < -0.999999)
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
{
|
{
|
||||||
btVector3 xCrossPre = btVector3(1, 0 ,0).cross(v1);
|
btVector3 xCrossPre = btVector3(1, 0 ,0).cross(v1);
|
||||||
if(xCrossPre.length() < 0.000001)
|
if(xCrossPre.length() < 0.000001)
|
||||||
xCrossPre = btVector3(0, 1 ,0).cross(v1);
|
xCrossPre = btVector3(0, 1 ,0).cross(v1);
|
||||||
xCrossPre.normalize();
|
xCrossPre.normalize();
|
||||||
q.setRotation(xCrossPre, 3.1415);
|
q.setRotation(xCrossPre, 3.1415);
|
||||||
|
<<<<<<< HEAD
|
||||||
}
|
}
|
||||||
else if (v1.dot(v2) > 0.999999)
|
else if (v1.dot(v2) > 0.999999)
|
||||||
{
|
{
|
||||||
q = btQuaternion(0, 0, 0, 1);
|
q = btQuaternion(0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
}
|
||||||
|
else if (v1.dot(v2) > 0.999999)
|
||||||
|
{
|
||||||
|
q = btQuaternion(0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
q.setX(a.x());
|
q.setX(a.x());
|
||||||
|
|
|
@ -29,7 +29,11 @@ namespace Oyster
|
||||||
void SetRotation(Math::Quaternion quaternion);
|
void SetRotation(Math::Quaternion quaternion);
|
||||||
void SetRotation(Math::Float3 eulerAngles);
|
void SetRotation(Math::Float3 eulerAngles);
|
||||||
void SetRotation(::Oyster::Math::Float4x4 rotation);
|
void SetRotation(::Oyster::Math::Float4x4 rotation);
|
||||||
|
<<<<<<< HEAD
|
||||||
void AddRotationAroundY(::Oyster::Math::Float angle);
|
void AddRotationAroundY(::Oyster::Math::Float angle);
|
||||||
|
=======
|
||||||
|
void AddRotationAroundY(Math::Float angle);
|
||||||
|
>>>>>>> origin/New-inputsystem
|
||||||
void SetAngularFactor(Math::Float factor);
|
void SetAngularFactor(Math::Float factor);
|
||||||
void SetMass(Math::Float mass);
|
void SetMass(Math::Float mass);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue