BulletSim: rename variable 'PhysicsScene' to be either 'PhysScene' or 'm_physicsScene' to match coding conventions and reduce confusion.

user_profiles
Robert Adams 2013-04-28 21:50:47 -07:00
parent 21ec434688
commit ad1787770e
11 changed files with 282 additions and 282 deletions

View File

@ -95,18 +95,18 @@ public sealed class BSCharacter : BSPhysObject
// the avatar seeking to reach the motor's target speed.
// This motor runs as a prestep action for the avatar so it will keep the avatar
// standing as well as moving. Destruction of the avatar will destroy the pre-step action.
m_moveActor = new BSActorAvatarMove(PhysicsScene, this, AvatarMoveActorName);
m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName);
PhysicalActors.Add(AvatarMoveActorName, m_moveActor);
DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}",
LocalID, _size, Scale, Density, _avatarVolume, RawMass);
// do actual creation in taint time
PhysicsScene.TaintedObject("BSCharacter.create", delegate()
PhysScene.TaintedObject("BSCharacter.create", delegate()
{
DetailLog("{0},BSCharacter.create,taint", LocalID);
// New body and shape into PhysBody and PhysShape
PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this);
PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this);
SetPhysicalProperties();
});
@ -119,18 +119,18 @@ public sealed class BSCharacter : BSPhysObject
base.Destroy();
DetailLog("{0},BSCharacter.Destroy", LocalID);
PhysicsScene.TaintedObject("BSCharacter.destroy", delegate()
PhysScene.TaintedObject("BSCharacter.destroy", delegate()
{
PhysicsScene.Shapes.DereferenceBody(PhysBody, null /* bodyCallback */);
PhysScene.Shapes.DereferenceBody(PhysBody, null /* bodyCallback */);
PhysBody.Clear();
PhysShape.Dereference(PhysicsScene);
PhysShape.Dereference(PhysScene);
PhysShape = new BSShapeNull();
});
}
private void SetPhysicalProperties()
{
PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody);
PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody);
ZeroMotion(true);
ForcePosition = _position;
@ -145,35 +145,35 @@ public sealed class BSCharacter : BSPhysObject
// Needs to be reset especially when an avatar is recreated after crossing a region boundry.
Flying = _flying;
PhysicsScene.PE.SetRestitution(PhysBody, BSParam.AvatarRestitution);
PhysicsScene.PE.SetMargin(PhysShape.physShapeInfo, PhysicsScene.Params.collisionMargin);
PhysicsScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale);
PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
PhysScene.PE.SetRestitution(PhysBody, BSParam.AvatarRestitution);
PhysScene.PE.SetMargin(PhysShape.physShapeInfo, PhysScene.Params.collisionMargin);
PhysScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale);
PhysScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
if (BSParam.CcdMotionThreshold > 0f)
{
PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
PhysScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
PhysScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
}
UpdatePhysicalMassProperties(RawMass, false);
// Make so capsule does not fall over
PhysicsScene.PE.SetAngularFactorV(PhysBody, OMV.Vector3.Zero);
PhysScene.PE.SetAngularFactorV(PhysBody, OMV.Vector3.Zero);
// The avatar mover sets some parameters.
PhysicalActors.Refresh();
PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_CHARACTER_OBJECT);
PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_CHARACTER_OBJECT);
PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody);
PhysScene.PE.AddObjectToWorld(PhysScene.World, PhysBody);
// PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG);
PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_DEACTIVATION);
PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, PhysBody);
PhysScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_DEACTIVATION);
PhysScene.PE.UpdateSingleAabb(PhysScene.World, PhysBody);
// Do this after the object has been added to the world
PhysBody.collisionType = CollisionType.Avatar;
PhysBody.ApplyCollisionMask(PhysicsScene);
PhysBody.ApplyCollisionMask(PhysScene);
}
@ -203,14 +203,14 @@ public sealed class BSCharacter : BSPhysObject
DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}",
LocalID, _size, Scale, Density, _avatarVolume, RawMass);
PhysicsScene.TaintedObject("BSCharacter.setSize", delegate()
PhysScene.TaintedObject("BSCharacter.setSize", delegate()
{
if (PhysBody.HasPhysicalBody && PhysShape.physShapeInfo.HasPhysicalShape)
{
PhysicsScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale);
PhysScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale);
UpdatePhysicalMassProperties(RawMass, true);
// Make sure this change appears as a property update event
PhysicsScene.PE.PushUpdate(PhysBody);
PhysScene.PE.PushUpdate(PhysBody);
}
});
@ -247,24 +247,24 @@ public sealed class BSCharacter : BSPhysObject
_rotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties directly into the physics engine
PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate()
PhysScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate()
{
if (PhysBody.HasPhysicalBody)
PhysicsScene.PE.ClearAllForces(PhysBody);
PhysScene.PE.ClearAllForces(PhysBody);
});
}
public override void ZeroAngularMotion(bool inTaintTime)
{
_rotationalVelocity = OMV.Vector3.Zero;
PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate()
PhysScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate()
{
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, OMV.Vector3.Zero);
PhysicsScene.PE.SetAngularVelocity(PhysBody, OMV.Vector3.Zero);
PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, OMV.Vector3.Zero);
PhysScene.PE.SetAngularVelocity(PhysBody, OMV.Vector3.Zero);
// The next also get rid of applied linear force but the linear velocity is untouched.
PhysicsScene.PE.ClearForces(PhysBody);
PhysScene.PE.ClearForces(PhysBody);
}
});
}
@ -286,7 +286,7 @@ public sealed class BSCharacter : BSPhysObject
set {
_position = value;
PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate()
PhysScene.TaintedObject("BSCharacter.setPosition", delegate()
{
DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
PositionSanityCheck();
@ -296,14 +296,14 @@ public sealed class BSCharacter : BSPhysObject
}
public override OMV.Vector3 ForcePosition {
get {
_position = PhysicsScene.PE.GetPosition(PhysBody);
_position = PhysScene.PE.GetPosition(PhysBody);
return _position;
}
set {
_position = value;
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
PhysScene.PE.SetTranslation(PhysBody, _position, _orientation);
}
}
}
@ -317,18 +317,18 @@ public sealed class BSCharacter : BSPhysObject
bool ret = false;
// TODO: check for out of bounds
if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition))
if (!PhysScene.TerrainManager.IsWithinKnownTerrain(RawPosition))
{
// The character is out of the known/simulated area.
// Force the avatar position to be within known. ScenePresence will use the position
// plus the velocity to decide if the avatar is moving out of the region.
RawPosition = PhysicsScene.TerrainManager.ClampPositionIntoKnownTerrain(RawPosition);
RawPosition = PhysScene.TerrainManager.ClampPositionIntoKnownTerrain(RawPosition);
DetailLog("{0},BSCharacter.PositionSanityCheck,notWithinKnownTerrain,clampedPos={1}", LocalID, RawPosition);
return true;
}
// If below the ground, move the avatar up
float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition);
float terrainHeight = PhysScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition);
if (Position.Z < terrainHeight)
{
DetailLog("{0},BSCharacter.PositionSanityCheck,adjustForUnderGround,pos={1},terrain={2}", LocalID, _position, terrainHeight);
@ -337,7 +337,7 @@ public sealed class BSCharacter : BSPhysObject
}
if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0)
{
float waterHeight = PhysicsScene.TerrainManager.GetWaterLevelAtXYZ(_position);
float waterHeight = PhysScene.TerrainManager.GetWaterLevelAtXYZ(_position);
if (Position.Z < waterHeight)
{
_position.Z = waterHeight;
@ -358,7 +358,7 @@ public sealed class BSCharacter : BSPhysObject
{
// The new position value must be pushed into the physics engine but we can't
// just assign to "Position" because of potential call loops.
PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate()
PhysScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate()
{
DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation);
ForcePosition = _position;
@ -376,8 +376,8 @@ public sealed class BSCharacter : BSPhysObject
}
public override void UpdatePhysicalMassProperties(float physMass, bool inWorld)
{
OMV.Vector3 localInertia = PhysicsScene.PE.CalculateLocalInertia(PhysShape.physShapeInfo, physMass);
PhysicsScene.PE.SetMassProps(PhysBody, physMass, localInertia);
OMV.Vector3 localInertia = PhysScene.PE.CalculateLocalInertia(PhysShape.physShapeInfo, physMass);
PhysScene.PE.SetMassProps(PhysBody, physMass, localInertia);
}
public override OMV.Vector3 Force {
@ -385,11 +385,11 @@ public sealed class BSCharacter : BSPhysObject
set {
RawForce = value;
// m_log.DebugFormat("{0}: Force = {1}", LogHeader, _force);
PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate()
PhysScene.TaintedObject("BSCharacter.SetForce", delegate()
{
DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, RawForce);
if (PhysBody.HasPhysicalBody)
PhysicsScene.PE.SetObjectForce(PhysBody, RawForce);
PhysScene.PE.SetObjectForce(PhysBody, RawForce);
});
}
}
@ -432,7 +432,7 @@ public sealed class BSCharacter : BSPhysObject
set {
RawVelocity = value;
// m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, RawVelocity);
PhysicsScene.TaintedObject("BSCharacter.setVelocity", delegate()
PhysScene.TaintedObject("BSCharacter.setVelocity", delegate()
{
if (m_moveActor != null)
m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, true /* inTaintTime */);
@ -445,11 +445,11 @@ public sealed class BSCharacter : BSPhysObject
public override OMV.Vector3 ForceVelocity {
get { return RawVelocity; }
set {
PhysicsScene.AssertInTaintTime("BSCharacter.ForceVelocity");
PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity");
RawVelocity = value;
PhysicsScene.PE.SetLinearVelocity(PhysBody, RawVelocity);
PhysicsScene.PE.Activate(PhysBody, true);
PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity);
PhysScene.PE.Activate(PhysBody, true);
}
}
public override OMV.Vector3 Torque {
@ -479,7 +479,7 @@ public sealed class BSCharacter : BSPhysObject
if (_orientation != value)
{
_orientation = value;
PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate()
PhysScene.TaintedObject("BSCharacter.setOrientation", delegate()
{
ForceOrientation = _orientation;
});
@ -491,7 +491,7 @@ public sealed class BSCharacter : BSPhysObject
{
get
{
_orientation = PhysicsScene.PE.GetOrientation(PhysBody);
_orientation = PhysScene.PE.GetOrientation(PhysBody);
return _orientation;
}
set
@ -500,7 +500,7 @@ public sealed class BSCharacter : BSPhysObject
if (PhysBody.HasPhysicalBody)
{
// _position = PhysicsScene.PE.GetPosition(BSBody);
PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
PhysScene.PE.SetTranslation(PhysBody, _position, _orientation);
}
}
}
@ -549,14 +549,14 @@ public sealed class BSCharacter : BSPhysObject
public override bool FloatOnWater {
set {
_floatOnWater = value;
PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate()
PhysScene.TaintedObject("BSCharacter.setFloatOnWater", delegate()
{
if (PhysBody.HasPhysicalBody)
{
if (_floatOnWater)
CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
else
CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
}
});
}
@ -577,7 +577,7 @@ public sealed class BSCharacter : BSPhysObject
public override float Buoyancy {
get { return _buoyancy; }
set { _buoyancy = value;
PhysicsScene.TaintedObject("BSCharacter.setBuoyancy", delegate()
PhysScene.TaintedObject("BSCharacter.setBuoyancy", delegate()
{
DetailLog("{0},BSCharacter.setBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
ForceBuoyancy = _buoyancy;
@ -587,7 +587,7 @@ public sealed class BSCharacter : BSPhysObject
public override float ForceBuoyancy {
get { return _buoyancy; }
set {
PhysicsScene.AssertInTaintTime("BSCharacter.ForceBuoyancy");
PhysScene.AssertInTaintTime("BSCharacter.ForceBuoyancy");
_buoyancy = value;
DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
@ -595,7 +595,7 @@ public sealed class BSCharacter : BSPhysObject
float grav = BSParam.Gravity * (1f - _buoyancy);
Gravity = new OMV.Vector3(0f, 0f, grav);
if (PhysBody.HasPhysicalBody)
PhysicsScene.PE.SetGravity(PhysBody, Gravity);
PhysScene.PE.SetGravity(PhysBody, Gravity);
}
}
@ -613,7 +613,7 @@ public sealed class BSCharacter : BSPhysObject
public override void AddForce(OMV.Vector3 force, bool pushforce)
{
// Since this force is being applied in only one step, make this a force per second.
OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep;
OMV.Vector3 addForce = force / PhysScene.LastTimeStep;
AddForce(addForce, pushforce, false);
}
private void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
@ -622,13 +622,13 @@ public sealed class BSCharacter : BSPhysObject
OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
// DetailLog("{0},BSCharacter.addForce,call,force={1}", LocalID, addForce);
PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.AddForce", delegate()
PhysScene.TaintedObject(inTaintTime, "BSCharacter.AddForce", delegate()
{
// Bullet adds this central force to the total force for this tick
// DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce);
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.ApplyCentralForce(PhysBody, addForce);
PhysScene.PE.ApplyCentralForce(PhysBody, addForce);
}
});
}

View File

@ -789,7 +789,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
if ((m_knownHas & m_knownChangedTerrainHeight) == 0 || pos != lastRememberedHeightPos)
{
lastRememberedHeightPos = pos;
m_knownTerrainHeight = ControllingPrim.PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos);
m_knownTerrainHeight = ControllingPrim.PhysScene.TerrainManager.GetTerrainHeightAtXYZ(pos);
m_knownHas |= m_knownChangedTerrainHeight;
}
return m_knownTerrainHeight;
@ -801,7 +801,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
{
if ((m_knownHas & m_knownChangedWaterLevel) == 0)
{
m_knownWaterLevel = ControllingPrim.PhysicsScene.TerrainManager.GetWaterLevelAtXYZ(pos);
m_knownWaterLevel = ControllingPrim.PhysScene.TerrainManager.GetWaterLevelAtXYZ(pos);
m_knownHas |= m_knownChangedWaterLevel;
}
return (float)m_knownWaterLevel;
@ -1637,8 +1637,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// Invoke the detailed logger and output something if it's enabled.
private void VDetailLog(string msg, params Object[] args)
{
if (ControllingPrim.PhysicsScene.VehicleLoggingEnabled)
ControllingPrim.PhysicsScene.DetailLog(msg, args);
if (ControllingPrim.PhysScene.VehicleLoggingEnabled)
ControllingPrim.PhysScene.DetailLog(msg, args);
}
}
}

View File

@ -80,7 +80,7 @@ public abstract class BSLinkset
public BSPrimLinkable LinksetRoot { get; protected set; }
public BSScene PhysicsScene { get; private set; }
protected BSScene m_physicsScene { get; private set; }
static int m_nextLinksetID = 1;
public int LinksetID { get; private set; }
@ -115,7 +115,7 @@ public abstract class BSLinkset
// We create LOTS of linksets.
if (m_nextLinksetID <= 0)
m_nextLinksetID = 1;
PhysicsScene = scene;
m_physicsScene = scene;
LinksetRoot = parent;
m_children = new HashSet<BSPrimLinkable>();
LinksetMass = parent.RawMass;
@ -158,7 +158,7 @@ public abstract class BSLinkset
}
// The child is down to a linkset of just itself
return BSLinkset.Factory(PhysicsScene, child);
return BSLinkset.Factory(m_physicsScene, child);
}
// Return 'true' if the passed object is the root object of this linkset
@ -316,8 +316,8 @@ public abstract class BSLinkset
// Invoke the detailed logger and output something if it's enabled.
protected void DetailLog(string msg, params Object[] args)
{
if (PhysicsScene.PhysicsLogging.Enabled)
PhysicsScene.DetailLog(msg, args);
if (m_physicsScene.PhysicsLogging.Enabled)
m_physicsScene.DetailLog(msg, args);
}
}

View File

@ -121,7 +121,7 @@ public sealed class BSLinksetCompound : BSLinkset
// If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
if (!Rebuilding && HasAnyChildren)
{
PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate()
m_physicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate()
{
if (HasAnyChildren)
RecomputeLinksetCompound();
@ -147,10 +147,10 @@ public sealed class BSLinksetCompound : BSLinkset
{
// The origional prims are removed from the world as the shape of the root compound
// shape takes over.
PhysicsScene.PE.AddToCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
PhysicsScene.PE.ForceActivationState(child.PhysBody, ActivationState.DISABLE_SIMULATION);
m_physicsScene.PE.AddToCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
m_physicsScene.PE.ForceActivationState(child.PhysBody, ActivationState.DISABLE_SIMULATION);
// We don't want collisions from the old linkset children.
PhysicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
m_physicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
child.PhysBody.collisionType = CollisionType.LinksetChild;
@ -175,12 +175,12 @@ public sealed class BSLinksetCompound : BSLinkset
else
{
// The non-physical children can come back to life.
PhysicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
m_physicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
child.PhysBody.collisionType = CollisionType.LinksetChild;
// Don't force activation so setting of DISABLE_SIMULATION can stay if used.
PhysicsScene.PE.Activate(child.PhysBody, false);
m_physicsScene.PE.Activate(child.PhysBody, false);
ret = true;
}
return ret;
@ -196,7 +196,7 @@ public sealed class BSLinksetCompound : BSLinkset
// but it also means all the child positions get updated.
// What would cause an unnecessary rebuild so we make sure the linkset is in a
// region before bothering to do a rebuild.
if (!IsRoot(updated) && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
if (!IsRoot(updated) && m_physicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
{
// If a child of the linkset is updating only the position or rotation, that can be done
// without rebuilding the linkset.
@ -209,21 +209,21 @@ public sealed class BSLinksetCompound : BSLinkset
if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0)
{
// Find the physical instance of the child
if (LinksetRoot.PhysShape.HasPhysicalShape && PhysicsScene.PE.IsCompound(LinksetRoot.PhysShape.physShapeInfo))
if (LinksetRoot.PhysShape.HasPhysicalShape && m_physicsScene.PE.IsCompound(LinksetRoot.PhysShape.physShapeInfo))
{
// It is possible that the linkset is still under construction and the child is not yet
// inserted into the compound shape. A rebuild of the linkset in a pre-step action will
// build the whole thing with the new position or rotation.
// The index must be checked because Bullet references the child array but does no validity
// checking of the child index passed.
int numLinksetChildren = PhysicsScene.PE.GetNumberOfCompoundChildren(LinksetRoot.PhysShape.physShapeInfo);
int numLinksetChildren = m_physicsScene.PE.GetNumberOfCompoundChildren(LinksetRoot.PhysShape.physShapeInfo);
if (updated.LinksetChildIndex < numLinksetChildren)
{
BulletShape linksetChildShape = PhysicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex);
BulletShape linksetChildShape = m_physicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex);
if (linksetChildShape.HasPhysicalShape)
{
// Found the child shape within the compound shape
PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex,
m_physicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex,
updated.RawPosition - LinksetRoot.RawPosition,
updated.RawOrientation * OMV.Quaternion.Inverse(LinksetRoot.RawOrientation),
true /* shouldRecalculateLocalAabb */);
@ -401,9 +401,9 @@ public sealed class BSLinksetCompound : BSLinkset
// Here we build the compound shape made up of all the children.
// Free up any shape we'd previously built.
LinksetShape.Dereference(PhysicsScene);
LinksetShape.Dereference(m_physicsScene);
LinksetShape = BSShapeCompound.GetReference(PhysicsScene, LinksetRoot);
LinksetShape = BSShapeCompound.GetReference(m_physicsScene, LinksetRoot);
// The center of mass for the linkset is the geometric center of the group.
// Compute a displacement for each component so it is relative to the center-of-mass.
@ -435,7 +435,7 @@ public sealed class BSLinksetCompound : BSLinkset
childShape.IncrementReference();
OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement;
OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation;
PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot);
m_physicsScene.PE.AddChildShapeToCompoundShape(LinksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot);
DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},rShape={2},cShape={3},offPos={4},offRot={5}",
LinksetRoot.LocalID, memberIndex, LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot);
@ -446,14 +446,14 @@ public sealed class BSLinksetCompound : BSLinkset
// Sneak the built compound shape in as the shape of the root prim.
// Note this doesn't touch the root prim's PhysShape so be sure the manage the difference.
PhysicsScene.PE.SetCollisionShape(PhysicsScene.World, LinksetRoot.PhysBody, LinksetShape.physShapeInfo);
m_physicsScene.PE.SetCollisionShape(m_physicsScene.World, LinksetRoot.PhysBody, LinksetShape.physShapeInfo);
// With all of the linkset packed into the root prim, it has the mass of everyone.
LinksetMass = ComputeLinksetMass();
LinksetRoot.UpdatePhysicalMassProperties(LinksetMass, true);
// Enable the physical position updator to return the position and rotation of the root shape
PhysicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE);
m_physicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE);
}
finally
{
@ -461,7 +461,7 @@ public sealed class BSLinksetCompound : BSLinkset
}
// See that the Aabb surrounds the new shape
PhysicsScene.PE.RecalculateCompoundShapeLocalAabb(LinksetRoot.PhysShape.physShapeInfo);
m_physicsScene.PE.RecalculateCompoundShapeLocalAabb(LinksetRoot.PhysShape.physShapeInfo);
}
}
}

View File

@ -51,7 +51,7 @@ public sealed class BSLinksetConstraints : BSLinkset
if (HasAnyChildren && IsRoot(requestor))
{
// Queue to happen after all the other taint processing
PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
m_physicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
{
if (HasAnyChildren && IsRoot(requestor))
RecomputeLinksetConstraints();
@ -142,7 +142,7 @@ public sealed class BSLinksetConstraints : BSLinkset
rootx.LocalID, rootx.PhysBody.AddrString,
childx.LocalID, childx.PhysBody.AddrString);
PhysicsScene.TaintedObject("BSLinksetConstraints.RemoveChildFromLinkset", delegate()
m_physicsScene.TaintedObject("BSLinksetConstraints.RemoveChildFromLinkset", delegate()
{
PhysicallyUnlinkAChildFromRoot(rootx, childx);
});
@ -187,7 +187,7 @@ public sealed class BSLinksetConstraints : BSLinkset
// http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
BSConstraint6Dof constrain = new BSConstraint6Dof(
PhysicsScene.World, rootPrim.PhysBody, childPrim.PhysBody, midPoint, true, true );
m_physicsScene.World, rootPrim.PhysBody, childPrim.PhysBody, midPoint, true, true );
// PhysicsScene.World, childPrim.BSBody, rootPrim.BSBody, midPoint, true, true );
/* NOTE: below is an attempt to build constraint with full frame computation, etc.
@ -216,7 +216,7 @@ public sealed class BSLinksetConstraints : BSLinkset
// ==================================================================================
*/
PhysicsScene.Constraints.AddConstraint(constrain);
m_physicsScene.Constraints.AddConstraint(constrain);
// zero linear and angular limits makes the objects unable to move in relation to each other
constrain.SetLinearLimits(OMV.Vector3.Zero, OMV.Vector3.Zero);
@ -248,10 +248,10 @@ public sealed class BSLinksetConstraints : BSLinkset
childPrim.LocalID, childPrim.PhysBody.AddrString);
// Find the constraint for this link and get rid of it from the overall collection and from my list
if (PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody, childPrim.PhysBody))
if (m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody, childPrim.PhysBody))
{
// Make the child refresh its location
PhysicsScene.PE.PushUpdate(childPrim.PhysBody);
m_physicsScene.PE.PushUpdate(childPrim.PhysBody);
ret = true;
}
@ -265,7 +265,7 @@ public sealed class BSLinksetConstraints : BSLinkset
{
DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID);
return PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody);
return m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody);
}
// Call each of the constraints that make up this linkset and recompute the
@ -289,7 +289,7 @@ public sealed class BSLinksetConstraints : BSLinkset
child.UpdatePhysicalMassProperties(linksetMass, true);
BSConstraint constrain;
if (!PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, child.PhysBody, out constrain))
if (!m_physicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, child.PhysBody, out constrain))
{
// If constraint doesn't exist yet, create it.
constrain = BuildConstraint(LinksetRoot, child);

View File

@ -72,14 +72,14 @@ public abstract class BSPhysObject : PhysicsActor
}
protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
{
PhysicsScene = parentScene;
PhysScene = parentScene;
LocalID = localID;
PhysObjectName = name;
Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
TypeName = typeName;
// The collection of things that push me around
PhysicalActors = new BSActorCollection(PhysicsScene);
PhysicalActors = new BSActorCollection(PhysScene);
// Initialize variables kept in base.
GravModifier = 1.0f;
@ -112,13 +112,13 @@ public abstract class BSPhysObject : PhysicsActor
public virtual void Destroy()
{
PhysicalActors.Enable(false);
PhysicsScene.TaintedObject("BSPhysObject.Destroy", delegate()
PhysScene.TaintedObject("BSPhysObject.Destroy", delegate()
{
PhysicalActors.Dispose();
});
}
public BSScene PhysicsScene { get; protected set; }
public BSScene PhysScene { get; protected set; }
// public override uint LocalID { get; set; } // Use the LocalID definition in PhysicsActor
public string PhysObjectName { get; protected set; }
public string TypeName { get; protected set; }
@ -270,7 +270,7 @@ public abstract class BSPhysObject : PhysicsActor
public void ActivateIfPhysical(bool forceIt)
{
if (IsPhysical && PhysBody.HasPhysicalBody)
PhysicsScene.PE.Activate(PhysBody, forceIt);
PhysScene.PE.Activate(PhysBody, forceIt);
}
// 'actors' act on the physical object to change or constrain its motion. These can range from
@ -333,29 +333,29 @@ public abstract class BSPhysObject : PhysicsActor
protected long CollisionAccumulation { get; set; }
public override bool IsColliding {
get { return (CollidingStep == PhysicsScene.SimulationStep); }
get { return (CollidingStep == PhysScene.SimulationStep); }
set {
if (value)
CollidingStep = PhysicsScene.SimulationStep;
CollidingStep = PhysScene.SimulationStep;
else
CollidingStep = 0;
}
}
public override bool CollidingGround {
get { return (CollidingGroundStep == PhysicsScene.SimulationStep); }
get { return (CollidingGroundStep == PhysScene.SimulationStep); }
set
{
if (value)
CollidingGroundStep = PhysicsScene.SimulationStep;
CollidingGroundStep = PhysScene.SimulationStep;
else
CollidingGroundStep = 0;
}
}
public override bool CollidingObj {
get { return (CollidingObjectStep == PhysicsScene.SimulationStep); }
get { return (CollidingObjectStep == PhysScene.SimulationStep); }
set {
if (value)
CollidingObjectStep = PhysicsScene.SimulationStep;
CollidingObjectStep = PhysScene.SimulationStep;
else
CollidingObjectStep = 0;
}
@ -380,14 +380,14 @@ public abstract class BSPhysObject : PhysicsActor
bool ret = false;
// The following lines make IsColliding(), CollidingGround() and CollidingObj work
CollidingStep = PhysicsScene.SimulationStep;
if (collidingWith <= PhysicsScene.TerrainManager.HighestTerrainID)
CollidingStep = PhysScene.SimulationStep;
if (collidingWith <= PhysScene.TerrainManager.HighestTerrainID)
{
CollidingGroundStep = PhysicsScene.SimulationStep;
CollidingGroundStep = PhysScene.SimulationStep;
}
else
{
CollidingObjectStep = PhysicsScene.SimulationStep;
CollidingObjectStep = PhysScene.SimulationStep;
}
CollisionAccumulation++;
@ -397,10 +397,10 @@ public abstract class BSPhysObject : PhysicsActor
// Make a collection of the collisions that happened the last simulation tick.
// This is different than the collection created for sending up to the simulator as it is cleared every tick.
if (CollisionsLastTickStep != PhysicsScene.SimulationStep)
if (CollisionsLastTickStep != PhysScene.SimulationStep)
{
CollisionsLastTick = new CollisionEventUpdate();
CollisionsLastTickStep = PhysicsScene.SimulationStep;
CollisionsLastTickStep = PhysScene.SimulationStep;
}
CollisionsLastTick.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
@ -427,9 +427,9 @@ public abstract class BSPhysObject : PhysicsActor
bool force = (CollisionCollection.Count == 0 && CollisionsLastReported.Count != 0);
// throttle the collisions to the number of milliseconds specified in the subscription
if (force || (PhysicsScene.SimulationNowTime >= NextCollisionOkTime))
if (force || (PhysScene.SimulationNowTime >= NextCollisionOkTime))
{
NextCollisionOkTime = PhysicsScene.SimulationNowTime + SubscribedEventsMs;
NextCollisionOkTime = PhysScene.SimulationNowTime + SubscribedEventsMs;
// We are called if we previously had collisions. If there are no collisions
// this time, send up one last empty event so OpenSim can sense collision end.
@ -464,10 +464,10 @@ public abstract class BSPhysObject : PhysicsActor
// make sure first collision happens
NextCollisionOkTime = Util.EnvironmentTickCountSubtract(SubscribedEventsMs);
PhysicsScene.TaintedObject(TypeName+".SubscribeEvents", delegate()
PhysScene.TaintedObject(TypeName+".SubscribeEvents", delegate()
{
if (PhysBody.HasPhysicalBody)
CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
});
}
else
@ -479,11 +479,11 @@ public abstract class BSPhysObject : PhysicsActor
public override void UnSubscribeEvents() {
// DetailLog("{0},{1}.UnSubscribeEvents,unsubscribing", LocalID, TypeName);
SubscribedEventsMs = 0;
PhysicsScene.TaintedObject(TypeName+".UnSubscribeEvents", delegate()
PhysScene.TaintedObject(TypeName+".UnSubscribeEvents", delegate()
{
// Make sure there is a body there because sometimes destruction happens in an un-ideal order.
if (PhysBody.HasPhysicalBody)
CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
});
}
// Return 'true' if the simulator wants collision events
@ -497,7 +497,7 @@ public abstract class BSPhysObject : PhysicsActor
{
// Scale the collision count by the time since the last collision.
// The "+1" prevents dividing by zero.
long timeAgo = PhysicsScene.SimulationStep - CollidingStep + 1;
long timeAgo = PhysScene.SimulationStep - CollidingStep + 1;
CollisionScore = CollisionAccumulation / timeAgo;
}
public override float CollisionScore { get; set; }
@ -524,8 +524,8 @@ public abstract class BSPhysObject : PhysicsActor
// High performance detailed logging routine used by the physical objects.
protected void DetailLog(string msg, params Object[] args)
{
if (PhysicsScene.PhysicsLogging.Enabled)
PhysicsScene.DetailLog(msg, args);
if (PhysScene.PhysicsLogging.Enabled)
PhysScene.DetailLog(msg, args);
}
}

View File

@ -101,21 +101,21 @@ public class BSPrim : BSPhysObject
_isVolumeDetect = false;
// We keep a handle to the vehicle actor so we can set vehicle parameters later.
VehicleActor = new BSDynamics(PhysicsScene, this, VehicleActorName);
VehicleActor = new BSDynamics(PhysScene, this, VehicleActorName);
PhysicalActors.Add(VehicleActorName, VehicleActor);
_mass = CalculateMass();
// DetailLog("{0},BSPrim.constructor,call", LocalID);
// do the actual object creation at taint time
PhysicsScene.TaintedObject("BSPrim.create", delegate()
PhysScene.TaintedObject("BSPrim.create", delegate()
{
// Make sure the object is being created with some sanity.
ExtremeSanityCheck(true /* inTaintTime */);
CreateGeomAndObject(true);
CurrentCollisionFlags = PhysicsScene.PE.GetCollisionFlags(PhysBody);
CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody);
});
}
@ -128,13 +128,13 @@ public class BSPrim : BSPhysObject
// Undo any vehicle properties
this.VehicleType = (int)Vehicle.TYPE_NONE;
PhysicsScene.TaintedObject("BSPrim.Destroy", delegate()
PhysScene.TaintedObject("BSPrim.Destroy", delegate()
{
DetailLog("{0},BSPrim.Destroy,taint,", LocalID);
// If there are physical body and shape, release my use of same.
PhysicsScene.Shapes.DereferenceBody(PhysBody, null);
PhysScene.Shapes.DereferenceBody(PhysBody, null);
PhysBody.Clear();
PhysShape.Dereference(PhysicsScene);
PhysShape.Dereference(PhysScene);
PhysShape = new BSShapeNull();
});
}
@ -163,7 +163,7 @@ public class BSPrim : BSPhysObject
}
public override bool ForceBodyShapeRebuild(bool inTaintTime)
{
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ForceBodyShapeRebuild", delegate()
PhysScene.TaintedObject(inTaintTime, "BSPrim.ForceBodyShapeRebuild", delegate()
{
_mass = CalculateMass(); // changing the shape changes the mass
CreateGeomAndObject(true);
@ -180,7 +180,7 @@ public class BSPrim : BSPhysObject
if (value != _isSelected)
{
_isSelected = value;
PhysicsScene.TaintedObject("BSPrim.setSelected", delegate()
PhysScene.TaintedObject("BSPrim.setSelected", delegate()
{
DetailLog("{0},BSPrim.selected,taint,selected={1}", LocalID, _isSelected);
SetObjectDynamic(false);
@ -226,23 +226,23 @@ public class BSPrim : BSPhysObject
_rotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties in the physics engine
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
PhysScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
{
if (PhysBody.HasPhysicalBody)
PhysicsScene.PE.ClearAllForces(PhysBody);
PhysScene.PE.ClearAllForces(PhysBody);
});
}
public override void ZeroAngularMotion(bool inTaintTime)
{
_rotationalVelocity = OMV.Vector3.Zero;
// Zero some other properties in the physics engine
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
PhysScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate()
{
// DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity);
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity);
PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity);
PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity);
PhysScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity);
}
});
}
@ -260,11 +260,11 @@ public class BSPrim : BSPhysObject
EnableActor(LockedAxis != LockedAxisFree, LockedAxisActorName, delegate()
{
return new BSActorLockAxis(PhysicsScene, this, LockedAxisActorName);
return new BSActorLockAxis(PhysScene, this, LockedAxisActorName);
});
// Update parameters so the new actor's Refresh() action is called at the right time.
PhysicsScene.TaintedObject("BSPrim.LockAngularMotion", delegate()
PhysScene.TaintedObject("BSPrim.LockAngularMotion", delegate()
{
UpdatePhysicalParameters();
});
@ -294,7 +294,7 @@ public class BSPrim : BSPhysObject
_position = value;
PositionSanityCheck(false);
PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
PhysScene.TaintedObject("BSPrim.setPosition", delegate()
{
DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
ForcePosition = _position;
@ -304,14 +304,14 @@ public class BSPrim : BSPhysObject
public override OMV.Vector3 ForcePosition {
get {
_position = PhysicsScene.PE.GetPosition(PhysBody);
_position = PhysScene.PE.GetPosition(PhysBody);
return _position;
}
set {
_position = value;
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
PhysScene.PE.SetTranslation(PhysBody, _position, _orientation);
ActivateIfPhysical(false);
}
}
@ -328,7 +328,7 @@ public class BSPrim : BSPhysObject
if (!IsPhysicallyActive)
return ret;
if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition))
if (!PhysScene.TerrainManager.IsWithinKnownTerrain(RawPosition))
{
// The physical object is out of the known/simulated area.
// Upper levels of code will handle the transition to other areas so, for
@ -336,7 +336,7 @@ public class BSPrim : BSPhysObject
return ret;
}
float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition);
float terrainHeight = PhysScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition);
OMV.Vector3 upForce = OMV.Vector3.Zero;
float approxSize = Math.Max(Size.X, Math.Max(Size.Y, Size.Z));
if ((RawPosition.Z + approxSize / 2f) < terrainHeight)
@ -357,7 +357,7 @@ public class BSPrim : BSPhysObject
if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0)
{
float waterHeight = PhysicsScene.TerrainManager.GetWaterLevelAtXYZ(_position);
float waterHeight = PhysScene.TerrainManager.GetWaterLevelAtXYZ(_position);
// TODO: a floating motor so object will bob in the water
if (Math.Abs(RawPosition.Z - waterHeight) > 0.1f)
{
@ -365,7 +365,7 @@ public class BSPrim : BSPhysObject
upForce.Z = (waterHeight - RawPosition.Z) * 1f;
// Apply upforce and overcome gravity.
OMV.Vector3 correctionForce = upForce - PhysicsScene.DefaultGravity;
OMV.Vector3 correctionForce = upForce - PhysScene.DefaultGravity;
DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, _position, upForce, correctionForce);
AddForce(correctionForce, false, inTaintTime);
ret = true;
@ -431,10 +431,10 @@ public class BSPrim : BSPhysObject
{
if (IsStatic)
{
PhysicsScene.PE.SetGravity(PhysBody, PhysicsScene.DefaultGravity);
PhysScene.PE.SetGravity(PhysBody, PhysScene.DefaultGravity);
Inertia = OMV.Vector3.Zero;
PhysicsScene.PE.SetMassProps(PhysBody, 0f, Inertia);
PhysicsScene.PE.UpdateInertiaTensor(PhysBody);
PhysScene.PE.SetMassProps(PhysBody, 0f, Inertia);
PhysScene.PE.UpdateInertiaTensor(PhysBody);
}
else
{
@ -443,16 +443,16 @@ public class BSPrim : BSPhysObject
// Changing interesting properties doesn't change proxy and collision cache
// information. The Bullet solution is to re-add the object to the world
// after parameters are changed.
PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody);
PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody);
}
// The computation of mass props requires gravity to be set on the object.
Gravity = ComputeGravity(Buoyancy);
PhysicsScene.PE.SetGravity(PhysBody, Gravity);
PhysScene.PE.SetGravity(PhysBody, Gravity);
Inertia = PhysicsScene.PE.CalculateLocalInertia(PhysShape.physShapeInfo, physMass);
PhysicsScene.PE.SetMassProps(PhysBody, physMass, Inertia);
PhysicsScene.PE.UpdateInertiaTensor(PhysBody);
Inertia = PhysScene.PE.CalculateLocalInertia(PhysShape.physShapeInfo, physMass);
PhysScene.PE.SetMassProps(PhysBody, physMass, Inertia);
PhysScene.PE.UpdateInertiaTensor(PhysBody);
DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2},grav={3},inWorld={4}",
LocalID, physMass, Inertia, Gravity, inWorld);
@ -468,7 +468,7 @@ public class BSPrim : BSPhysObject
// Return what gravity should be set to this very moment
public OMV.Vector3 ComputeGravity(float buoyancy)
{
OMV.Vector3 ret = PhysicsScene.DefaultGravity;
OMV.Vector3 ret = PhysScene.DefaultGravity;
if (!IsStatic)
{
@ -497,7 +497,7 @@ public class BSPrim : BSPhysObject
RawForce = value;
EnableActor(RawForce != OMV.Vector3.Zero, SetForceActorName, delegate()
{
return new BSActorSetForce(PhysicsScene, this, SetForceActorName);
return new BSActorSetForce(PhysScene, this, SetForceActorName);
});
}
}
@ -509,7 +509,7 @@ public class BSPrim : BSPhysObject
set {
Vehicle type = (Vehicle)value;
PhysicsScene.TaintedObject("setVehicleType", delegate()
PhysScene.TaintedObject("setVehicleType", delegate()
{
// Vehicle code changes the parameters for this vehicle type.
VehicleActor.ProcessTypeChange(type);
@ -519,7 +519,7 @@ public class BSPrim : BSPhysObject
}
public override void VehicleFloatParam(int param, float value)
{
PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
PhysScene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
{
VehicleActor.ProcessFloatVehicleParam((Vehicle)param, value);
ActivateIfPhysical(false);
@ -527,7 +527,7 @@ public class BSPrim : BSPhysObject
}
public override void VehicleVectorParam(int param, OMV.Vector3 value)
{
PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
PhysScene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
{
VehicleActor.ProcessVectorVehicleParam((Vehicle)param, value);
ActivateIfPhysical(false);
@ -535,7 +535,7 @@ public class BSPrim : BSPhysObject
}
public override void VehicleRotationParam(int param, OMV.Quaternion rotation)
{
PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
PhysScene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
{
VehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation);
ActivateIfPhysical(false);
@ -543,7 +543,7 @@ public class BSPrim : BSPhysObject
}
public override void VehicleFlags(int param, bool remove)
{
PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate()
PhysScene.TaintedObject("BSPrim.VehicleFlags", delegate()
{
VehicleActor.ProcessVehicleFlags(param, remove);
});
@ -555,7 +555,7 @@ public class BSPrim : BSPhysObject
if (_isVolumeDetect != newValue)
{
_isVolumeDetect = newValue;
PhysicsScene.TaintedObject("BSPrim.SetVolumeDetect", delegate()
PhysScene.TaintedObject("BSPrim.SetVolumeDetect", delegate()
{
// DetailLog("{0},setVolumeDetect,taint,volDetect={1}", LocalID, _isVolumeDetect);
SetObjectDynamic(true);
@ -566,7 +566,7 @@ public class BSPrim : BSPhysObject
public override void SetMaterial(int material)
{
base.SetMaterial(material);
PhysicsScene.TaintedObject("BSPrim.SetMaterial", delegate()
PhysScene.TaintedObject("BSPrim.SetMaterial", delegate()
{
UpdatePhysicalParameters();
});
@ -579,7 +579,7 @@ public class BSPrim : BSPhysObject
if (base.Friction != value)
{
base.Friction = value;
PhysicsScene.TaintedObject("BSPrim.setFriction", delegate()
PhysScene.TaintedObject("BSPrim.setFriction", delegate()
{
UpdatePhysicalParameters();
});
@ -594,7 +594,7 @@ public class BSPrim : BSPhysObject
if (base.Restitution != value)
{
base.Restitution = value;
PhysicsScene.TaintedObject("BSPrim.setRestitution", delegate()
PhysScene.TaintedObject("BSPrim.setRestitution", delegate()
{
UpdatePhysicalParameters();
});
@ -611,7 +611,7 @@ public class BSPrim : BSPhysObject
if (base.Density != value)
{
base.Density = value;
PhysicsScene.TaintedObject("BSPrim.setDensity", delegate()
PhysScene.TaintedObject("BSPrim.setDensity", delegate()
{
UpdatePhysicalParameters();
});
@ -626,7 +626,7 @@ public class BSPrim : BSPhysObject
if (base.GravModifier != value)
{
base.GravModifier = value;
PhysicsScene.TaintedObject("BSPrim.setGravityModifier", delegate()
PhysScene.TaintedObject("BSPrim.setGravityModifier", delegate()
{
UpdatePhysicalParameters();
});
@ -637,7 +637,7 @@ public class BSPrim : BSPhysObject
get { return RawVelocity; }
set {
RawVelocity = value;
PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate()
PhysScene.TaintedObject("BSPrim.setVelocity", delegate()
{
// DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, RawVelocity);
ForceVelocity = RawVelocity;
@ -647,13 +647,13 @@ public class BSPrim : BSPhysObject
public override OMV.Vector3 ForceVelocity {
get { return RawVelocity; }
set {
PhysicsScene.AssertInTaintTime("BSPrim.ForceVelocity");
PhysScene.AssertInTaintTime("BSPrim.ForceVelocity");
RawVelocity = Util.ClampV(value, BSParam.MaxLinearVelocity);
if (PhysBody.HasPhysicalBody)
{
DetailLog("{0},BSPrim.ForceVelocity,taint,vel={1}", LocalID, RawVelocity);
PhysicsScene.PE.SetLinearVelocity(PhysBody, RawVelocity);
PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity);
ActivateIfPhysical(false);
}
}
@ -664,7 +664,7 @@ public class BSPrim : BSPhysObject
RawTorque = value;
EnableActor(RawTorque != OMV.Vector3.Zero, SetTorqueActorName, delegate()
{
return new BSActorSetTorque(PhysicsScene, this, SetTorqueActorName);
return new BSActorSetTorque(PhysScene, this, SetTorqueActorName);
});
DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, RawTorque);
}
@ -687,7 +687,7 @@ public class BSPrim : BSPhysObject
return;
_orientation = value;
PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate()
PhysScene.TaintedObject("BSPrim.setOrientation", delegate()
{
ForceOrientation = _orientation;
});
@ -698,14 +698,14 @@ public class BSPrim : BSPhysObject
{
get
{
_orientation = PhysicsScene.PE.GetOrientation(PhysBody);
_orientation = PhysScene.PE.GetOrientation(PhysBody);
return _orientation;
}
set
{
_orientation = value;
if (PhysBody.HasPhysicalBody)
PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
PhysScene.PE.SetTranslation(PhysBody, _position, _orientation);
}
}
public override int PhysicsActorType {
@ -718,7 +718,7 @@ public class BSPrim : BSPhysObject
if (_isPhysical != value)
{
_isPhysical = value;
PhysicsScene.TaintedObject("BSPrim.setIsPhysical", delegate()
PhysScene.TaintedObject("BSPrim.setIsPhysical", delegate()
{
DetailLog("{0},setIsPhysical,taint,isPhys={1}", LocalID, _isPhysical);
SetObjectDynamic(true);
@ -773,7 +773,7 @@ public class BSPrim : BSPhysObject
// Mangling all the physical properties requires the object not be in the physical world.
// This is a NOOP if the object is not in the world (BulletSim and Bullet ignore objects not found).
PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody);
PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody);
// Set up the object physicalness (does gravity and collisions move this object)
MakeDynamic(IsStatic);
@ -790,7 +790,7 @@ public class BSPrim : BSPhysObject
AddObjectToPhysicalWorld();
// Rebuild its shape
PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, PhysBody);
PhysScene.PE.UpdateSingleAabb(PhysScene.World, PhysBody);
DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},cType={6},body={7},shape={8}",
LocalID, IsStatic, IsSolid, Mass, SubscribedEvents(),
@ -807,28 +807,28 @@ public class BSPrim : BSPhysObject
if (makeStatic)
{
// Become a Bullet 'static' object type
CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT);
CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT);
// Stop all movement
ZeroMotion(true);
// Set various physical properties so other object interact properly
PhysicsScene.PE.SetFriction(PhysBody, Friction);
PhysicsScene.PE.SetRestitution(PhysBody, Restitution);
PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
PhysScene.PE.SetFriction(PhysBody, Friction);
PhysScene.PE.SetRestitution(PhysBody, Restitution);
PhysScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
// Mass is zero which disables a bunch of physics stuff in Bullet
UpdatePhysicalMassProperties(0f, false);
// Set collision detection parameters
if (BSParam.CcdMotionThreshold > 0f)
{
PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
PhysScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
PhysScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
}
// The activation state is 'disabled' so Bullet will not try to act on it.
// PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_SIMULATION);
// Start it out sleeping and physical actions could wake it up.
PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ISLAND_SLEEPING);
PhysScene.PE.ForceActivationState(PhysBody, ActivationState.ISLAND_SLEEPING);
// This collides like a static object
PhysBody.collisionType = CollisionType.Static;
@ -836,11 +836,11 @@ public class BSPrim : BSPhysObject
else
{
// Not a Bullet static object
CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT);
CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT);
// Set various physical properties so other object interact properly
PhysicsScene.PE.SetFriction(PhysBody, Friction);
PhysicsScene.PE.SetRestitution(PhysBody, Restitution);
PhysScene.PE.SetFriction(PhysBody, Friction);
PhysScene.PE.SetRestitution(PhysBody, Restitution);
// DetailLog("{0},BSPrim.MakeDynamic,frict={1},rest={2}", LocalID, Friction, Restitution);
// per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382
@ -858,22 +858,22 @@ public class BSPrim : BSPhysObject
// Set collision detection parameters
if (BSParam.CcdMotionThreshold > 0f)
{
PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
PhysScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
PhysScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
}
// Various values for simulation limits
PhysicsScene.PE.SetDamping(PhysBody, BSParam.LinearDamping, BSParam.AngularDamping);
PhysicsScene.PE.SetDeactivationTime(PhysBody, BSParam.DeactivationTime);
PhysicsScene.PE.SetSleepingThresholds(PhysBody, BSParam.LinearSleepingThreshold, BSParam.AngularSleepingThreshold);
PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
PhysScene.PE.SetDamping(PhysBody, BSParam.LinearDamping, BSParam.AngularDamping);
PhysScene.PE.SetDeactivationTime(PhysBody, BSParam.DeactivationTime);
PhysScene.PE.SetSleepingThresholds(PhysBody, BSParam.LinearSleepingThreshold, BSParam.AngularSleepingThreshold);
PhysScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
// This collides like an object.
PhysBody.collisionType = CollisionType.Dynamic;
// Force activation of the object so Bullet will act on it.
// Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects.
PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG);
PhysScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG);
}
}
@ -883,7 +883,7 @@ public class BSPrim : BSPhysObject
// the functions after this one set up the state of a possibly newly created collision body.
private void MakeSolid(bool makeSolid)
{
CollisionObjectTypes bodyType = (CollisionObjectTypes)PhysicsScene.PE.GetBodyType(PhysBody);
CollisionObjectTypes bodyType = (CollisionObjectTypes)PhysScene.PE.GetBodyType(PhysBody);
if (makeSolid)
{
// Verify the previous code created the correct shape for this type of thing.
@ -891,7 +891,7 @@ public class BSPrim : BSPhysObject
{
m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for solidity. id={1}, type={2}", LogHeader, LocalID, bodyType);
}
CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
}
else
{
@ -899,7 +899,7 @@ public class BSPrim : BSPhysObject
{
m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType);
}
CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
// Change collision info from a static object to a ghosty collision object
PhysBody.collisionType = CollisionType.VolumeDetect;
@ -911,11 +911,11 @@ public class BSPrim : BSPhysObject
{
if (wantsCollisionEvents)
{
CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
}
else
{
CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
}
}
@ -926,7 +926,7 @@ public class BSPrim : BSPhysObject
{
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody);
PhysScene.PE.AddObjectToWorld(PhysScene.World, PhysBody);
}
else
{
@ -961,12 +961,12 @@ public class BSPrim : BSPhysObject
public override bool FloatOnWater {
set {
_floatOnWater = value;
PhysicsScene.TaintedObject("BSPrim.setFloatOnWater", delegate()
PhysScene.TaintedObject("BSPrim.setFloatOnWater", delegate()
{
if (_floatOnWater)
CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
else
CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
});
}
}
@ -978,7 +978,7 @@ public class BSPrim : BSPhysObject
_rotationalVelocity = value;
Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity);
// m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
PhysScene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
{
ForceRotationalVelocity = _rotationalVelocity;
});
@ -993,7 +993,7 @@ public class BSPrim : BSPhysObject
if (PhysBody.HasPhysicalBody)
{
DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity);
PhysScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity);
// PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity);
ActivateIfPhysical(false);
}
@ -1009,7 +1009,7 @@ public class BSPrim : BSPhysObject
get { return _buoyancy; }
set {
_buoyancy = value;
PhysicsScene.TaintedObject("BSPrim.setBuoyancy", delegate()
PhysScene.TaintedObject("BSPrim.setBuoyancy", delegate()
{
ForceBuoyancy = _buoyancy;
});
@ -1032,7 +1032,7 @@ public class BSPrim : BSPhysObject
base.MoveToTargetActive = value;
EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate()
{
return new BSActorMoveToTarget(PhysicsScene, this, MoveToTargetActorName);
return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName);
});
}
}
@ -1044,7 +1044,7 @@ public class BSPrim : BSPhysObject
base.HoverActive = value;
EnableActor(HoverActive, HoverActorName, delegate()
{
return new BSActorHover(PhysicsScene, this, HoverActorName);
return new BSActorHover(PhysScene, this, HoverActorName);
});
}
}
@ -1054,7 +1054,7 @@ public class BSPrim : BSPhysObject
OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
// Since this force is being applied in only one step, make this a force per second.
addForce /= PhysicsScene.LastTimeStep;
addForce /= PhysScene.LastTimeStep;
AddForce(addForce, pushforce, false /* inTaintTime */);
}
@ -1069,13 +1069,13 @@ public class BSPrim : BSPhysObject
// DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
OMV.Vector3 addForce = force;
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
PhysScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
{
// Bullet adds this central force to the total force for this tick
DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce);
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.ApplyCentralForce(PhysBody, addForce);
PhysScene.PE.ApplyCentralForce(PhysBody, addForce);
ActivateIfPhysical(false);
}
});
@ -1097,13 +1097,13 @@ public class BSPrim : BSPhysObject
OMV.Vector3 addImpulse = Util.ClampV(impulse, BSParam.MaxAddForceMagnitude);
// DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse);
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate()
PhysScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate()
{
// Bullet adds this impulse immediately to the velocity
DetailLog("{0},BSPrim.addForceImpulse,taint,impulseforce={1}", LocalID, addImpulse);
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.ApplyCentralImpulse(PhysBody, addImpulse);
PhysScene.PE.ApplyCentralImpulse(PhysBody, addImpulse);
ActivateIfPhysical(false);
}
});
@ -1122,12 +1122,12 @@ public class BSPrim : BSPhysObject
if (force.IsFinite())
{
OMV.Vector3 angForce = force;
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddAngularForce", delegate()
PhysScene.TaintedObject(inTaintTime, "BSPrim.AddAngularForce", delegate()
{
if (PhysBody.HasPhysicalBody)
{
DetailLog("{0},BSPrim.AddAngularForce,taint,angForce={1}", LocalID, angForce);
PhysicsScene.PE.ApplyTorque(PhysBody, angForce);
PhysScene.PE.ApplyTorque(PhysBody, angForce);
ActivateIfPhysical(false);
}
});
@ -1146,11 +1146,11 @@ public class BSPrim : BSPhysObject
public void ApplyTorqueImpulse(OMV.Vector3 impulse, bool inTaintTime)
{
OMV.Vector3 applyImpulse = impulse;
PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate()
PhysScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate()
{
if (PhysBody.HasPhysicalBody)
{
PhysicsScene.PE.ApplyTorqueImpulse(PhysBody, applyImpulse);
PhysScene.PE.ApplyTorqueImpulse(PhysBody, applyImpulse);
ActivateIfPhysical(false);
}
});
@ -1452,7 +1452,7 @@ public class BSPrim : BSPhysObject
// Create the correct physical representation for this type of object.
// Updates base.PhysBody and base.PhysShape with the new information.
// Ignore 'forceRebuild'. 'GetBodyAndShape' makes the right choices and changes of necessary.
PhysicsScene.Shapes.GetBodyAndShape(false /*forceRebuild */, PhysicsScene.World, this, delegate(BulletBody pBody, BulletShape pShape)
PhysScene.Shapes.GetBodyAndShape(false /*forceRebuild */, PhysScene.World, this, delegate(BulletBody pBody, BulletShape pShape)
{
// Called if the current prim body is about to be destroyed.
// Remove all the physical dependencies on the old body.

View File

@ -47,9 +47,9 @@ public class BSPrimLinkable : BSPrimDisplaced
OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
: base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
{
Linkset = BSLinkset.Factory(PhysicsScene, this);
Linkset = BSLinkset.Factory(PhysScene, this);
PhysicsScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()
PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()
{
Linkset.Refresh(this);
});
@ -99,7 +99,7 @@ public class BSPrimLinkable : BSPrimDisplaced
set
{
base.Position = value;
PhysicsScene.TaintedObject("BSPrimLinkset.setPosition", delegate()
PhysScene.TaintedObject("BSPrimLinkset.setPosition", delegate()
{
Linkset.UpdateProperties(UpdatedProperties.Position, this);
});
@ -113,7 +113,7 @@ public class BSPrimLinkable : BSPrimDisplaced
set
{
base.Orientation = value;
PhysicsScene.TaintedObject("BSPrimLinkset.setOrientation", delegate()
PhysScene.TaintedObject("BSPrimLinkset.setOrientation", delegate()
{
Linkset.UpdateProperties(UpdatedProperties.Orientation, this);
});

View File

@ -92,7 +92,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
private void BuildHeightmapTerrain()
{
// Create the terrain shape from the mapInfo
m_mapInfo.terrainShape = PhysicsScene.PE.CreateTerrainShape( m_mapInfo.ID,
m_mapInfo.terrainShape = m_physicsScene.PE.CreateTerrainShape( m_mapInfo.ID,
new Vector3(m_mapInfo.sizeX, m_mapInfo.sizeY, 0), m_mapInfo.minZ, m_mapInfo.maxZ,
m_mapInfo.heightMap, 1f, BSParam.TerrainCollisionMargin);
@ -103,26 +103,26 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
centerPos.Y = m_mapInfo.minCoords.Y + (m_mapInfo.sizeY / 2f);
centerPos.Z = m_mapInfo.minZ + ((m_mapInfo.maxZ - m_mapInfo.minZ) / 2f);
m_mapInfo.terrainBody = PhysicsScene.PE.CreateBodyWithDefaultMotionState(m_mapInfo.terrainShape,
m_mapInfo.terrainBody = m_physicsScene.PE.CreateBodyWithDefaultMotionState(m_mapInfo.terrainShape,
m_mapInfo.ID, centerPos, Quaternion.Identity);
// Set current terrain attributes
PhysicsScene.PE.SetFriction(m_mapInfo.terrainBody, BSParam.TerrainFriction);
PhysicsScene.PE.SetHitFraction(m_mapInfo.terrainBody, BSParam.TerrainHitFraction);
PhysicsScene.PE.SetRestitution(m_mapInfo.terrainBody, BSParam.TerrainRestitution);
PhysicsScene.PE.SetCollisionFlags(m_mapInfo.terrainBody, CollisionFlags.CF_STATIC_OBJECT);
m_physicsScene.PE.SetFriction(m_mapInfo.terrainBody, BSParam.TerrainFriction);
m_physicsScene.PE.SetHitFraction(m_mapInfo.terrainBody, BSParam.TerrainHitFraction);
m_physicsScene.PE.SetRestitution(m_mapInfo.terrainBody, BSParam.TerrainRestitution);
m_physicsScene.PE.SetCollisionFlags(m_mapInfo.terrainBody, CollisionFlags.CF_STATIC_OBJECT);
// Return the new terrain to the world of physical objects
PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_mapInfo.terrainBody);
m_physicsScene.PE.AddObjectToWorld(m_physicsScene.World, m_mapInfo.terrainBody);
// redo its bounding box now that it is in the world
PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_mapInfo.terrainBody);
m_physicsScene.PE.UpdateSingleAabb(m_physicsScene.World, m_mapInfo.terrainBody);
m_mapInfo.terrainBody.collisionType = CollisionType.Terrain;
m_mapInfo.terrainBody.ApplyCollisionMask(PhysicsScene);
m_mapInfo.terrainBody.ApplyCollisionMask(m_physicsScene);
// Make it so the terrain will not move or be considered for movement.
PhysicsScene.PE.ForceActivationState(m_mapInfo.terrainBody, ActivationState.DISABLE_SIMULATION);
m_physicsScene.PE.ForceActivationState(m_mapInfo.terrainBody, ActivationState.DISABLE_SIMULATION);
return;
}
@ -134,9 +134,9 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
{
if (m_mapInfo.terrainBody.HasPhysicalBody)
{
PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_mapInfo.terrainBody);
m_physicsScene.PE.RemoveObjectFromWorld(m_physicsScene.World, m_mapInfo.terrainBody);
// Frees both the body and the shape.
PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_mapInfo.terrainBody);
m_physicsScene.PE.DestroyObject(m_physicsScene.World, m_mapInfo.terrainBody);
}
}
m_mapInfo = null;
@ -155,7 +155,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
catch
{
// Sometimes they give us wonky values of X and Y. Give a warning and return something.
PhysicsScene.Logger.WarnFormat("{0} Bad request for terrain height. terrainBase={1}, pos={2}",
m_physicsScene.Logger.WarnFormat("{0} Bad request for terrain height. terrainBase={1}, pos={2}",
LogHeader, m_mapInfo.terrainRegionBase, pos);
ret = BSTerrainManager.HEIGHT_GETHEIGHT_RET;
}
@ -165,7 +165,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
// The passed position is relative to the base of the region.
public override float GetWaterLevelAtXYZ(Vector3 pos)
{
return PhysicsScene.SimpleWaterLevel;
return m_physicsScene.SimpleWaterLevel;
}
}
}

View File

@ -50,14 +50,14 @@ public abstract class BSTerrainPhys : IDisposable
Mesh = 1
}
public BSScene PhysicsScene { get; private set; }
protected BSScene m_physicsScene { get; private set; }
// Base of the region in world coordinates. Coordinates inside the region are relative to this.
public Vector3 TerrainBase { get; private set; }
public uint ID { get; private set; }
public BSTerrainPhys(BSScene physicsScene, Vector3 regionBase, uint id)
{
PhysicsScene = physicsScene;
m_physicsScene = physicsScene;
TerrainBase = regionBase;
ID = id;
}
@ -86,7 +86,7 @@ public sealed class BSTerrainManager : IDisposable
public Vector3 DefaultRegionSize = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
// The scene that I am part of
private BSScene PhysicsScene { get; set; }
private BSScene m_physicsScene { get; set; }
// The ground plane created to keep thing from falling to infinity.
private BulletBody m_groundPlane;
@ -113,7 +113,7 @@ public sealed class BSTerrainManager : IDisposable
public BSTerrainManager(BSScene physicsScene)
{
PhysicsScene = physicsScene;
m_physicsScene = physicsScene;
m_terrains = new Dictionary<Vector3,BSTerrainPhys>();
// Assume one region of default size
@ -132,21 +132,21 @@ public sealed class BSTerrainManager : IDisposable
// safe to call Bullet in real time. We hope no one is moving prims around yet.
public void CreateInitialGroundPlaneAndTerrain()
{
DetailLog("{0},BSTerrainManager.CreateInitialGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, PhysicsScene.RegionName);
DetailLog("{0},BSTerrainManager.CreateInitialGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, m_physicsScene.RegionName);
// The ground plane is here to catch things that are trying to drop to negative infinity
BulletShape groundPlaneShape = PhysicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin);
m_groundPlane = PhysicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
BulletShape groundPlaneShape = m_physicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin);
m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity);
PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_groundPlane);
PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_groundPlane);
m_physicsScene.PE.AddObjectToWorld(m_physicsScene.World, m_groundPlane);
m_physicsScene.PE.UpdateSingleAabb(m_physicsScene.World, m_groundPlane);
// Ground plane does not move
PhysicsScene.PE.ForceActivationState(m_groundPlane, ActivationState.DISABLE_SIMULATION);
m_physicsScene.PE.ForceActivationState(m_groundPlane, ActivationState.DISABLE_SIMULATION);
// Everything collides with the ground plane.
m_groundPlane.collisionType = CollisionType.Groundplane;
m_groundPlane.ApplyCollisionMask(PhysicsScene);
m_groundPlane.ApplyCollisionMask(m_physicsScene);
BSTerrainPhys initialTerrain = new BSTerrainHeightmap(PhysicsScene, Vector3.Zero, BSScene.TERRAIN_ID, DefaultRegionSize);
BSTerrainPhys initialTerrain = new BSTerrainHeightmap(m_physicsScene, Vector3.Zero, BSScene.TERRAIN_ID, DefaultRegionSize);
lock (m_terrains)
{
// Build an initial terrain and put it in the world. This quickly gets replaced by the real region terrain.
@ -157,12 +157,12 @@ public sealed class BSTerrainManager : IDisposable
// Release all the terrain structures we might have allocated
public void ReleaseGroundPlaneAndTerrain()
{
DetailLog("{0},BSTerrainManager.ReleaseGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, PhysicsScene.RegionName);
DetailLog("{0},BSTerrainManager.ReleaseGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, m_physicsScene.RegionName);
if (m_groundPlane.HasPhysicalBody)
{
if (PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_groundPlane))
if (m_physicsScene.PE.RemoveObjectFromWorld(m_physicsScene.World, m_groundPlane))
{
PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_groundPlane);
m_physicsScene.PE.DestroyObject(m_physicsScene.World, m_groundPlane);
}
m_groundPlane.Clear();
}
@ -188,7 +188,7 @@ public sealed class BSTerrainManager : IDisposable
float[] localHeightMap = heightMap;
// If there are multiple requests for changes to the same terrain between ticks,
// only do that last one.
PhysicsScene.PostTaintObject("TerrainManager.SetTerrain-"+ m_worldOffset.ToString(), 0, delegate()
m_physicsScene.PostTaintObject("TerrainManager.SetTerrain-"+ m_worldOffset.ToString(), 0, delegate()
{
if (m_worldOffset != Vector3.Zero && MegaRegionParentPhysicsScene != null)
{
@ -219,7 +219,7 @@ public sealed class BSTerrainManager : IDisposable
private void AddMegaRegionChildTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords)
{
// Since we are called by another region's thread, the action must be rescheduled onto our processing thread.
PhysicsScene.PostTaintObject("TerrainManager.AddMegaRegionChild" + minCoords.ToString(), id, delegate()
m_physicsScene.PostTaintObject("TerrainManager.AddMegaRegionChild" + minCoords.ToString(), id, delegate()
{
UpdateTerrain(id, heightMap, minCoords, maxCoords);
});
@ -318,26 +318,26 @@ public sealed class BSTerrainManager : IDisposable
// TODO: redo terrain implementation selection to allow other base types than heightMap.
private BSTerrainPhys BuildPhysicalTerrain(Vector3 terrainRegionBase, uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords)
{
PhysicsScene.Logger.DebugFormat("{0} Terrain for {1}/{2} created with {3}",
LogHeader, PhysicsScene.RegionName, terrainRegionBase,
m_physicsScene.Logger.DebugFormat("{0} Terrain for {1}/{2} created with {3}",
LogHeader, m_physicsScene.RegionName, terrainRegionBase,
(BSTerrainPhys.TerrainImplementation)BSParam.TerrainImplementation);
BSTerrainPhys newTerrainPhys = null;
switch ((int)BSParam.TerrainImplementation)
{
case (int)BSTerrainPhys.TerrainImplementation.Heightmap:
newTerrainPhys = new BSTerrainHeightmap(PhysicsScene, terrainRegionBase, id,
newTerrainPhys = new BSTerrainHeightmap(m_physicsScene, terrainRegionBase, id,
heightMap, minCoords, maxCoords);
break;
case (int)BSTerrainPhys.TerrainImplementation.Mesh:
newTerrainPhys = new BSTerrainMesh(PhysicsScene, terrainRegionBase, id,
newTerrainPhys = new BSTerrainMesh(m_physicsScene, terrainRegionBase, id,
heightMap, minCoords, maxCoords);
break;
default:
PhysicsScene.Logger.ErrorFormat("{0} Bad terrain implementation specified. Type={1}/{2},Region={3}/{4}",
m_physicsScene.Logger.ErrorFormat("{0} Bad terrain implementation specified. Type={1}/{2},Region={3}/{4}",
LogHeader,
(int)BSParam.TerrainImplementation,
BSParam.TerrainImplementation,
PhysicsScene.RegionName, terrainRegionBase);
m_physicsScene.RegionName, terrainRegionBase);
break;
}
return newTerrainPhys;
@ -429,8 +429,8 @@ public sealed class BSTerrainManager : IDisposable
}
else
{
PhysicsScene.Logger.ErrorFormat("{0} GetTerrainHeightAtXY: terrain not found: region={1}, x={2}, y={3}",
LogHeader, PhysicsScene.RegionName, tX, tY);
m_physicsScene.Logger.ErrorFormat("{0} GetTerrainHeightAtXY: terrain not found: region={1}, x={2}, y={3}",
LogHeader, m_physicsScene.RegionName, tX, tY);
DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXYZ,terrainNotFound,pos={1},base={2}",
BSScene.DetailLogZero, pos, terrainBaseXYZ);
}
@ -451,8 +451,8 @@ public sealed class BSTerrainManager : IDisposable
}
else
{
PhysicsScene.Logger.ErrorFormat("{0} GetWaterHeightAtXY: terrain not found: pos={1}, terrainBase={2}, height={3}",
LogHeader, PhysicsScene.RegionName, pos, terrainBaseXYZ, ret);
m_physicsScene.Logger.ErrorFormat("{0} GetWaterHeightAtXY: terrain not found: pos={1}, terrainBase={2}, height={3}",
LogHeader, m_physicsScene.RegionName, pos, terrainBaseXYZ, ret);
}
return ret;
}
@ -564,7 +564,7 @@ public sealed class BSTerrainManager : IDisposable
private void DetailLog(string msg, params Object[] args)
{
PhysicsScene.PhysicsLogging.Write(msg, args);
m_physicsScene.PhysicsLogging.Write(msg, args);
}
}
}

View File

@ -80,7 +80,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
if (BSParam.TerrainMeshMagnification == 1)
{
// If a magnification of one, use the old routine that is tried and true.
meshCreationSuccess = BSTerrainMesh.ConvertHeightmapToMesh(PhysicsScene,
meshCreationSuccess = BSTerrainMesh.ConvertHeightmapToMesh(m_physicsScene,
initialMap, m_sizeX, m_sizeY, // input size
Vector3.Zero, // base for mesh
out indicesCount, out indices, out verticesCount, out vertices);
@ -88,7 +88,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
else
{
// Other magnifications use the newer routine
meshCreationSuccess = BSTerrainMesh.ConvertHeightmapToMesh2(PhysicsScene,
meshCreationSuccess = BSTerrainMesh.ConvertHeightmapToMesh2(m_physicsScene,
initialMap, m_sizeX, m_sizeY, // input size
BSParam.TerrainMeshMagnification,
physicsScene.TerrainManager.DefaultRegionSize,
@ -98,21 +98,21 @@ public sealed class BSTerrainMesh : BSTerrainPhys
if (!meshCreationSuccess)
{
// DISASTER!!
PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedConversionOfHeightmap,id={1}", BSScene.DetailLogZero, ID);
PhysicsScene.Logger.ErrorFormat("{0} Failed conversion of heightmap to mesh! base={1}", LogHeader, TerrainBase);
m_physicsScene.DetailLog("{0},BSTerrainMesh.create,failedConversionOfHeightmap,id={1}", BSScene.DetailLogZero, ID);
m_physicsScene.Logger.ErrorFormat("{0} Failed conversion of heightmap to mesh! base={1}", LogHeader, TerrainBase);
// Something is very messed up and a crash is in our future.
return;
}
PhysicsScene.DetailLog("{0},BSTerrainMesh.create,meshed,id={1},indices={2},indSz={3},vertices={4},vertSz={5}",
m_physicsScene.DetailLog("{0},BSTerrainMesh.create,meshed,id={1},indices={2},indSz={3},vertices={4},vertSz={5}",
BSScene.DetailLogZero, ID, indicesCount, indices.Length, verticesCount, vertices.Length);
m_terrainShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, indicesCount, indices, verticesCount, vertices);
m_terrainShape = m_physicsScene.PE.CreateMeshShape(m_physicsScene.World, indicesCount, indices, verticesCount, vertices);
if (!m_terrainShape.HasPhysicalShape)
{
// DISASTER!!
PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape,id={1}", BSScene.DetailLogZero, ID);
PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain mesh! base={1}", LogHeader, TerrainBase);
m_physicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape,id={1}", BSScene.DetailLogZero, ID);
m_physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain mesh! base={1}", LogHeader, TerrainBase);
// Something is very messed up and a crash is in our future.
return;
}
@ -120,52 +120,52 @@ public sealed class BSTerrainMesh : BSTerrainPhys
Vector3 pos = regionBase;
Quaternion rot = Quaternion.Identity;
m_terrainBody = PhysicsScene.PE.CreateBodyWithDefaultMotionState(m_terrainShape, ID, pos, rot);
m_terrainBody = m_physicsScene.PE.CreateBodyWithDefaultMotionState(m_terrainShape, ID, pos, rot);
if (!m_terrainBody.HasPhysicalBody)
{
// DISASTER!!
PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase);
m_physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase);
// Something is very messed up and a crash is in our future.
return;
}
physicsScene.PE.SetShapeCollisionMargin(m_terrainShape, BSParam.TerrainCollisionMargin);
// Set current terrain attributes
PhysicsScene.PE.SetFriction(m_terrainBody, BSParam.TerrainFriction);
PhysicsScene.PE.SetHitFraction(m_terrainBody, BSParam.TerrainHitFraction);
PhysicsScene.PE.SetRestitution(m_terrainBody, BSParam.TerrainRestitution);
PhysicsScene.PE.SetContactProcessingThreshold(m_terrainBody, BSParam.TerrainContactProcessingThreshold);
PhysicsScene.PE.SetCollisionFlags(m_terrainBody, CollisionFlags.CF_STATIC_OBJECT);
m_physicsScene.PE.SetFriction(m_terrainBody, BSParam.TerrainFriction);
m_physicsScene.PE.SetHitFraction(m_terrainBody, BSParam.TerrainHitFraction);
m_physicsScene.PE.SetRestitution(m_terrainBody, BSParam.TerrainRestitution);
m_physicsScene.PE.SetContactProcessingThreshold(m_terrainBody, BSParam.TerrainContactProcessingThreshold);
m_physicsScene.PE.SetCollisionFlags(m_terrainBody, CollisionFlags.CF_STATIC_OBJECT);
// Static objects are not very massive.
PhysicsScene.PE.SetMassProps(m_terrainBody, 0f, Vector3.Zero);
m_physicsScene.PE.SetMassProps(m_terrainBody, 0f, Vector3.Zero);
// Put the new terrain to the world of physical objects
PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_terrainBody);
m_physicsScene.PE.AddObjectToWorld(m_physicsScene.World, m_terrainBody);
// Redo its bounding box now that it is in the world
PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_terrainBody);
m_physicsScene.PE.UpdateSingleAabb(m_physicsScene.World, m_terrainBody);
m_terrainBody.collisionType = CollisionType.Terrain;
m_terrainBody.ApplyCollisionMask(PhysicsScene);
m_terrainBody.ApplyCollisionMask(m_physicsScene);
if (BSParam.UseSingleSidedMeshes)
{
PhysicsScene.DetailLog("{0},BSTerrainMesh.settingCustomMaterial,id={1}", BSScene.DetailLogZero, id);
PhysicsScene.PE.AddToCollisionFlags(m_terrainBody, CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
m_physicsScene.DetailLog("{0},BSTerrainMesh.settingCustomMaterial,id={1}", BSScene.DetailLogZero, id);
m_physicsScene.PE.AddToCollisionFlags(m_terrainBody, CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
}
// Make it so the terrain will not move or be considered for movement.
PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION);
m_physicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION);
}
public override void Dispose()
{
if (m_terrainBody.HasPhysicalBody)
{
PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_terrainBody);
m_physicsScene.PE.RemoveObjectFromWorld(m_physicsScene.World, m_terrainBody);
// Frees both the body and the shape.
PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_terrainBody);
m_physicsScene.PE.DestroyObject(m_physicsScene.World, m_terrainBody);
m_terrainBody.Clear();
m_terrainShape.Clear();
}
@ -185,7 +185,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
catch
{
// Sometimes they give us wonky values of X and Y. Give a warning and return something.
PhysicsScene.Logger.WarnFormat("{0} Bad request for terrain height. terrainBase={1}, pos={2}",
m_physicsScene.Logger.WarnFormat("{0} Bad request for terrain height. terrainBase={1}, pos={2}",
LogHeader, TerrainBase, pos);
ret = BSTerrainManager.HEIGHT_GETHEIGHT_RET;
}
@ -195,7 +195,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
// The passed position is relative to the base of the region.
public override float GetWaterLevelAtXYZ(Vector3 pos)
{
return PhysicsScene.SimpleWaterLevel;
return m_physicsScene.SimpleWaterLevel;
}
// Convert the passed heightmap to mesh information suitable for CreateMeshShape2().