GL - added error check

This commit is contained in:
lindaandersson 2014-02-03 16:20:05 +01:00
parent c08c3d2b53
commit ab962eea99
3 changed files with 9 additions and 22 deletions

View File

@ -11,18 +11,18 @@ Game::PlayerData::PlayerData()
sbDesc.size = Oyster::Math::Float3(4,7,4);
sbDesc.mass = 70;
sbDesc.restitutionCoeff = 0.5;
sbDesc.rotation = Oyster::Math3D::RotationMatrix_AxisY(Utility::Value::Radian(180));
sbDesc.rotation = Oyster::Math::Float3(0, Oyster::Math::pi, 0);
//create rigid body
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
//create player with this rigid body
this->player = new Player(rigidBody,Object::DefaultCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER);
this->player->GetRigidBody()->SetCustomTag(this);
Oyster::Physics::ICustomBody::State state;
/*Oyster::Physics::ICustomBody::State state;
this->player->GetRigidBody()->GetState(state);
state.SetRotation(Oyster::Math::Float3(0, Oyster::Math::pi, 0));
this->player->GetRigidBody()->SetState(state);
player->EndFrame();
player->EndFrame();*/
}
Game::PlayerData::PlayerData(int playerID,int teamID)
{

View File

@ -126,13 +126,18 @@ void Object::BeginFrame()
if(newPhysicsState.GetGravityNormal()!= Float3::null)
{
Oyster::Math3D::SnapAngularAxis(Oyster::Math::Float4(newPhysicsState.GetAngularAxis(), 0), Oyster::Math::Float4::standard_unit_y, -Oyster::Math::Float4(newPhysicsState.GetGravityNormal()), axis);
if(axis !=axis)
{
//error
int i =0 ;
}
newPhysicsState.SetRotation(axis.xyz);
newPhysicsState.SetAngularMomentum(Float3::null);
Oyster::Math::Float3 debug = ::LinearAlgebra3D::WorldAxisOf(::LinearAlgebra3D::Rotation(axis.xyz), Oyster::Math::Float3::standard_unit_y);
debug += newPhysicsState.GetGravityNormal();
}
this->rigidBody->SetState(this->newPhysicsState);
}
// update physic

View File

@ -117,7 +117,6 @@ void Player::UseWeapon(const WEAPON_FIRE &usage)
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);
@ -126,26 +125,9 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint)
void Player::Rotate(const Oyster::Math3D::Float4 lookDir)
{
Oyster::Math::Float dx = lookDir.w;
//deltaLook = this->lookDir - lookDir;
//Oyster::Math::Float4 up = -setState.GetGravityNormal();
//Oyster::Math::Float4 pos = setState.GetCenterPosition();
//Oyster::Math::Float4x4 world = Oyster::Math3D::OrientationMatrix_LookAtDirection(lookDir, up.xyz, pos.xyz);
// cant set rotation
//setState.AddRotation();
Oyster::Math::Float3 up = currPhysicsState.GetOrientation().v[1];
Oyster::Math::Float3 deltaAxis = up * (-dx * 0.02) ;
//setState.SetOrientation(world);
newPhysicsState.AddRotation(deltaAxis);
//setState.SetOrientation()
//this->lookDir = lookDir - up.xyz;
//this->lookDir = lookDir;
//this->setState.AddRotation(Oyster::Math::Float4(x, y));
//this->setState.SetRotation();
this->lookDir = lookDir.xyz;
}