GL - rotation testing

This commit is contained in:
lindaandersson 2014-02-14 10:09:03 +01:00
parent 2dee9dd084
commit 1fc6f16409
5 changed files with 58 additions and 43 deletions

View File

@ -60,22 +60,7 @@ GameState::gameStateState GameState::LoadGame()
plight.Radius = 300;
plight.Bright = 0.5f;
Oyster::Graphics::API::AddLight(plight);
//plight.Pos = Float3(350,350,5);
//plight.Color = Float3(0.9f,0.7f,0.3f);
//plight.Radius = 200;
//plight.Bright = 0.7f;
//Oyster::Graphics::API::AddLight(plight);
//plight.Pos = Float3(10,350,350);
//plight.Color = Float3(0.9f,0.7f,0.3f);
//plight.Radius = 200;
//plight.Bright = 0.7f;
//Oyster::Graphics::API::AddLight(plight);
//plight.Pos = Float3(10,-15,5);
//plight.Color = Float3(0,0,1);
//plight.Radius = 50;
//plight.Bright = 0.5f;
//Oyster::Graphics::API::AddLight(plight);
// use level loader
LoadModels("../Content/Worlds/ccc.bias");
@ -143,7 +128,7 @@ bool GameState::LoadModels()
this->staticObjects[this->staticObjects.Size() -1 ]->Init(modelData);
// add jumppad
modelData.position = Oyster::Math::Float3(4, 600.3, 0);
modelData.position = Oyster::Math::Float3(4, 600.3f, 0);
modelData.modelPath = L"jumppad_round.dan";
modelData.id = id++;
// load models
@ -244,24 +229,51 @@ bool GameState::LoadModels(std::string mapFile)
break;
}
}
//myId += modelId++;
// add player model
//modelData.position = ;
//modelData.rotation = Oyster::Math::Quaternion(Oyster::Math::Float3(2,2,-2), 1);
//modelData.scale = Oyster::Math::Float3(2,2,2);
Oyster::Math::Quaternion first = Oyster::Math::Quaternion(Float3(0.3536,0.3536,-0.146), 0.8536);
Oyster::Math::Quaternion second = Oyster::Math::Quaternion(Float3(0.3536,0.3536,-0.146), 0.8536);
Oyster::Math::Quaternion result = first * second;
Oyster::Math::Quaternion total = Oyster::Math::Quaternion(Float3(0.5,0.5,-0.5), 0.5);
modelData.visible = true;
modelData.position = Oyster::Math::Float3(20, 127,0);
modelData.rotation = first;
modelData.scale = Oyster::Math::Float3(1,1,1);
modelData.modelPath = L"char_still_sizeref.dan";
modelData.id = myId;
//modelData.visible = true;
//modelData.modelPath = L"char_still_sizeref.dan";
//modelData.id = myId;
//// load models
//this->dynamicObjects.Push(new C_DynamicObj());
//this->dynamicObjects[this->dynamicObjects.Size() -1 ]->Init(modelData);
this->staticObjects.Push(new C_StaticObj());
this->staticObjects[this->staticObjects.Size() -1 ]->Init(modelData);
modelData.visible = true;
modelData.position = Oyster::Math::Float3(22, 127,0);
modelData.rotation = second;
modelData.scale = Oyster::Math::Float3(1,1,1);
modelData.modelPath = L"char_still_sizeref.dan";
modelData.id = myId;
this->staticObjects.Push(new C_StaticObj());
this->staticObjects[this->staticObjects.Size() -1 ]->Init(modelData);
modelData.visible = true;
modelData.position = Oyster::Math::Float3(24, 127,0);
modelData.rotation = result;
modelData.scale = Oyster::Math::Float3(1,1,1);
modelData.modelPath = L"char_still_sizeref.dan";
modelData.id = myId;
this->staticObjects.Push(new C_StaticObj());
this->staticObjects[this->staticObjects.Size() -1 ]->Init(modelData);
modelData.visible = true;
modelData.position = Oyster::Math::Float3(26, 127,0);
modelData.rotation = total;
modelData.scale = Oyster::Math::Float3(1,1,1);
modelData.modelPath = L"char_still_sizeref.dan";
modelData.id = myId;
this->staticObjects.Push(new C_StaticObj());
this->staticObjects[this->staticObjects.Size() -1 ]->Init(modelData);
/*C_Player* obj = new C_Player();
privData->object.push_back(obj);
privData->object[privData->object.size() -1 ]->Init(modelData);
*/
return true;
}

View File

@ -61,7 +61,7 @@ void AttatchmentMassDriver::Update(float dt)
Oyster::Math::Float3 ownerPos = owner->GetPosition();
Oyster::Physics::ICustomBody::State ownerState = owner->GetRigidBody()->GetState();
Oyster::Math::Float3 up = -ownerState.GetOrientation().v[2];
up *= -0.3;
up *= -0.3f;
Oyster::Math::Float3 pos = ownerPos + (owner->GetLookDir().GetNormalized()*5);
//state.centerPos = pos;

View File

@ -11,9 +11,9 @@ Game::PlayerData::PlayerData()
Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,2.0f,0.5f);
Oyster::Math::Float mass = 60;
Oyster::Math::Float restitutionCoeff = 0.5;
Oyster::Math::Float frictionCoeff_Static = 0.4;
Oyster::Math::Float frictionCoeff_Dynamic = 0.3;
Oyster::Math::Float restitutionCoeff = 0.5f;
Oyster::Math::Float frictionCoeff_Static = 0.4f;
Oyster::Math::Float frictionCoeff_Dynamic = 0.3f;
//sbDesc.quaternion = Oyster::Math::Float3(0, Oyster::Math::pi, 0);
//create rigid body
@ -28,6 +28,7 @@ Game::PlayerData::PlayerData()
Game::PlayerData::PlayerData(int playerID,int teamID)
{
this->player = new Player();
}
Game::PlayerData::~PlayerData()
{

View File

@ -137,6 +137,7 @@ ICustomBody* Level::InitRigidBodyCube( const ObjectHeader* obj)
//offset the rigidPosition from modelspace to worldspace;
rigidWorldPos = (Oyster::Math::Float3)obj->position + (Oyster::Math::Float3)obj->boundingVolume.box.position;
//scales the position so the collision geomentry is in the right place
rigidWorldPos = rigidWorldPos * obj->scale;
@ -182,7 +183,7 @@ 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 = (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;
//create the rigid body
@ -230,7 +231,7 @@ void Level::InitiateLevel(std::string levelPath)
else if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Box)
{
rigidBody_Static = InitRigidBodySphere(staticObjData);
rigidBody_Static = InitRigidBodyCube(staticObjData);
}
else if(staticObjData->boundingVolume.geoType == CollisionGeometryType_Cylinder)
@ -241,7 +242,8 @@ void Level::InitiateLevel(std::string levelPath)
if(rigidBody_Static != NULL)
{
// create game object
Object* staticGameObj = createGameObj(staticObjData, rigidBody_Static);
//Object* staticGameObj = createGameObj(staticObjData, rigidBody_Static);
Object* staticGameObj = new StaticObject(rigidBody_Static, Object::DefaultCollisionAfter, (ObjectSpecialType)staticObjData->specialTypeID);
if(staticGameObj != NULL)
{
this->staticObjects.Push((StaticObject*)staticGameObj);
@ -278,7 +280,8 @@ void Level::InitiateLevel(std::string levelPath)
if(rigidBody_Dynamic != NULL)
{
// create game object
Object* dynamicGameObj = createGameObj(dynamicObjData, rigidBody_Dynamic);
//Object* dynamicGameObj = createGameObj(dynamicObjData, rigidBody_Dynamic);
Object* dynamicGameObj =new DynamicObject(rigidBody_Dynamic, Object::DefaultCollisionAfter, (ObjectSpecialType)dynamicObjData->specialTypeID);
if (dynamicGameObj != NULL)
{
this->dynamicObjects.Push((DynamicObject*)dynamicGameObj);

View File

@ -6,7 +6,7 @@
using namespace GameLogic;
using namespace Oyster::Physics;
const int MOVE_FORCE = 30;
const float MOVE_FORCE = 30;
const float KEY_TIMER = 0.03f;
Player::Player()
:DynamicObject()
@ -163,7 +163,6 @@ void Player::UseWeapon(const WEAPON_FIRE &usage)
void Player::Respawn(Oyster::Math::Float3 spawnPoint)
{
key_jump =
this->life = 100;
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
this->lookDir = Oyster::Math::Float4(1,0,0);
@ -184,7 +183,7 @@ void Player::Jump()
{
Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1].GetNormalized();
this->rigidBody->ApplyImpulse(up *1500);
this->playerState == PLAYER_STATE::PLAYER_STATE_JUMPING;
this->playerState = PLAYER_STATE::PLAYER_STATE_JUMPING;
}
bool Player::IsWalking()