BulletSim: small fix making sure terrain height is calculated

properly if the vehicle moves during vehicle actions.
user_profiles
Robert Adams 2013-01-20 13:11:00 -08:00
parent 3b0df52d10
commit 2cb1d5240e
1 changed files with 3 additions and 1 deletions

View File

@ -720,10 +720,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// Since the computation of terrain height can be a little involved, this routine // Since the computation of terrain height can be a little involved, this routine
// is used to fetch the height only once for each vehicle simulation step. // is used to fetch the height only once for each vehicle simulation step.
Vector3 lastRememberedHeightPos;
private float GetTerrainHeight(Vector3 pos) private float GetTerrainHeight(Vector3 pos)
{ {
if ((m_knownHas & m_knownChangedTerrainHeight) == 0) if ((m_knownHas & m_knownChangedTerrainHeight) == 0 || pos != lastRememberedHeightPos)
{ {
lastRememberedHeightPos = pos;
m_knownTerrainHeight = Prim.PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos); m_knownTerrainHeight = Prim.PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos);
m_knownHas |= m_knownChangedTerrainHeight; m_knownHas |= m_knownChangedTerrainHeight;
} }