GmaeClient fix RBsphere radius
This commit is contained in:
parent
0c0fde51b0
commit
7b87707714
|
@ -152,7 +152,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
|
|||
RBInitData RBData;
|
||||
if(oh->boundingVolume.geoType == CollisionGeometryType_Box)
|
||||
{
|
||||
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position;
|
||||
RBData.position = ((Float3)oh->position + (Float3)oh->boundingVolume.box.position) * (Float3)oh->scale;
|
||||
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
|
||||
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2;
|
||||
RBData.type = RB_Type_Cube;
|
||||
|
@ -161,7 +161,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
|
|||
|
||||
if(oh->boundingVolume.geoType == CollisionGeometryType_Sphere)
|
||||
{
|
||||
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position;
|
||||
RBData.position = ((Float3)oh->position + (Float3)oh->boundingVolume.box.position) * (Float3)oh->scale;
|
||||
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
|
||||
RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius * 2;
|
||||
RBData.type = RB_Type_Sphere;
|
||||
|
@ -196,7 +196,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
|
|||
RBInitData RBData;
|
||||
if(oh->boundingVolume.geoType == CollisionGeometryType_Box)
|
||||
{
|
||||
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position;
|
||||
RBData.position = ((Float3)oh->position + (Float3)oh->boundingVolume.box.position) * (Float3)oh->scale;
|
||||
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
|
||||
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2;
|
||||
RBData.type = RB_Type_Cube;
|
||||
|
@ -205,7 +205,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
|
|||
|
||||
if(oh->boundingVolume.geoType == CollisionGeometryType_Sphere)
|
||||
{
|
||||
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position;
|
||||
RBData.position = ((Float3)oh->position + (Float3)oh->boundingVolume.box.position) * (Float3)oh->scale;
|
||||
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
|
||||
RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius * 2;
|
||||
RBData.type = RB_Type_Sphere;
|
||||
|
|
|
@ -196,8 +196,8 @@ ICustomBody* Level::InitRigidBodySphere( const ObjectHeader* obj)
|
|||
rigidBodyMass = obj->scale[0] * obj->scale[1] * obj->scale[2] * obj->boundingVolume.sphere.mass;
|
||||
|
||||
//Radius scaled
|
||||
//rigidBodyRadius = (staticObjData->scale[0] + staticObjData->scale[1] + staticObjData->scale[2] / 3) * staticObjData->boundingVolume.sphere.radius;
|
||||
rigidBodyRadius = (obj->scale[0] * obj->scale[1] * obj->scale[2]) * obj->boundingVolume.sphere.radius;
|
||||
rigidBodyRadius = (obj->scale[0]) * obj->boundingVolume.sphere.radius;
|
||||
//rigidBodyRadius = (obj->scale[0] * obj->scale[1] * obj->scale[2]) * obj->boundingVolume.sphere.radius;
|
||||
|
||||
//create the rigid body
|
||||
rigidBody = API::Instance().AddCollisionSphere( rigidBodyRadius , rigidWorldRotation , rigidWorldPos , rigidBodyMass, obj->boundingVolume.sphere.restitutionCoeff , obj->boundingVolume.sphere.frictionCoeffStatic , obj->boundingVolume.sphere.frictionCoeffDynamic);
|
||||
|
|
|
@ -79,22 +79,22 @@ void Player::BeginFrame()
|
|||
|
||||
Oyster::Math::Float maxSpeed = 30;
|
||||
|
||||
/*Oyster::Math::Float4x4 xform;
|
||||
xform = this->rigidBody->GetState().GetOrientation();*/
|
||||
Oyster::Math::Float4x4 xform;
|
||||
xform = this->rigidBody->GetState().GetOrientation();
|
||||
|
||||
/* Handle turning */
|
||||
/*if (left)
|
||||
m_turnAngle -= dt * m_turnVelocity;
|
||||
if (right)
|
||||
m_turnAngle += dt * m_turnVelocity;*/
|
||||
m_turnAngle += dt * m_turnVelocity;
|
||||
|
||||
//xform.setRotation (btQuaternion (btVector3(0.0, 1.0, 0.0), m_turnAngle));
|
||||
xform.setRotation (btQuaternion (btVector3(0.0, 1.0, 0.0), m_turnAngle));*/
|
||||
|
||||
Oyster::Math::Float3 linearVelocity(0,0,0); // = this->rigidBody->GetLinearVelocity();
|
||||
Oyster::Math::Float3 linearVelocity = this->rigidBody->GetLinearVelocity();
|
||||
Oyster::Math::Float speed = this->rigidBody->GetLinearVelocity().GetLength();
|
||||
|
||||
Oyster::Math::Float3 forwardDir(0,0,1); //= xform.v[2];
|
||||
Oyster::Math::Float3 rightDir(1,0,0); // = xform.v[0];
|
||||
Oyster::Math::Float3 forwardDir = xform.v[2];
|
||||
Oyster::Math::Float3 rightDir = xform.v[0];
|
||||
forwardDir.Normalize();
|
||||
rightDir.Normalize();
|
||||
Oyster::Math::Float3 walkDirection = Oyster::Math::Float3(0.0, 0.0, 0.0);
|
||||
|
@ -131,21 +131,21 @@ void Player::BeginFrame()
|
|||
{
|
||||
/* Dampen when on the ground and not being moved by the player */
|
||||
linearVelocity *= 0.2f;
|
||||
//this->rigidBody->SetLinearVelocity (linearVelocity);
|
||||
this->rigidBody->SetLinearVelocity (linearVelocity);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (speed < maxSpeed && this->rigidBody->GetLambda() < 1.0f)
|
||||
{
|
||||
Oyster::Math::Float3 velocity = linearVelocity + walkDirection * walkSpeed;
|
||||
this->rigidBody->SetLinearVelocity(velocity);
|
||||
}
|
||||
else if(speed < maxSpeed)
|
||||
{
|
||||
Oyster::Math::Float3 velocity = linearVelocity + (walkDirection * walkSpeed)*0.2f;
|
||||
this->rigidBody->SetLinearVelocity(velocity);
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// if (speed < maxSpeed && this->rigidBody->GetLambda() < 1.0f)
|
||||
// {
|
||||
// Oyster::Math::Float3 velocity = linearVelocity + walkDirection * walkSpeed;
|
||||
// this->rigidBody->SetLinearVelocity(velocity);
|
||||
// }
|
||||
// else if(speed < maxSpeed)
|
||||
// {
|
||||
// Oyster::Math::Float3 velocity = linearVelocity + (walkDirection * walkSpeed)*0.2f;
|
||||
// this->rigidBody->SetLinearVelocity(velocity);
|
||||
// }
|
||||
//}
|
||||
|
||||
if (key_jump > 0.001)
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ void Player::BeginFrame()
|
|||
}
|
||||
}
|
||||
Oyster::Math::Float3 pos = this->rigidBody->GetState().centerPos;
|
||||
if(pos.x < -300000)
|
||||
if(pos == Oyster::Math::Float3(0,0,0))
|
||||
int i =0;
|
||||
|
||||
//this->weapon->Update(0.01f);
|
||||
|
@ -169,7 +169,7 @@ void Player::EndFrame()
|
|||
// snap to axis
|
||||
Oyster::Math::Float4 rotation;
|
||||
|
||||
//this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
|
||||
this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
|
||||
|
||||
//Object::EndFrame();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue