GL - added error check
This commit is contained in:
parent
c08c3d2b53
commit
ab962eea99
|
@ -11,18 +11,18 @@ Game::PlayerData::PlayerData()
|
||||||
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
||||||
sbDesc.mass = 70;
|
sbDesc.mass = 70;
|
||||||
sbDesc.restitutionCoeff = 0.5;
|
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
|
//create rigid body
|
||||||
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
|
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
|
|
||||||
//create player with this rigid body
|
//create player with this rigid body
|
||||||
this->player = new Player(rigidBody,Object::DefaultCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER);
|
this->player = new Player(rigidBody,Object::DefaultCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER);
|
||||||
this->player->GetRigidBody()->SetCustomTag(this);
|
this->player->GetRigidBody()->SetCustomTag(this);
|
||||||
Oyster::Physics::ICustomBody::State state;
|
/*Oyster::Physics::ICustomBody::State state;
|
||||||
this->player->GetRigidBody()->GetState(state);
|
this->player->GetRigidBody()->GetState(state);
|
||||||
state.SetRotation(Oyster::Math::Float3(0, Oyster::Math::pi, 0));
|
state.SetRotation(Oyster::Math::Float3(0, Oyster::Math::pi, 0));
|
||||||
this->player->GetRigidBody()->SetState(state);
|
this->player->GetRigidBody()->SetState(state);
|
||||||
player->EndFrame();
|
player->EndFrame();*/
|
||||||
}
|
}
|
||||||
Game::PlayerData::PlayerData(int playerID,int teamID)
|
Game::PlayerData::PlayerData(int playerID,int teamID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,6 +126,11 @@ void Object::BeginFrame()
|
||||||
if(newPhysicsState.GetGravityNormal()!= Float3::null)
|
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);
|
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.SetRotation(axis.xyz);
|
||||||
newPhysicsState.SetAngularMomentum(Float3::null);
|
newPhysicsState.SetAngularMomentum(Float3::null);
|
||||||
Oyster::Math::Float3 debug = ::LinearAlgebra3D::WorldAxisOf(::LinearAlgebra3D::Rotation(axis.xyz), Oyster::Math::Float3::standard_unit_y);
|
Oyster::Math::Float3 debug = ::LinearAlgebra3D::WorldAxisOf(::LinearAlgebra3D::Rotation(axis.xyz), Oyster::Math::Float3::standard_unit_y);
|
||||||
|
|
|
@ -117,7 +117,6 @@ void Player::UseWeapon(const WEAPON_FIRE &usage)
|
||||||
|
|
||||||
void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
||||||
{
|
{
|
||||||
|
|
||||||
this->life = 100;
|
this->life = 100;
|
||||||
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
this->lookDir = Oyster::Math::Float4(1,0,0);
|
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)
|
void Player::Rotate(const Oyster::Math3D::Float4 lookDir)
|
||||||
{
|
{
|
||||||
Oyster::Math::Float dx = lookDir.w;
|
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 up = currPhysicsState.GetOrientation().v[1];
|
||||||
Oyster::Math::Float3 deltaAxis = up * (-dx * 0.02) ;
|
Oyster::Math::Float3 deltaAxis = up * (-dx * 0.02) ;
|
||||||
|
|
||||||
//setState.SetOrientation(world);
|
|
||||||
newPhysicsState.AddRotation(deltaAxis);
|
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;
|
this->lookDir = lookDir.xyz;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue