mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
More pmove stuff; Turned off broadphase, we could not fall in exteriors
This commit is contained in:
parent
f6384574da
commit
76f2a82884
@ -96,6 +96,10 @@ namespace MWWorld
|
||||
if(hasWater){
|
||||
playerphysics->waterHeight = waterHeight;
|
||||
}
|
||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
||||
{
|
||||
it->second->setCurrentWater(hasWater, waterHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -356,8 +360,6 @@ namespace MWWorld
|
||||
if(cmode)
|
||||
{
|
||||
act->enableCollisions(false);
|
||||
act->setGravity(0.);
|
||||
act->setVerticalVelocity(0);
|
||||
mFreeFly = true;
|
||||
return false;
|
||||
}
|
||||
@ -365,8 +367,6 @@ namespace MWWorld
|
||||
{
|
||||
mFreeFly = false;
|
||||
act->enableCollisions(true);
|
||||
act->setGravity(4.);
|
||||
act->setVerticalVelocity(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -46,19 +46,30 @@ namespace Physic
|
||||
delete pmove;
|
||||
}
|
||||
|
||||
void PhysicActor::setCurrentWater(bool hasWater, int waterHeight){
|
||||
pmove->hasWater = hasWater;
|
||||
if(hasWater){
|
||||
pmove->waterHeight = waterHeight;
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicActor::setGravity(float gravity)
|
||||
{
|
||||
|
||||
pmove->ps.gravity = gravity;
|
||||
}
|
||||
|
||||
void PhysicActor::enableCollisions(bool collision)
|
||||
{
|
||||
collisionMode = collision;
|
||||
if(collisionMode)
|
||||
pmove->ps.move_type=PM_NORMAL;
|
||||
else
|
||||
pmove->ps.move_type=PM_NOCLIP;
|
||||
}
|
||||
|
||||
void PhysicActor::setVerticalVelocity(float z)
|
||||
void PhysicActor::setJumpVelocity(float velocity)
|
||||
{
|
||||
|
||||
pmove->ps.jump_velocity = velocity;
|
||||
}
|
||||
|
||||
bool PhysicActor::getCollisionMode()
|
||||
|
@ -65,6 +65,8 @@ namespace Physic
|
||||
|
||||
~PhysicActor();
|
||||
|
||||
void setCurrentWater(bool hasWater, int waterHeight);
|
||||
|
||||
/**
|
||||
* This function set the walkDirection. This is not relative to the actor orientation.
|
||||
* I think it's also needed to take time into account. A typical call should look like this:
|
||||
@ -81,7 +83,7 @@ namespace Physic
|
||||
|
||||
void setGravity(float gravity);
|
||||
|
||||
void setVerticalVelocity(float z);
|
||||
void setJumpVelocity(float velocity);
|
||||
|
||||
void enableCollisions(bool collision);
|
||||
|
||||
|
@ -704,7 +704,7 @@ static bool PM_CheckJump(void)
|
||||
//pm->ps->pm_flags |= PMF_JUMP_HELD;
|
||||
|
||||
pm->ps.groundEntityNum = ENTITYNUM_NONE;
|
||||
pm->ps.velocity.z = JUMP_VELOCITY;
|
||||
pm->ps.velocity.z = pm->ps.jump_velocity;
|
||||
pm->ps.bSnap = false;
|
||||
//PM_AddEvent( EV_JUMP );
|
||||
|
||||
|
@ -42,7 +42,6 @@ static const Ogre::Vector3 halfExtents(14.64f * 2, 14.24f * 2, 33.25f * 2);
|
||||
#define ENTITYNUM_NONE (MAX_GENTITIES - 1)
|
||||
#define ENTITYNUM_WORLD (MAX_GENTITIES - 2)
|
||||
#define MIN_WALK_NORMAL .7f // can't walk on very steep slopes
|
||||
#define JUMP_VELOCITY (270)
|
||||
#define PS_PMOVEFRAMECOUNTBITS 6
|
||||
#define MINS_Z -24
|
||||
#define DEFAULT_VIEWHEIGHT 26
|
||||
@ -90,7 +89,7 @@ struct playerMove
|
||||
{
|
||||
struct playerStruct
|
||||
{
|
||||
playerStruct() : gravity(800.0f), speed(480.0f), pmove_framecount(20), groundEntityNum(ENTITYNUM_NONE), commandTime(40), move_type(PM_NOCLIP), pm_time(0), snappingImplemented(true), bSnap(false), counter(-1)
|
||||
playerStruct() : gravity(800.0f), speed(480.0f), jump_velocity(270), pmove_framecount(20), groundEntityNum(ENTITYNUM_NONE), commandTime(40), move_type(PM_NOCLIP), pm_time(0), snappingImplemented(true), bSnap(false), counter(-1)
|
||||
{
|
||||
origin = Ogre::Vector3(0.0f, 0.0f, 0.0f);
|
||||
velocity = Ogre::Vector3(0.0f, 0.0f, 0.0f);
|
||||
@ -122,6 +121,7 @@ struct playerMove
|
||||
int counter;
|
||||
float gravity; // default = 800
|
||||
float speed; // default = 320
|
||||
float jump_velocity; //default = 270
|
||||
|
||||
int commandTime; // the time at which this command was issued (in milliseconds)
|
||||
|
||||
|
@ -181,7 +181,8 @@ const bool NewPhysicsTrace(NewPhysTraceResults* const out, const Ogre::Vector3&
|
||||
if (!TestPointAgainstAabb2(aabbMin, aabbMax, *(const btVector3* const)&(start) ) )
|
||||
{
|
||||
//We're solid
|
||||
out->startSolid = true;
|
||||
//THIS NEEDS TO BE TURNED OFF IF WE WANT FALLING IN EXTERIORS TO WORK CORRECTLY!!!!!!!
|
||||
//out->startSolid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user