mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Remove superfluous velocity reflection in movement solver.
The slide projection negates the reflection effect. Just to be sure I've compared the resulting vectors with and without reflection at runtime.
This commit is contained in:
parent
50fd913058
commit
e58de5e410
1 changed files with 2 additions and 10 deletions
|
@ -366,10 +366,7 @@ namespace MWPhysics
|
|||
newPosition.z() <= swimlevel)
|
||||
{
|
||||
const osg::Vec3f down(0,0,-1);
|
||||
float movelen = velocity.normalize();
|
||||
osg::Vec3f reflectdir = reflect(velocity, down);
|
||||
reflectdir.normalize();
|
||||
velocity = slide(reflectdir, down)*movelen;
|
||||
velocity = slide(velocity, down);
|
||||
// NOTE: remainingTime is unchanged before the loop continues
|
||||
continue; // velocity updated, calculate nextpos again
|
||||
}
|
||||
|
@ -413,12 +410,7 @@ namespace MWPhysics
|
|||
else
|
||||
{
|
||||
// Can't move this way, try to find another spot along the plane
|
||||
osg::Vec3f direction = velocity;
|
||||
float movelen = direction.normalize();
|
||||
osg::Vec3f reflectdir = reflect(velocity, tracer.mPlaneNormal);
|
||||
reflectdir.normalize();
|
||||
|
||||
osg::Vec3f newVelocity = slide(reflectdir, tracer.mPlaneNormal)*movelen;
|
||||
osg::Vec3f newVelocity = slide(velocity, tracer.mPlaneNormal);
|
||||
|
||||
// Do not allow sliding upward if there is gravity.
|
||||
// Stepping will have taken care of that.
|
||||
|
|
Loading…
Reference in a new issue