mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 18:53: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)
|
newPosition.z() <= swimlevel)
|
||||||
{
|
{
|
||||||
const osg::Vec3f down(0,0,-1);
|
const osg::Vec3f down(0,0,-1);
|
||||||
float movelen = velocity.normalize();
|
velocity = slide(velocity, down);
|
||||||
osg::Vec3f reflectdir = reflect(velocity, down);
|
|
||||||
reflectdir.normalize();
|
|
||||||
velocity = slide(reflectdir, down)*movelen;
|
|
||||||
// NOTE: remainingTime is unchanged before the loop continues
|
// NOTE: remainingTime is unchanged before the loop continues
|
||||||
continue; // velocity updated, calculate nextpos again
|
continue; // velocity updated, calculate nextpos again
|
||||||
}
|
}
|
||||||
|
@ -413,12 +410,7 @@ namespace MWPhysics
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Can't move this way, try to find another spot along the plane
|
// Can't move this way, try to find another spot along the plane
|
||||||
osg::Vec3f direction = velocity;
|
osg::Vec3f newVelocity = slide(velocity, tracer.mPlaneNormal);
|
||||||
float movelen = direction.normalize();
|
|
||||||
osg::Vec3f reflectdir = reflect(velocity, tracer.mPlaneNormal);
|
|
||||||
reflectdir.normalize();
|
|
||||||
|
|
||||||
osg::Vec3f newVelocity = slide(reflectdir, tracer.mPlaneNormal)*movelen;
|
|
||||||
|
|
||||||
// Do not allow sliding upward if there is gravity.
|
// Do not allow sliding upward if there is gravity.
|
||||||
// Stepping will have taken care of that.
|
// Stepping will have taken care of that.
|
||||||
|
|
Loading…
Reference in a new issue