mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
Bouncy effect gone
This commit is contained in:
parent
e4251be529
commit
318355f1be
2 changed files with 35 additions and 17 deletions
|
@ -178,7 +178,7 @@ bool PM_SlideMove( bool gravity )
|
||||||
float into;
|
float into;
|
||||||
Ogre::Vector3 endVelocity;
|
Ogre::Vector3 endVelocity;
|
||||||
Ogre::Vector3 endClipVelocity;
|
Ogre::Vector3 endClipVelocity;
|
||||||
std::cout << "Slide move\n";
|
std::cout << "Slide move" << pm->ps.velocity << "\n";
|
||||||
numbumps = 4;
|
numbumps = 4;
|
||||||
|
|
||||||
// primal_velocity = pm->ps->velocity
|
// primal_velocity = pm->ps->velocity
|
||||||
|
@ -415,6 +415,7 @@ int PM_StepSlideMove( bool gravity )
|
||||||
// vec3_t delta, delta2;
|
// vec3_t delta, delta2;
|
||||||
Ogre::Vector3 up, down;
|
Ogre::Vector3 up, down;
|
||||||
float stepSize;
|
float stepSize;
|
||||||
|
std::cout << "Step Slide move" << pm->ps.velocity << "\n";
|
||||||
|
|
||||||
// start_o = pm->ps->origin
|
// start_o = pm->ps->origin
|
||||||
//VectorCopy (pm->ps->origin, start_o);
|
//VectorCopy (pm->ps->origin, start_o);
|
||||||
|
@ -427,7 +428,7 @@ int PM_StepSlideMove( bool gravity )
|
||||||
if ( PM_SlideMove( gravity ) == false )
|
if ( PM_SlideMove( gravity ) == false )
|
||||||
return 1; // we got exactly where we wanted to go first try
|
return 1; // we got exactly where we wanted to go first try
|
||||||
|
|
||||||
std::cout << "Step Slide move\n";
|
|
||||||
// down = start_o - vec3(0, 0, STEPSIZE)
|
// down = start_o - vec3(0, 0, STEPSIZE)
|
||||||
//VectorCopy(start_o, down);
|
//VectorCopy(start_o, down);
|
||||||
down = start_o;
|
down = start_o;
|
||||||
|
@ -711,7 +712,7 @@ static void PM_WaterMove( playerMove* const pm )
|
||||||
Ogre::Vector3 wishdir;
|
Ogre::Vector3 wishdir;
|
||||||
float scale;
|
float scale;
|
||||||
float vel;
|
float vel;
|
||||||
|
std::cout << "Water moving";
|
||||||
/*if ( PM_CheckWaterJump() )
|
/*if ( PM_CheckWaterJump() )
|
||||||
{
|
{
|
||||||
PM_WaterJumpMove();
|
PM_WaterJumpMove();
|
||||||
|
@ -837,7 +838,7 @@ static void PM_WalkMove( playerMove* const pmove )
|
||||||
playerMove::playercmd cmd;
|
playerMove::playercmd cmd;
|
||||||
float accelerate;
|
float accelerate;
|
||||||
float vel;
|
float vel;
|
||||||
std::cout << "Walking\n";
|
std::cout << "Walking" << pm->ps.velocity << "\n";
|
||||||
|
|
||||||
if ( pm->ps.waterlevel > 2 && //DotProduct( pml.forward, pml.groundTrace.plane.normal ) > 0 )
|
if ( pm->ps.waterlevel > 2 && //DotProduct( pml.forward, pml.groundTrace.plane.normal ) > 0 )
|
||||||
pml.forward.dotProduct(pml.groundTrace.planenormal) > 0.0f)
|
pml.forward.dotProduct(pml.groundTrace.planenormal) > 0.0f)
|
||||||
|
@ -927,6 +928,7 @@ static void PM_WalkMove( playerMove* const pmove )
|
||||||
|
|
||||||
|
|
||||||
PM_Friction ();
|
PM_Friction ();
|
||||||
|
std::cout << "After friction" << pm->ps.velocity << "\n";
|
||||||
|
|
||||||
//bprintf("vel: (%f, %f, %f)\n", pm->ps.velocity.x, pm->ps.velocity.y, pm->ps.velocity.z);
|
//bprintf("vel: (%f, %f, %f)\n", pm->ps.velocity.x, pm->ps.velocity.y, pm->ps.velocity.z);
|
||||||
|
|
||||||
|
@ -945,20 +947,28 @@ static void PM_WalkMove( playerMove* const pmove )
|
||||||
|
|
||||||
//pml.right[2] = 0;
|
//pml.right[2] = 0;
|
||||||
pml.right.z = 0;
|
pml.right.z = 0;
|
||||||
|
//std::cout << "Further down" << pm->ps.velocity << "\n";
|
||||||
|
|
||||||
|
|
||||||
// project the forward and right directions onto the ground plane
|
// project the forward and right directions onto the ground plane
|
||||||
PM_ClipVelocity (pml.forward, pml.groundTrace.planenormal, pml.forward, OVERCLIP );
|
PM_ClipVelocity (pml.forward, pml.groundTrace.planenormal, pml.forward, OVERCLIP );
|
||||||
PM_ClipVelocity (pml.right, pml.groundTrace.planenormal, pml.right, OVERCLIP );
|
PM_ClipVelocity (pml.right, pml.groundTrace.planenormal, pml.right, OVERCLIP );
|
||||||
|
std::cout << "Clip velocity" << pm->ps.velocity << "\n";
|
||||||
//
|
//
|
||||||
//VectorNormalize (pml.forward);
|
|
||||||
pml.forward = pml.forward.normalise();
|
VectorNormalize (pml.forward);
|
||||||
pml.right = pml.right.normalise();
|
VectorNormalize (pml.right);
|
||||||
|
//pml.forward = pml.forward.normalise();
|
||||||
|
//pml.right = pml.right.normalise();
|
||||||
|
std::cout << "forward2" << pml.forward << "\n";
|
||||||
|
std::cout << "right2" << pml.right << "\n";
|
||||||
|
|
||||||
|
|
||||||
// wishvel = (pml.forward * fmove) + (pml.right * smove);
|
// wishvel = (pml.forward * fmove) + (pml.right * smove);
|
||||||
//for ( i = 0 ; i < 3 ; i++ )
|
//for ( i = 0 ; i < 3 ; i++ )
|
||||||
//wishvel[i] = pml.forward[i] * fmove + pml.right[i] * smove;
|
//wishvel[i] = pml.forward[i] * fmove + pml.right[i] * smove;
|
||||||
wishvel = pml.forward * fmove + pml.right * smove;
|
wishvel = pml.forward * fmove + pml.right * smove;
|
||||||
|
std::cout << "WishVel" << wishvel << "\n";
|
||||||
//bprintf("f: (%f, %f, %f), s: (%f, %f, %f)\n", fmove, smove);
|
//bprintf("f: (%f, %f, %f), s: (%f, %f, %f)\n", fmove, smove);
|
||||||
|
|
||||||
|
|
||||||
|
@ -971,7 +981,9 @@ static void PM_WalkMove( playerMove* const pmove )
|
||||||
wishdir = wishvel;
|
wishdir = wishvel;
|
||||||
|
|
||||||
wishspeed = VectorNormalize(wishdir);
|
wishspeed = VectorNormalize(wishdir);
|
||||||
|
std::cout << "Wishspeed: " << wishspeed << "\n";
|
||||||
wishspeed *= scale;
|
wishspeed *= scale;
|
||||||
|
std::cout << "Wishspeed scaled:" << wishspeed << "\n";
|
||||||
|
|
||||||
// clamp the speed lower if ducking
|
// clamp the speed lower if ducking
|
||||||
if ( pm->cmd.ducking )
|
if ( pm->cmd.ducking )
|
||||||
|
@ -998,6 +1010,7 @@ static void PM_WalkMove( playerMove* const pmove )
|
||||||
|
|
||||||
|
|
||||||
PM_Accelerate (wishdir, wishspeed, accelerate);
|
PM_Accelerate (wishdir, wishspeed, accelerate);
|
||||||
|
std::cout << "Velocityafter: " << pm->ps.velocity << "\n";
|
||||||
|
|
||||||
//Com_Printf("velocity = %1.1f %1.1f %1.1f\n", pm->ps->velocity[0], pm->ps->velocity[1], pm->ps->velocity[2]);
|
//Com_Printf("velocity = %1.1f %1.1f %1.1f\n", pm->ps->velocity[0], pm->ps->velocity[1], pm->ps->velocity[2]);
|
||||||
//Com_Printf("velocity1 = %1.1f\n", VectorLength(pm->ps->velocity));
|
//Com_Printf("velocity1 = %1.1f\n", VectorLength(pm->ps->velocity));
|
||||||
|
@ -1012,15 +1025,18 @@ static void PM_WalkMove( playerMove* const pmove )
|
||||||
|
|
||||||
//vel = VectorLength(pm->ps->velocity);
|
//vel = VectorLength(pm->ps->velocity);
|
||||||
vel = pm->ps.velocity.length();
|
vel = pm->ps.velocity.length();
|
||||||
|
std::cout << "The length" << vel << "\n";
|
||||||
|
|
||||||
// slide along the ground plane
|
// slide along the ground plane
|
||||||
PM_ClipVelocity (pm->ps.velocity, pml.groundTrace.planenormal,
|
PM_ClipVelocity (pm->ps.velocity, pml.groundTrace.planenormal,
|
||||||
pm->ps.velocity, OVERCLIP );
|
pm->ps.velocity, OVERCLIP );
|
||||||
|
std::cout << "Velocity clipped" << pm->ps.velocity << "\n";
|
||||||
|
|
||||||
// don't decrease velocity when going up or down a slope
|
// don't decrease velocity when going up or down a slope
|
||||||
//VectorNormalize(pm->ps->velocity);
|
VectorNormalize(pm->ps.velocity);
|
||||||
pm->ps.velocity = pm->ps.velocity.normalise();
|
//pm->ps.velocity = pm->ps.velocity.normalise();
|
||||||
|
|
||||||
|
std::cout << "Final:" << pm->ps.velocity << "\n";
|
||||||
//VectorScale(pm->ps->velocity, vel, pm->ps->velocity);
|
//VectorScale(pm->ps->velocity, vel, pm->ps->velocity);
|
||||||
pm->ps.velocity = pm->ps.velocity * vel;
|
pm->ps.velocity = pm->ps.velocity * vel;
|
||||||
|
|
||||||
|
@ -1032,6 +1048,7 @@ static void PM_WalkMove( playerMove* const pmove )
|
||||||
PM_StepSlideMove( false );
|
PM_StepSlideMove( false );
|
||||||
|
|
||||||
//Com_Printf("velocity2 = %1.1f\n", VectorLength(pm->ps->velocity));
|
//Com_Printf("velocity2 = %1.1f\n", VectorLength(pm->ps->velocity));
|
||||||
|
std::cout << "Walk2" << pm->ps.velocity << "\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1361,7 +1378,7 @@ static void PM_CrashLand( void )
|
||||||
|
|
||||||
static void PM_GroundTrace( void )
|
static void PM_GroundTrace( void )
|
||||||
{
|
{
|
||||||
std::cout << "Ground trace\n";
|
std::cout << "Ground trace" << pm->ps.velocity << "\n";
|
||||||
Ogre::Vector3 point;
|
Ogre::Vector3 point;
|
||||||
traceResults trace;
|
traceResults trace;
|
||||||
|
|
||||||
|
@ -1467,13 +1484,13 @@ static void PM_GroundTrace( void )
|
||||||
|
|
||||||
// don't reset the z velocity for slopes
|
// don't reset the z velocity for slopes
|
||||||
// pm->ps->velocity[2] = 0;
|
// pm->ps->velocity[2] = 0;
|
||||||
|
std::cout << "Ground trace2" << pm->ps.velocity << "\n";
|
||||||
//PM_AddTouchEnt( trace.entityNum );
|
//PM_AddTouchEnt( trace.entityNum );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PM_AirMove()
|
static void PM_AirMove()
|
||||||
{
|
{
|
||||||
std::cout << "Air move\n";
|
std::cout << "Air move " << pm->ps.velocity << "\n";
|
||||||
//int i;
|
//int i;
|
||||||
Ogre::Vector3 wishvel;
|
Ogre::Vector3 wishvel;
|
||||||
float fmove, smove;
|
float fmove, smove;
|
||||||
|
@ -1495,9 +1512,9 @@ static void PM_AirMove()
|
||||||
|
|
||||||
// project moves down to flat plane
|
// project moves down to flat plane
|
||||||
//pml.forward[2] = 0;
|
//pml.forward[2] = 0;
|
||||||
pml.forward.y = 0; //Z or Y?
|
pml.forward.z = 0; //Z or Y?
|
||||||
//pml.right[2] = 0;
|
//pml.right[2] = 0;
|
||||||
pml.right.y = 0;
|
pml.right.z = 0;
|
||||||
//VectorNormalize (pml.forward);
|
//VectorNormalize (pml.forward);
|
||||||
pml.forward = Ogre::Vector3(pml.forward.normalise());
|
pml.forward = Ogre::Vector3(pml.forward.normalise());
|
||||||
pml.right = Ogre::Vector3(pml.right.normalise());
|
pml.right = Ogre::Vector3(pml.right.normalise());
|
||||||
|
@ -1537,6 +1554,7 @@ static void PM_AirMove()
|
||||||
#endif*/
|
#endif*/
|
||||||
|
|
||||||
/*bprintf("%i ", */PM_StepSlideMove ( true )/* )*/;
|
/*bprintf("%i ", */PM_StepSlideMove ( true )/* )*/;
|
||||||
|
std::cout << "Velocity 2 " << pm->ps.velocity << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PM_NoclipMove( void )
|
static void PM_NoclipMove( void )
|
||||||
|
|
|
@ -32,7 +32,7 @@ void newtrace(traceResults* const results, const Ogre::Vector3& start, const Ogr
|
||||||
//Ogre::Vector3 endReplace = startReplace;
|
//Ogre::Vector3 endReplace = startReplace;
|
||||||
//endReplace.z -= .25;
|
//endReplace.z -= .25;
|
||||||
|
|
||||||
const bool hasHit = NewPhysicsTrace<collisionWorldTrace>(&out, start, end, BBHalfExtents, Ogre::Vector3(0.0f, 0.0f, rotation), isInterior, enginePass);
|
const bool hasHit = NewPhysicsTrace<collisionWorldTrace>(&out, start, end, BBHalfExtents, Ogre::Vector3(0.0f, rotation, 0.0f), isInterior, enginePass);
|
||||||
if(hasHit)
|
if(hasHit)
|
||||||
std::cout << "Has hit\n";
|
std::cout << "Has hit\n";
|
||||||
if (out.fraction < 0.001f)
|
if (out.fraction < 0.001f)
|
||||||
|
@ -100,7 +100,7 @@ const bool NewPhysicsTrace(NewPhysTraceResults* const out, const Ogre::Vector3&
|
||||||
|
|
||||||
const btVector3 btstart(start.x, start.y, start.z);
|
const btVector3 btstart(start.x, start.y, start.z);
|
||||||
const btVector3 btend(end.x, end.y, end.z);
|
const btVector3 btend(end.x, end.y, end.z);
|
||||||
const btQuaternion btrot(rotation.y, rotation.x, rotation.z);
|
const btQuaternion btrot(rotation.y, rotation.x, rotation.z); //y, x, z
|
||||||
|
|
||||||
const btBoxShape newshape(btVector3(BBHalfExtents.x, BBHalfExtents.y, BBHalfExtents.z));
|
const btBoxShape newshape(btVector3(BBHalfExtents.x, BBHalfExtents.y, BBHalfExtents.z));
|
||||||
const btTransform from(btrot, btstart);
|
const btTransform from(btrot, btstart);
|
||||||
|
|
Loading…
Reference in a new issue