GL - working with snap
This commit is contained in:
parent
c318223bcf
commit
7b503bcb52
|
@ -7,7 +7,7 @@ Game::PlayerData::PlayerData()
|
||||||
{
|
{
|
||||||
//set some stats that are appropriate to a player
|
//set some stats that are appropriate to a player
|
||||||
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
||||||
sbDesc.centerPosition = Oyster::Math::Float3(10,350,0);
|
sbDesc.centerPosition = Oyster::Math::Float3(0,320,0);
|
||||||
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
||||||
sbDesc.mass = 70;
|
sbDesc.mass = 70;
|
||||||
//create rigid body
|
//create rigid body
|
||||||
|
|
|
@ -41,7 +41,7 @@ void Level::InitiateLevel(float radius)
|
||||||
|
|
||||||
// add box
|
// add box
|
||||||
API::SimpleBodyDescription sbDesc_TestBox;
|
API::SimpleBodyDescription sbDesc_TestBox;
|
||||||
sbDesc_TestBox.centerPosition = Oyster::Math::Float4(0,320,0,0);
|
sbDesc_TestBox.centerPosition = Oyster::Math::Float4(10,320,0,0);
|
||||||
sbDesc_TestBox.ignoreGravity = false;
|
sbDesc_TestBox.ignoreGravity = false;
|
||||||
sbDesc_TestBox.mass = 50;
|
sbDesc_TestBox.mass = 50;
|
||||||
sbDesc_TestBox.size = Oyster::Math::Float4(4,4,4,0);
|
sbDesc_TestBox.size = Oyster::Math::Float4(4,4,4,0);
|
||||||
|
|
|
@ -118,18 +118,22 @@ Oyster::Physics::ICustomBody* Object::GetRigidBody()
|
||||||
|
|
||||||
void Object::BeginFrame()
|
void Object::BeginFrame()
|
||||||
{
|
{
|
||||||
|
Oyster::Math::Float4 axis;
|
||||||
|
if(setState.GetGravityNormal()!= Float3::null)
|
||||||
|
{
|
||||||
|
Oyster::Math3D::SnapAngularAxis(Oyster::Math::Float4(setState.GetAngularAxis(), 0), Oyster::Math::Float4::standard_unit_y, -Oyster::Math::Float4(setState.GetGravityNormal()), axis);
|
||||||
|
setState.SetRotation(axis.xyz);
|
||||||
|
|
||||||
|
Oyster::Math::Float3 debug = ::LinearAlgebra3D::WorldAxisOf(::LinearAlgebra3D::Rotation(axis.xyz), Oyster::Math::Float3::standard_unit_y);
|
||||||
|
debug += setState.GetGravityNormal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this->rigidBody->SetState(this->setState);
|
this->rigidBody->SetState(this->setState);
|
||||||
|
|
||||||
}
|
}
|
||||||
// update physic
|
// update physic
|
||||||
void Object::EndFrame()
|
void Object::EndFrame()
|
||||||
{
|
{
|
||||||
|
|
||||||
Oyster::Math::Float4x4 rotMatrix = setState.GetOrientation(); //Oyster::Math3D::RotationMatrix(rot, axis);
|
|
||||||
//Oyster::Math3D::SnapAxisYToNormal_UsingNlerp(rotMatrix, -setState.GetGravityNormal());
|
|
||||||
//setState.SetOrientation(rotMatrix);
|
|
||||||
|
|
||||||
this->getState = this->rigidBody->GetState();
|
this->getState = this->rigidBody->GetState();
|
||||||
this->setState = this->getState;
|
this->setState = this->getState;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue