boxrotation nif field; commented functions

actorid
Jason Hooks 13 years ago
parent 7b8b4c366d
commit 8762f4a47a

@ -194,7 +194,7 @@ namespace MWWorld
//playerphysics->ps.snappingImplemented = false;
//playerphysics->ps.speed = 240;
playerphysics->ps.viewangles.x = pitchQuat.getPitch().valueDegrees();

@ -73,7 +73,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
resourceName = cShape->getName();
cShape->collide = false;
mBoundingBox = NULL;
boxTranslation = Ogre::Vector3(0,0,0);
cShape->boxTranslation = Ogre::Vector3(0,0,0);
mTriMesh = new btTriangleMesh();
@ -127,7 +127,6 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
delete m_meshInterface;
}
};
cShape->boxTranslation = boxTranslation;
if(mBoundingBox != NULL)
cShape->Shape = mBoundingBox;
@ -226,7 +225,8 @@ void ManualBulletShapeLoader::handleNode(Nif::Node *node, int flags,
btVector3 boxsize = getbtVector((node->boundXYZ));
boxTranslation = node->boundPos;
cShape->boxTranslation = node->boundPos;
cShape->boxRotation = node->boundRot;
mBoundingBox = new btBoxShape(boxsize);
}

@ -102,7 +102,7 @@ private:
std::string resourceName;
std::string resourceGroup;
Ogre::Vector3 boxTranslation;
BulletShape* cShape;//current shape
btTriangleMesh *mTriMesh;

@ -32,6 +32,7 @@ public:
btCollisionShape* Shape;
Ogre::Vector3 boxTranslation;
Ogre::Quaternion boxRotation;
//this flag indicate if the shape is used for collision or if it's for raycasting only.
bool collide;
};

@ -336,9 +336,10 @@ namespace Physic
btTransform tr;
btBoxShape* box = dynamic_cast<btBoxShape*>(body->getCollisionShape());
if(box != NULL){
Ogre::Vector3 transrot = rotation * (shape->boxTranslation * scale);
Ogre::Vector3 transrot = rotation * shape->boxRotation * (shape->boxTranslation * scale);
Ogre::Vector3 newPosition = transrot + position;
tr.setOrigin(btVector3(newPosition.x, newPosition.y, newPosition.z));
rotation = rotation * shape->boxRotation;
}
else
tr.setOrigin(btVector3(position.x,position.y,position.z));

@ -145,10 +145,19 @@ namespace Physic
/**
* Create a RigidBody.It does not add it to the simulation, but it does add it to the rigidBody Map,
* so you can get it with the getRigidBody function.
After created, the body is set to the correct rotation, position, and scale
*/
RigidBody* createAndAdjustRigidBody(std::string mesh,std::string name,float scale, Ogre::Vector3 position, Ogre::Quaternion rotation);
/**
* Adjusts a rigid body to the right position and rotation
*/
void adjustRigidBody(BulletShapePtr shape, RigidBody* body, float scale, Ogre::Vector3 position, Ogre::Quaternion rotation);
/**
Mainly used to (but not limited to) adjust rigid bodies based on box shapes to the right position and rotation.
*/
void boxAdjustExternal(std::string mesh, RigidBody* body, float scale, Ogre::Vector3 position, Ogre::Quaternion rotation);
/**
* Add a HeightField to the simulation

@ -657,10 +657,11 @@ static void PM_Accelerate( Ogre::Vector3& wishdir, float wishspeed, float accel
// int i;
float addspeed, accelspeed, currentspeed;
// currentspeed = pm->ps->velocity dot wishdir
//currentspeed = DotProduct (pm->ps->velocity, wishdir);
currentspeed = pm->ps.velocity.dotProduct(wishdir);
addspeed = wishspeed - currentspeed;
if (addspeed <= 0)
return;
@ -675,6 +676,8 @@ static void PM_Accelerate( Ogre::Vector3& wishdir, float wishspeed, float accel
//for (i=0 ; i<3 ; i++)
//pm->ps->velocity[i] += accelspeed * wishdir[i];
pm->ps.velocity += (wishdir * accelspeed);
//pm->ps.velocity = wishdir * wishspeed; //New, for instant acceleration
}
static bool PM_CheckJump(void)

Loading…
Cancel
Save