GL - almost rotating
This commit is contained in:
parent
2d22d5d274
commit
528a591fab
|
@ -453,14 +453,14 @@ void GameState::readKeyInput(InputClass* KeyInput)
|
|||
}
|
||||
|
||||
//send delta mouse movement
|
||||
//if (KeyInput->IsMousePressed())
|
||||
if (KeyInput->IsMousePressed())
|
||||
{
|
||||
camera->Yaw(-KeyInput->GetYaw());
|
||||
camera->Pitch(KeyInput->GetPitch());
|
||||
pitch = KeyInput->GetPitch();
|
||||
camera->UpdateViewMatrix();
|
||||
GameLogic::Protocol_PlayerLook playerLookDir;
|
||||
Oyster::Math::Float4 look = camera->GetLook();
|
||||
Oyster::Math::Float4 look = camera->GetRight();
|
||||
playerLookDir.lookDirX = look.x;
|
||||
playerLookDir.lookDirY = look.y;
|
||||
playerLookDir.lookDirZ = look.z;
|
||||
|
|
|
@ -16,7 +16,7 @@ Game::PlayerData::PlayerData()
|
|||
|
||||
//create rigid body
|
||||
Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f );
|
||||
|
||||
//rigidBody->SetAngularFactor(0.0f);
|
||||
//create player with this rigid body
|
||||
this->player = new Player(rigidBody,Level::LevelCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER);
|
||||
this->player->GetRigidBody()->SetCustomTag(this);
|
||||
|
|
|
@ -107,13 +107,9 @@ void Object::setAfterCollisonFunc(Oyster::Physics::ICustomBody::SubscriptMessage
|
|||
|
||||
Oyster::Math::Float3 Object::GetPosition()
|
||||
{
|
||||
Oyster::Physics::ICustomBody::State state;
|
||||
state = this->rigidBody->GetState();
|
||||
return state.centerPos;
|
||||
return (Oyster::Math::Float3) this->rigidBody->GetState().centerPos;
|
||||
}
|
||||
Oyster::Math::Float4x4 Object::GetOrientation()
|
||||
{
|
||||
Oyster::Physics::ICustomBody::State state;
|
||||
state = this->rigidBody->GetState();
|
||||
return state.GetOrientation();
|
||||
return this->rigidBody->GetState().GetOrientation();
|
||||
}
|
|
@ -22,7 +22,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type)
|
|||
{
|
||||
InitPlayer();
|
||||
}
|
||||
|
||||
Player::Player(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type)
|
||||
:DynamicObject(collisionFuncBefore,collisionFuncAfter,type)
|
||||
{
|
||||
|
@ -60,7 +59,7 @@ Player::~Player(void)
|
|||
|
||||
void Player::BeginFrame()
|
||||
{
|
||||
weapon->Update(0.002f);
|
||||
//weapon->Update(0.002f);
|
||||
Object::BeginFrame();
|
||||
}
|
||||
|
||||
|
@ -68,13 +67,6 @@ void Player::EndFrame()
|
|||
{
|
||||
// snap to axis
|
||||
Object::EndFrame();
|
||||
// rotate
|
||||
|
||||
//Oyster::Math::Float3 up = currPhysicsState.GetOrientation().v[1];
|
||||
//Oyster::Math::Float3 deltaAxis = up * (-dx * 0.02) ;
|
||||
|
||||
//currPhysicsState.AddRotation(deltaAxis);
|
||||
|
||||
}
|
||||
|
||||
void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||
|
@ -143,11 +135,12 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
|||
this->life = 100;
|
||||
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||
this->lookDir = Oyster::Math::Float4(1,0,0);
|
||||
//this->newPhysicsState.centerPos = spawnPoint;
|
||||
this->rigidBody->SetPosition(spawnPoint);
|
||||
}
|
||||
|
||||
void Player::Rotate(const Oyster::Math3D::Float4 lookDir)
|
||||
{
|
||||
// right
|
||||
Oyster::Math::Float dx = lookDir.w;
|
||||
if(dx > 0.0f)
|
||||
{
|
||||
|
@ -156,12 +149,16 @@ void Player::Rotate(const Oyster::Math3D::Float4 lookDir)
|
|||
|
||||
this->lookDir = lookDir.xyz;
|
||||
this->dx = lookDir.w;
|
||||
|
||||
|
||||
Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1];
|
||||
this->rigidBody->SetUpAndRight(up, lookDir.xyz);
|
||||
}
|
||||
|
||||
void Player::Jump()
|
||||
{
|
||||
Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1];
|
||||
//newPhysicsState.ApplyLinearImpulse(up * MOVE_FORCE * this->gameInstance->GetFrameTime());
|
||||
//this->rigidBody->GetState().SetLinearVelocity(up *10);
|
||||
}
|
||||
|
||||
bool Player::IsWalking()
|
||||
|
|
Loading…
Reference in New Issue