mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
Tweaked adjustPosition. Now uses a very thin box for tracing the feet only.
This commit is contained in:
parent
91c89e5db4
commit
1420a2cb33
@ -105,18 +105,19 @@ namespace MWWorld
|
|||||||
physicActor->enableCollisions(false);
|
physicActor->enableCollisions(false);
|
||||||
|
|
||||||
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
||||||
|
halfExtents.z = 1; // we trace the feet only, so we use a very thin box
|
||||||
|
|
||||||
Ogre::Vector3 newPosition = position;
|
Ogre::Vector3 newPosition = position;
|
||||||
|
|
||||||
traceResults trace; //no initialization needed
|
traceResults trace; //no initialization needed
|
||||||
|
|
||||||
int maxHeight = 400.f;
|
int maxHeight = 200.f;
|
||||||
newtrace(&trace, Ogre::Quaternion::IDENTITY, newPosition, newPosition-Ogre::Vector3(0,0,maxHeight), halfExtents, isInterior, engine);
|
newtrace(&trace, Ogre::Quaternion::IDENTITY, newPosition, newPosition-Ogre::Vector3(0,0,maxHeight), halfExtents, isInterior, engine);
|
||||||
if(trace.fraction < 1.0f)
|
if(trace.fraction < 1.0f)
|
||||||
hit = true;
|
hit = true;
|
||||||
newPosition = trace.endpos;
|
newPosition = trace.endpos;
|
||||||
|
|
||||||
physicActor->setOnGround(hit);
|
physicActor->setOnGround(hit && getSlope(trace.planenormal) <= sMaxSlope);
|
||||||
physicActor->enableCollisions(wasCollisionMode);
|
physicActor->enableCollisions(wasCollisionMode);
|
||||||
|
|
||||||
if (hit)
|
if (hit)
|
||||||
|
@ -911,7 +911,7 @@ namespace MWWorld
|
|||||||
float terrainHeight = mRendering->getTerrainHeightAt(pos);
|
float terrainHeight = mRendering->getTerrainHeightAt(pos);
|
||||||
|
|
||||||
if (pos.z < terrainHeight)
|
if (pos.z < terrainHeight)
|
||||||
pos.z = terrainHeight+400; // place slightly above. will snap down to ground with code below
|
pos.z = terrainHeight+5; // place slightly above. will snap down to ground with code below
|
||||||
|
|
||||||
ptr.getRefData().getPosition().pos[2] = pos.z;
|
ptr.getRefData().getPosition().pos[2] = pos.z;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user