diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 871de79f70..e82b43ff0d 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. /// - public enum dParam:int + public enum dParam : int { LowStop = 0, HiStop = 1, @@ -67,7 +67,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde StopCFM3 = 8 + 512 } - public class OdeCharacter:PhysicsActor + public class OdeCharacter : PhysicsActor { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -99,7 +99,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde private readonly float m_sceneTimeStep; private readonly float m_sceneInverseTimeStep; - private float m_feetOffset = 0; private float feetOff = 0; private float boneOff = 0; @@ -112,22 +111,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde private bool m_iscolliding = false; private bool m_iscollidingGround = false; private bool m_iscollidingObj = false; - private bool m_alwaysRun = false; private bool _zeroFlag = false; private bool m_haveLastFallVel = false; - private uint m_localID = 0; public bool m_returnCollisions = false; // taints and their non-tainted counterparts public bool m_isPhysical = false; // the current physical status public float MinimumGroundFlightOffset = 3f; - private float m_buoyancy = 0f; - private bool m_freemove = false; - // private string m_name = String.Empty; + // private string m_name = String.Empty; // other filter control int m_colliderfilter = 0; int m_colliderGroundfilter = 0; @@ -152,7 +147,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public int m_eventsubscription = 0; private int m_cureventsubscription = 0; - private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); + private readonly CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); private bool SentEmptyCollisionsEvent; public bool bad = false; @@ -166,8 +161,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private PIDHoverType m_PIDHoverType; private float m_targetHoverHeight; - - public OdeCharacter(uint localID,String avName,ODEScene parent_scene,Vector3 pos,Vector3 pSize,float pfeetOffset,float density,float walk_divisor,float rundivisor) + public OdeCharacter(uint localID, String avName, ODEScene parent_scene, Vector3 pos, Vector3 pSize, float pfeetOffset, float density, float walk_divisor, float rundivisor) { m_localID = localID; m_parent_scene = parent_scene; @@ -176,21 +170,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_sceneTimeStep = parent_scene.ODE_STEPSIZE; m_sceneInverseTimeStep = 1.0f / m_sceneTimeStep; - if(pos.IsFinite()) + if (pos.IsFinite()) { - if(pos.Z > Constants.MaxSimulationHeight) + if (pos.Z > Constants.MaxSimulationHeight) { - pos.Z = parent_scene.GetTerrainHeightAtXY(127,127) + 5; + pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; } - if(pos.Z < Constants.MinSimulationHeight) // shouldn't this be 0 ? + if (pos.Z < Constants.MinSimulationHeight) // shouldn't this be 0 ? { - pos.Z = parent_scene.GetTerrainHeightAtXY(127,127) + 5; + pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; } _position = pos; } else { - _position = new Vector3(((float)m_parent_scene.WorldExtents.X * 0.5f),((float)m_parent_scene.WorldExtents.Y * 0.5f),parent_scene.GetTerrainHeightAtXY(128f,128f) + 10f); + _position = new Vector3(((float)m_parent_scene.WorldExtents.X * 0.5f), ((float)m_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f); m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); } @@ -198,7 +192,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_size.Y = pSize.Y > 0.01f ? pSize.Y : 0.01f; m_size.Z = pSize.Z > 0.01f ? pSize.Z : 0.01f; - m_feetOffset = pfeetOffset; m_orientation = Quaternion.Identity; m_orientation2D = Quaternion.Identity; @@ -222,7 +215,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde Name = avName; - AddChange(changes.Add,null); + AddChange(changes.Add, null); } public override int PhysicsActorType @@ -252,6 +245,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// /// If this is set, the avatar will move faster /// + private bool m_alwaysRun = false; public override bool SetAlwaysRun { get @@ -264,16 +258,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } + private readonly uint m_localID = 0; public override uint LocalID { get { return m_localID; } - set - { - m_localID = value; - } } public override PhysicsActor ParentActor @@ -300,6 +291,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } + private float m_buoyancy = 0f; public override float Buoyancy { get @@ -369,20 +361,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - if(value) + if (value) { m_colliderfilter += 3; - if(m_colliderfilter > 3) + if (m_colliderfilter > 3) m_colliderfilter = 3; } else { m_colliderfilter--; - if(m_colliderfilter < 0) + if (m_colliderfilter < 0) m_colliderfilter = 0; } - if(m_colliderfilter == 0) + if (m_colliderfilter == 0) m_iscolliding = false; else { @@ -439,27 +431,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde set { // Ubit filter this also - if(value) + if (value) { m_colliderObjectfilter += 2; - if(m_colliderObjectfilter > 2) + if (m_colliderObjectfilter > 2) m_colliderObjectfilter = 2; } else { m_colliderObjectfilter--; - if(m_colliderObjectfilter < 0) + if (m_colliderObjectfilter < 0) m_colliderObjectfilter = 0; } - if(m_colliderObjectfilter == 0) + if (m_colliderObjectfilter == 0) m_iscollidingObj = false; else m_iscollidingObj = true; - // m_iscollidingObj = value; + // m_iscollidingObj = value; - if(m_iscollidingObj) + if (m_iscollidingObj) m_pidControllerActive = false; else m_pidControllerActive = true; @@ -497,17 +489,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - if(value.IsFinite()) + if (value.IsFinite()) { - if(value.Z > 9999999f) - { - value.Z = m_parent_scene.GetTerrainHeightAtXY(127,127) + 5; - } - if(value.Z < -100f) - { - value.Z = m_parent_scene.GetTerrainHeightAtXY(127,127) + 5; - } - AddChange(changes.Position,value); + if (value.Z < -100f || value.Z > 9999999f) + value.Z = m_parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + + AddChange(changes.Position, value); } else { @@ -540,16 +527,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - if(value.IsFinite()) + if (value.IsFinite()) { - if(value.X <0.01f) + if (value.X < 0.01f) value.X = 0.01f; - if(value.Y <0.01f) + if (value.Y < 0.01f) value.Y = 0.01f; - if(value.Z <0.01f) + if (value.Z < 0.01f) value.Z = 0.01f; - AddChange(changes.Size,value); + AddChange(changes.Size, value); } else { @@ -558,21 +545,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - public override void setAvatarSize(Vector3 size,float feetOffset) + public override void setAvatarSize(Vector3 size, float feetOffset) { - if(size.IsFinite()) + if (size.IsFinite()) { - if(size.X < 0.01f) + if (size.X < 0.01f) size.X = 0.01f; - if(size.Y < 0.01f) + if (size.Y < 0.01f) size.Y = 0.01f; - if(size.Z < 0.01f) + if (size.Z < 0.01f) size.Z = 0.01f; strAvatarSize st = new strAvatarSize(); st.size = size; st.offset = feetOffset; - AddChange(changes.AvatarSize,st); + AddChange(changes.AvatarSize, st); } else { @@ -580,14 +567,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - /// - /// This creates the Avatar's physical Surrogate at the position supplied - /// - /// - /// - /// - // /// /// Uses the capped cyllinder volume formula to calculate the avatar's mass. /// This may be used in calculations in the scene/scenepresence @@ -614,7 +594,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde } - public override Vector3 Force { get @@ -639,22 +618,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - public override void VehicleFloatParam(int param,float value) + public override void VehicleFloatParam(int param, float value) { } - public override void VehicleVectorParam(int param,Vector3 value) + public override void VehicleVectorParam(int param, Vector3 value) { } - public override void VehicleRotationParam(int param,Quaternion rotation) + public override void VehicleRotationParam(int param, Quaternion rotation) { } - public override void VehicleFlags(int param,bool remove) + public override void VehicleFlags(int param, bool remove) { } @@ -668,8 +647,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { get { - Vector3 pos = _position; - return pos; + return _position; } } @@ -677,8 +655,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { get { - Vector3 pos = _position; - return pos; + return _position; } } @@ -706,9 +683,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - if(value.IsFinite()) + if (value.IsFinite()) { - AddChange(changes.Velocity,value); + AddChange(changes.Velocity, value); } else { @@ -725,9 +702,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - if(value.IsFinite()) + if (value.IsFinite()) { - AddChange(changes.TargetVelocity,value); + AddChange(changes.TargetVelocity, value); } else { @@ -778,10 +755,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - // fakeori = value; - // givefakeori++; + //fakeori = value; + //givefakeori++; value.Normalize(); - AddChange(changes.Orientation,value); + AddChange(changes.Orientation, value); } } @@ -809,17 +786,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// The PID controller takes this target velocity and tries to make it a reality /// /// - public override void AddForce(Vector3 force,bool pushforce) + public override void AddForce(Vector3 force, bool pushforce) { - if(force.IsFinite()) + if (force.IsFinite()) { - if(pushforce) + if (pushforce) { - AddChange(changes.Force,force * m_density / (m_sceneTimeStep * 28f)); + AddChange(changes.Force, force * m_density / (m_sceneTimeStep * 28f)); } else { - AddChange(changes.TargetVelocity,force); + AddChange(changes.TargetVelocity, force); } } else @@ -829,19 +806,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde //m_lastUpdateSent = false; } - public override void AddAngularForce(Vector3 force,bool pushforce) + public override void AddAngularForce(Vector3 force, bool pushforce) { } public override void SetMomentum(Vector3 momentum) { - if(momentum.IsFinite()) - AddChange(changes.Momentum,momentum); + if (momentum.IsFinite()) + AddChange(changes.Momentum, momentum); } - private void AvatarGeomAndBodyCreation(float npositionX,float npositionY,float npositionZ) + private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ) { float sx = m_size.X; float sy = m_size.Y; @@ -851,7 +828,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde boneOff = bot + 0.3f; float feetsz = sz * 0.45f; - if(feetsz > 0.6f) + if (feetsz > 0.6f) feetsz = 0.6f; feetOff = bot + feetsz; @@ -863,13 +840,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_parent_scene.waitForSpaceUnlock(m_parent_scene.CharsSpace); collider = SafeNativeMethods.SimpleSpaceCreate(m_parent_scene.CharsSpace); - SafeNativeMethods.SpaceSetSublevel(collider,3); - SafeNativeMethods.SpaceSetCleanup(collider,false); - SafeNativeMethods.GeomSetCategoryBits(collider,(uint)m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(collider,(uint)m_collisionFlags); + SafeNativeMethods.SpaceSetSublevel(collider, 3); + SafeNativeMethods.SpaceSetCleanup(collider, false); + SafeNativeMethods.GeomSetCategoryBits(collider, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(collider, (uint)m_collisionFlags); float r = sx; - if(sy > r) + if (sy > r) r = sy; float l = sz - r; r *= 0.5f; @@ -900,46 +877,46 @@ namespace OpenSim.Region.PhysicsModule.ubOde _position.Y = npositionY; _position.Z = npositionZ; - SafeNativeMethods.BodySetMass(Body,ref ShellMass); - SafeNativeMethods.GeomSetBody(capsule,Body); + SafeNativeMethods.BodySetMass(Body, ref ShellMass); + SafeNativeMethods.GeomSetBody(capsule, Body); // The purpose of the AMotor here is to keep the avatar's physical // surrogate from rotating while moving - Amotor = SafeNativeMethods.JointCreateAMotor(m_parent_scene.world,IntPtr.Zero); - SafeNativeMethods.JointAttach(Amotor,Body,IntPtr.Zero); + Amotor = SafeNativeMethods.JointCreateAMotor(m_parent_scene.world, IntPtr.Zero); + SafeNativeMethods.JointAttach(Amotor, Body, IntPtr.Zero); - SafeNativeMethods.JointSetAMotorMode(Amotor,0); - SafeNativeMethods.JointSetAMotorNumAxes(Amotor,3); - SafeNativeMethods.JointSetAMotorAxis(Amotor,0,0,1,0,0); - SafeNativeMethods.JointSetAMotorAxis(Amotor,1,0,0,1,0); - SafeNativeMethods.JointSetAMotorAxis(Amotor,2,0,0,0,1); + SafeNativeMethods.JointSetAMotorMode(Amotor, 0); + SafeNativeMethods.JointSetAMotorNumAxes(Amotor, 3); + SafeNativeMethods.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0); + SafeNativeMethods.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0); + SafeNativeMethods.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1); - SafeNativeMethods.JointSetAMotorAngle(Amotor,0,0); - SafeNativeMethods.JointSetAMotorAngle(Amotor,1,0); - SafeNativeMethods.JointSetAMotorAngle(Amotor,2,0); + SafeNativeMethods.JointSetAMotorAngle(Amotor, 0, 0); + SafeNativeMethods.JointSetAMotorAngle(Amotor, 1, 0); + SafeNativeMethods.JointSetAMotorAngle(Amotor, 2, 0); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopCFM,0f); // make it HARD - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopCFM2,0f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopCFM3,0f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopERP,0.8f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopERP2,0.8f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopERP3,0.8f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0f); // make it HARD + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopERP, 0.8f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopERP2, 0.8f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopERP3, 0.8f); // These lowstops and high stops are effectively (no wiggle room) - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.LowStop,-1e-5f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.HiStop,1e-5f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.LoStop2,-1e-5f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.HiStop2,1e-5f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.LoStop3,-1e-5f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.HiStop3,1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 1e-5f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)SafeNativeMethods.JointParam.Vel,0); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)SafeNativeMethods.JointParam.Vel2,0); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)SafeNativeMethods.JointParam.Vel3,0); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Vel, 0); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Vel2, 0); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Vel3, 0); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.FMax,5e8f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.FMax2,5e8f); - SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.FMax3,5e8f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.FMax, 5e8f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.FMax2, 5e8f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.FMax3, 5e8f); } /// @@ -948,13 +925,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void AvatarGeomAndBodyDestroy() { // Kill the Amotor - if(Amotor != IntPtr.Zero) + if (Amotor != IntPtr.Zero) { SafeNativeMethods.JointDestroy(Amotor); Amotor = IntPtr.Zero; } - if(Body != IntPtr.Zero) + if (Body != IntPtr.Zero) { //kill the body SafeNativeMethods.BodyDestroy(Body); @@ -962,7 +939,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } //kill the Geoms - if(capsule != IntPtr.Zero) + if (capsule != IntPtr.Zero) { m_parent_scene.actor_name_map.Remove(capsule); m_parent_scene.waitForSpaceUnlock(collider); @@ -970,7 +947,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde capsule = IntPtr.Zero; } - if(collider != IntPtr.Zero) + if (collider != IntPtr.Zero) { SafeNativeMethods.SpaceDestroy(collider); collider = IntPtr.Zero; @@ -978,7 +955,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } //in place 2D rotation around Z assuming rot is normalised and is a rotation around Z - public void RotateXYonZ(ref float x,ref float y,ref Quaternion rot) + public void RotateXYonZ(ref float x, ref float y, ref Quaternion rot) { float sin = 2.0f * rot.Z * rot.W; float cos = rot.W * rot.W - rot.Z * rot.Z; @@ -987,20 +964,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde x = tx * cos - y * sin; y = tx * sin + y * cos; } - public void RotateXYonZ(ref float x,ref float y,ref float sin,ref float cos) + public void RotateXYonZ(ref float x, ref float y, ref float sin, ref float cos) { float tx = x; x = tx * cos - y * sin; y = tx * sin + y * cos; } - public void invRotateXYonZ(ref float x,ref float y,ref float sin,ref float cos) + public void invRotateXYonZ(ref float x, ref float y, ref float sin, ref float cos) { float tx = x; x = tx * cos + y * sin; y = -tx * sin + y * cos; } - public void invRotateXYonZ(ref float x,ref float y,ref Quaternion rot) + public void invRotateXYonZ(ref float x, ref float y, ref Quaternion rot) { float sin = -2.0f * rot.Z * rot.W; float cos = rot.W * rot.W - rot.Z * rot.Z; @@ -1010,13 +987,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde y = tx * sin + y * cos; } - internal bool Collide(IntPtr me,IntPtr other,bool reverse,ref SafeNativeMethods.ContactGeom contact, - ref SafeNativeMethods.ContactGeom altContact,ref bool useAltcontact,ref bool feetcollision) + internal bool Collide(IntPtr me, IntPtr other, bool reverse, ref SafeNativeMethods.ContactGeom contact, + ref SafeNativeMethods.ContactGeom altContact, ref bool useAltcontact, ref bool feetcollision) { feetcollision = false; useAltcontact = false; - if(me == capsule) + if (me == capsule) { Vector3 offset; @@ -1027,24 +1004,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde offset.Y = contact.pos.Y - _position.Y; SafeNativeMethods.GeomClassID gtype = SafeNativeMethods.GeomGetClass(other); - if(gtype == SafeNativeMethods.GeomClassID.CapsuleClass) + if (gtype == SafeNativeMethods.GeomClassID.CapsuleClass) { Vector3 roff = offset * Quaternion.Inverse(m_orientation2D); - float r = roff.X *roff.X / AvaAvaSizeXsq; + float r = roff.X * roff.X / AvaAvaSizeXsq; r += (roff.Y * roff.Y) / AvaAvaSizeYsq; - if(r > 1.0f) + if (r > 1.0f) return false; - float dp = 1.0f -(float)Math.Sqrt((double)r); - if(dp > 0.05f) + float dp = 1.0f - (float)Math.Sqrt((double)r); + if (dp > 0.05f) dp = 0.05f; contact.depth = dp; - if(offset.Z < 0) + if (offset.Z < 0) { feetcollision = true; - if(h < boneOff) + if (h < boneOff) { m_collideNormal.X = contact.normal.X; m_collideNormal.Y = contact.normal.Y; @@ -1055,18 +1032,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde return true; } - if(gtype == SafeNativeMethods.GeomClassID.SphereClass && SafeNativeMethods.GeomGetBody(other) != IntPtr.Zero) + if (gtype == SafeNativeMethods.GeomClassID.SphereClass && SafeNativeMethods.GeomGetBody(other) != IntPtr.Zero) { - if(SafeNativeMethods.GeomSphereGetRadius(other) < 0.5) + if (SafeNativeMethods.GeomSphereGetRadius(other) < 0.5) return true; } - if(offset.Z > 0 || contact.normal.Z > 0.35f) + if (offset.Z > 0 || contact.normal.Z > 0.35f) { - if(offset.Z <= 0) + if (offset.Z <= 0) { feetcollision = true; - if(h < boneOff) + if (h < boneOff) { m_collideNormal.X = contact.normal.X; m_collideNormal.Y = contact.normal.Y; @@ -1077,11 +1054,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde return true; } - if(m_flying) + if (m_flying) return true; feetcollision = true; - if(h < boneOff) + if (h < boneOff) { m_collideNormal.X = contact.normal.X; m_collideNormal.Y = contact.normal.Y; @@ -1099,7 +1076,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde float tdp = contact.depth; float t = offset.X; t = Math.Abs(t); - if(t > 1e-6) + if (t > 1e-6) { tdp /= t; tdp *= contact.normal.X; @@ -1107,12 +1084,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde else tdp *= 10; - if(tdp > 0.25f) + if (tdp > 0.25f) tdp = 0.25f; altContact.depth = tdp; - if(reverse) + if (reverse) { altContact.normal.X = offset.X; altContact.normal.Y = offset.Y; @@ -1136,7 +1113,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public void Move() { - if(Body == IntPtr.Zero) + if (Body == IntPtr.Zero) return; if (!SafeNativeMethods.BodyIsEnabled(Body)) @@ -1156,12 +1133,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde // the Amotor still lets avatar rotation to drift during colisions // so force it back to identity - SafeNativeMethods.Quaternion qtmp; - qtmp.W = m_orientation2D.W; - qtmp.X = m_orientation2D.X; - qtmp.Y = m_orientation2D.Y; - qtmp.Z = m_orientation2D.Z; - SafeNativeMethods.BodySetQuaternion(Body,ref qtmp); + SafeNativeMethods.Quaternion qtmp = new SafeNativeMethods.Quaternion + { + W = m_orientation2D.W, + X = m_orientation2D.X, + Y = m_orientation2D.Y, + Z = m_orientation2D.Z + }; + SafeNativeMethods.BodySetQuaternion(Body, ref qtmp); SafeNativeMethods.Vector3 dtmp = SafeNativeMethods.BodyGetPosition(Body); Vector3 localpos = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); @@ -1196,7 +1175,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde fixbody = true; localpos.Y = 0.1f; } - else if(tmp > m_parent_scene.WorldExtents.Y - 0.1) + else if (tmp > m_parent_scene.WorldExtents.Y - 0.1) { fixbody = true; localpos.Y = m_parent_scene.WorldExtents.Y - 0.1f; @@ -1217,19 +1196,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (fixbody) { m_freemove = false; - SafeNativeMethods.BodySetPosition(Body,localpos.X,localpos.Y,localpos.Z); + SafeNativeMethods.BodySetPosition(Body, localpos.X, localpos.Y, localpos.Z); } float breakfactor; Vector3 vec = Vector3.Zero; dtmp = SafeNativeMethods.BodyGetLinearVel(Body); - Vector3 vel = new Vector3(dtmp.X,dtmp.Y,dtmp.Z); + Vector3 vel = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); float velLengthSquared = vel.LengthSquared(); Vector3 ctz = _target_velocity; - if(m_alwaysRun) + if (m_alwaysRun) { ctz.X *= m_runMultiplier; ctz.Y *= m_runMultiplier; @@ -1243,46 +1222,44 @@ namespace OpenSim.Region.PhysicsModule.ubOde //****************************************** // colide with land - SafeNativeMethods.AABB aabb; - // d.GeomGetAABB(feetbox, out aabb); - SafeNativeMethods.GeomGetAABB(capsule,out aabb); + SafeNativeMethods.GeomGetAABB(capsule, out SafeNativeMethods.AABB aabb); float chrminZ = aabb.MinZ; // move up a bit Vector3 posch = localpos; - if(m_flying) + if (m_flying) { posch.X += vel.X * m_sceneTimeStep; posch.Y += vel.Y * m_sceneTimeStep; } - float terrainheight = m_parent_scene.GetTerrainHeightAtXY(posch.X,posch.Y); - if(chrminZ < terrainheight) + float terrainheight = m_parent_scene.GetTerrainHeightAtXY(posch.X, posch.Y); + if (chrminZ < terrainheight) { - if(ctz.Z < 0) + if (ctz.Z < 0) ctz.Z = 0; - if(!m_haveLastFallVel) + if (!m_haveLastFallVel) { m_lastFallVel = vel; m_haveLastFallVel = true; } - Vector3 n = m_parent_scene.GetTerrainNormalAtXY(posch.X,posch.Y); + Vector3 n = m_parent_scene.GetTerrainNormalAtXY(posch.X, posch.Y); float depth = terrainheight - chrminZ; vec.Z = depth * PID_P * 50; - if(!m_flying) + if (!m_flying) { vec.Z += -vel.Z * PID_D; - if(n.Z < 0.4f) + if (n.Z < 0.4f) { vec.X = depth * PID_P * 50 - vel.X * PID_D; vec.X *= n.X; vec.Y = depth * PID_P * 50 - vel.Y * PID_D; vec.Y *= n.Y; vec.Z *= n.Z; - if(n.Z < 0.1f) + if (n.Z < 0.1f) { // cancel the slope pose n.X = 0f; @@ -1292,23 +1269,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - if(depth < 0.2f) + if (depth < 0.2f) { m_colliderGroundfilter++; - if(m_colliderGroundfilter > 2) + if (m_colliderGroundfilter > 2) { m_iscolliding = true; m_colliderfilter = 2; - if(m_colliderGroundfilter > 10) + if (m_colliderGroundfilter > 10) { m_colliderGroundfilter = 10; m_freemove = false; } - m_collideNormal.X = n.X; - m_collideNormal.Y = n.Y; - m_collideNormal.Z = n.Z; + m_collideNormal = n; m_iscollidingGround = true; @@ -1317,22 +1292,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde contact.Position.X = localpos.X; contact.Position.Y = localpos.Y; contact.Position.Z = terrainheight; - contact.SurfaceNormal.X = -n.X; - contact.SurfaceNormal.Y = -n.Y; - contact.SurfaceNormal.Z = -n.Z; + contact.SurfaceNormal = -n; contact.RelativeSpeed = Vector3.Dot(m_lastFallVel,n); contact.CharacterFeet = true; AddCollisionEvent(0,contact); m_lastFallVel = vel; - // vec.Z *= 0.5f; + //vec.Z *= 0.5f; } } else { m_colliderGroundfilter -= 5; - if(m_colliderGroundfilter <= 0) + if (m_colliderGroundfilter <= 0) { m_colliderGroundfilter = 0; m_iscollidingGround = false; @@ -1343,7 +1316,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { m_haveLastFallVel = false; m_colliderGroundfilter -= 5; - if(m_colliderGroundfilter <= 0) + if (m_colliderGroundfilter <= 0) { m_colliderGroundfilter = 0; m_iscollidingGround = false; @@ -1352,11 +1325,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde bool hoverPIDActive = false; - if(m_useHoverPID && m_PIDHoverTau != 0 && m_PIDHoverHeight != 0) + if (m_useHoverPID && m_PIDHoverTau != 0 && m_PIDHoverHeight != 0) { hoverPIDActive = true; - switch(m_PIDHoverType) + switch (m_PIDHoverType) { case PIDHoverType.Ground: m_targetHoverHeight = terrainheight + m_PIDHoverHeight; @@ -1364,7 +1337,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde case PIDHoverType.GroundAndWater: float waterHeight = m_parent_scene.GetWaterLevel(); - if(terrainheight > waterHeight) + if (terrainheight > waterHeight) m_targetHoverHeight = terrainheight + m_PIDHoverHeight; else m_targetHoverHeight = waterHeight + m_PIDHoverHeight; @@ -1372,12 +1345,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde } // end switch (m_PIDHoverType) // don't go underground - if(m_targetHoverHeight > terrainheight + 0.5f * (aabb.MaxZ - aabb.MinZ)) + if (m_targetHoverHeight > terrainheight + 0.5f * (aabb.MaxZ - aabb.MinZ)) { float fz = (m_targetHoverHeight - localpos.Z); // if error is zero, use position control; otherwise, velocity control - if(Math.Abs(fz) < 0.01f) + if (Math.Abs(fz) < 0.01f) { ctz.Z = 0; } @@ -1387,9 +1360,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde fz /= m_PIDHoverTau; tmp = Math.Abs(fz); - if(tmp > 50) + if (tmp > 50) fz = 50 * Math.Sign(fz); - else if(tmp < 0.1) + else if (tmp < 0.1) fz = 0.1f * Math.Sign(fz); ctz.Z = fz; @@ -1398,36 +1371,36 @@ namespace OpenSim.Region.PhysicsModule.ubOde } //****************************************** - if(!m_iscolliding) + if (!m_iscolliding) m_collideNormal.Z = 0; bool tviszero = (ctz.X == 0.0f && ctz.Y == 0.0f && ctz.Z == 0.0f); - if(!tviszero) + if (!tviszero) { m_freemove = false; // movement relative to surface if moving on it // dont disturbe vertical movement, ie jumps - if(m_iscolliding && !m_flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) + if (m_iscolliding && !m_flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) { float p = ctz.X * m_collideNormal.X + ctz.Y * m_collideNormal.Y; ctz.X *= (float)Math.Sqrt(1 - m_collideNormal.X * m_collideNormal.X); ctz.Y *= (float)Math.Sqrt(1 - m_collideNormal.Y * m_collideNormal.Y); ctz.Z -= p; - if(ctz.Z < 0) + if (ctz.Z < 0) ctz.Z *= 2; } } - if(!m_freemove) + if (!m_freemove) { // if velocity is zero, use position control; otherwise, velocity control - if(tviszero) + if (tviszero) { - if(m_iscolliding || m_flying) + if (m_iscolliding || m_flying) { // keep track of where we stopped. No more slippin' & slidin' if (!_zeroFlag) @@ -1435,16 +1408,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde _zeroFlag = true; _zeroPosition = localpos; } - if(m_pidControllerActive) + if (m_pidControllerActive) { // We only want to deactivate the PID Controller if we think we want to have our surrogate // react to the physics scene by moving it's position. // Avatar to Avatar collisions // Prim to avatar collisions + float pidd2 = PID_D * 2f; + float pidp5 = PID_P * 5; - vec.X = -vel.X * PID_D * 2f + (_zeroPosition.X - localpos.X) * (PID_P * 5); - vec.Y = -vel.Y * PID_D * 2f + (_zeroPosition.Y - localpos.Y) * (PID_P * 5); - if(vel.Z > 0) + vec.X = -vel.X * pidd2 + (_zeroPosition.X - localpos.X) * pidp5; + vec.Y = -vel.Y * pidd2 + (_zeroPosition.Y - localpos.Y) * pidp5; + if (vel.Z > 0) vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P; else vec.Z += (-vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P) * 0.2f; @@ -1453,11 +1428,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde else { _zeroFlag = false; - vec.X += (ctz.X - vel.X) * PID_D * 0.833f; - vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f; + float pidd0833 = PID_D * 0.833f; + vec.X += (ctz.X - vel.X) * pidd0833; + vec.Y += (ctz.Y - vel.Y) * pidd0833; // hack for breaking on fall if (ctz.Z == -9999f) - vec.Z += -vel.Z * PID_D - m_parent_scene.gravityz * m_mass; + vec.Z += -vel.Z * PID_D - m_scenegravityZ * m_mass; } } else @@ -1465,41 +1441,41 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_pidControllerActive = true; _zeroFlag = false; - if(m_iscolliding) + if (m_iscolliding) { - if(!m_flying) + if (!m_flying) { // we are on a surface - if(ctz.Z > 0f) + if (ctz.Z > 0f) { // moving up or JUMPING vec.Z += (ctz.Z - vel.Z) * PID_D * 2f; - vec.X += (ctz.X - vel.X) * (PID_D); - vec.Y += (ctz.Y - vel.Y) * (PID_D); + vec.X += (ctz.X - vel.X) * PID_D; + vec.Y += (ctz.Y - vel.Y) * PID_D; } else { // we are moving down on a surface - if(ctz.Z == 0) + if (ctz.Z == 0) { - if(vel.Z > 0) + if (vel.Z > 0) vec.Z -= vel.Z * PID_D * 2f; - vec.X += (ctz.X - vel.X) * (PID_D); - vec.Y += (ctz.Y - vel.Y) * (PID_D); + vec.X += (ctz.X - vel.X) * PID_D; + vec.Y += (ctz.Y - vel.Y) * PID_D; } // intencionally going down else { - if(ctz.Z < vel.Z) + if (ctz.Z < vel.Z) vec.Z += (ctz.Z - vel.Z) * PID_D; else { } - if(Math.Abs(ctz.X) > Math.Abs(vel.X)) - vec.X += (ctz.X - vel.X) * (PID_D); - if(Math.Abs(ctz.Y) > Math.Abs(vel.Y)) - vec.Y += (ctz.Y - vel.Y) * (PID_D); + if (Math.Abs(ctz.X) > Math.Abs(vel.X)) + vec.X += (ctz.X - vel.X) * PID_D; + if (Math.Abs(ctz.Y) > Math.Abs(vel.Y)) + vec.Y += (ctz.Y - vel.Y) * PID_D; } } @@ -1508,19 +1484,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde else { // We're flying and colliding with something - vec.X += (ctz.X - vel.X) * (PID_D * 0.0625f); - vec.Y += (ctz.Y - vel.Y) * (PID_D * 0.0625f); - vec.Z += (ctz.Z - vel.Z) * (PID_D * 0.0625f); + float pidd00625 = PID_D * 0.0625f; + vec.X += (ctz.X - vel.X) * pidd00625; + vec.Y += (ctz.Y - vel.Y) * pidd00625; + vec.Z += (ctz.Z - vel.Z) * pidd00625; } } else // ie not colliding { - if(m_flying || hoverPIDActive) //(!m_iscolliding && flying) + if (m_flying || hoverPIDActive) //(!m_iscolliding && flying) { // we're in mid air suspended - vec.X += (ctz.X - vel.X) * (PID_D); - vec.Y += (ctz.Y - vel.Y) * (PID_D); - vec.Z += (ctz.Z - vel.Z) * (PID_D); + vec.X += (ctz.X - vel.X) * PID_D; + vec.Y += (ctz.Y - vel.Y) * PID_D; + vec.Z += (ctz.Z - vel.Z) * PID_D; } else @@ -1529,16 +1506,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde // m_iscolliding includes collisions with the ground. // d.Vector3 pos = d.BodyGetPosition(Body); - vec.X += (ctz.X - vel.X) * PID_D * 0.833f; - vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f; + float pidd0833 = PID_D * 0.833f; + vec.X += (ctz.X - vel.X) * pidd0833; + vec.Y += (ctz.Y - vel.Y) * pidd0833; // hack for breaking on fall if (ctz.Z == -9999f) - vec.Z += -vel.Z * PID_D - m_parent_scene.gravityz * m_mass; + vec.Z += -vel.Z * PID_D - m_scenegravityZ * m_mass; } } } - if(velLengthSquared > 2500.0f) // 50m/s apply breaks + if (velLengthSquared > 2500.0f) // 50m/s apply breaks { breakfactor = 0.16f * m_mass; vec.X -= breakfactor * vel.X; @@ -1551,44 +1529,43 @@ namespace OpenSim.Region.PhysicsModule.ubOde breakfactor = m_mass; vec.X -= breakfactor * vel.X; vec.Y -= breakfactor * vel.Y; - if(m_flying) + if (m_flying) vec.Z -= 0.5f * breakfactor * vel.Z; else - vec.Z -= .16f* m_mass * vel.Z; + vec.Z -= .16f * m_mass * vel.Z; } if (m_flying || hoverPIDActive) { - vec.Z -= m_parent_scene.gravityz * m_mass; + vec.Z -= m_scenegravityZ * m_mass; - if(!hoverPIDActive) + if (!hoverPIDActive) { //Added for auto fly height. Kitto Flora float target_altitude = terrainheight + MinimumGroundFlightOffset; - if(localpos.Z < target_altitude) + if (localpos.Z < target_altitude) { vec.Z += (target_altitude - localpos.Z) * PID_P * 5.0f; } // end add Kitto Flora } } - else if(m_buoyancy != 0.0) + else if (m_buoyancy != 0.0) { - vec.Z -= m_parent_scene.gravityz * m_buoyancy * m_mass; + vec.Z -= m_scenegravityZ * m_buoyancy * m_mass; } - if(vec.IsFinite()) + if (vec.IsFinite()) { - if((vec.X != 0 || vec.Y !=0 || vec.Z !=0)) - SafeNativeMethods.BodyAddForce(Body,vec.X,vec.Y,vec.Z); + if ((vec.X != 0 || vec.Y != 0 || vec.Z != 0)) + SafeNativeMethods.BodyAddForce(Body, vec.X, vec.Y, vec.Z); } - + // update our local ideia of position velocity and aceleration - // _position = localpos; _position = localpos; - if(_zeroFlag) + if (_zeroFlag) { _velocity = Vector3.Zero; _acceleration = Vector3.Zero; @@ -1597,42 +1574,42 @@ namespace OpenSim.Region.PhysicsModule.ubOde else { Vector3 a = _velocity; // previous velocity - SetSmooth(ref _velocity,ref vel,2); + SetSmooth(ref _velocity, ref vel, 2); a = (_velocity - a) * m_sceneInverseTimeStep; - SetSmooth(ref _acceleration,ref a,2); + SetSmooth(ref _acceleration, ref a, 2); dtmp = SafeNativeMethods.BodyGetAngularVel(Body); m_rotationalVelocity.X = 0f; m_rotationalVelocity.Y = 0f; m_rotationalVelocity.Z = dtmp.Z; - Math.Round(m_rotationalVelocity.Z,3); + Math.Round(m_rotationalVelocity.Z, 3); } } - public void round(ref Vector3 v,int digits) + public void round(ref Vector3 v, int digits) { - v.X = (float)Math.Round(v.X,digits); - v.Y = (float)Math.Round(v.Y,digits); - v.Z = (float)Math.Round(v.Z,digits); + v.X = (float)Math.Round(v.X, digits); + v.Y = (float)Math.Round(v.Y, digits); + v.Z = (float)Math.Round(v.Z, digits); } - public void SetSmooth(ref Vector3 dst,ref Vector3 value) + public void SetSmooth(ref Vector3 dst, ref Vector3 value) { dst.X = 0.1f * dst.X + 0.9f * value.X; dst.Y = 0.1f * dst.Y + 0.9f * value.Y; dst.Z = 0.1f * dst.Z + 0.9f * value.Z; } - public void SetSmooth(ref Vector3 dst,ref Vector3 value,int rounddigits) + public void SetSmooth(ref Vector3 dst, ref Vector3 value, int rounddigits) { dst.X = 0.4f * dst.X + 0.6f * value.X; - dst.X = (float)Math.Round(dst.X,rounddigits); + dst.X = (float)Math.Round(dst.X, rounddigits); dst.Y = 0.4f * dst.Y + 0.6f * value.Y; - dst.Y = (float)Math.Round(dst.Y,rounddigits); + dst.Y = (float)Math.Round(dst.Y, rounddigits); dst.Z = 0.4f * dst.Z + 0.6f * value.Z; - dst.Z = (float)Math.Round(dst.Z,rounddigits); + dst.Z = (float)Math.Round(dst.Z, rounddigits); } @@ -1645,11 +1622,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public void UpdatePositionAndVelocity() { - return; - - // if (Body == IntPtr.Zero) - // return; - } /// @@ -1657,7 +1629,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public void Destroy() { - AddChange(changes.Remove,null); + AddChange(changes.Remove, null); } public override void CrossingFailure() @@ -1679,14 +1651,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - return; } } public override float PIDTau { set { - return; } } @@ -1694,7 +1664,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { set { - AddChange(changes.PIDHoverHeight,value); + AddChange(changes.PIDHoverHeight, value); } } public override bool PIDHoverActive @@ -1705,7 +1675,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - AddChange(changes.PIDHoverActive,value); + AddChange(changes.PIDHoverActive, value); } } @@ -1713,7 +1683,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { set { - AddChange(changes.PIDHoverType,value); + AddChange(changes.PIDHoverType, value); } } @@ -1722,15 +1692,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde set { float tmp = 0; - if(value > 0) + if (value > 0) { - float mint = (0.05f > m_sceneTimeStep ? 0.05f : m_sceneTimeStep); - if(value < mint) - tmp = mint; - else - tmp = value; + float mint = m_sceneTimeStep < 0.05f ? 0.05f : m_sceneTimeStep; + tmp = value < mint ? mint : value; } - AddChange(changes.PIDHoverTau,tmp); + AddChange(changes.PIDHoverTau, tmp); } } @@ -1738,7 +1705,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde { set { - return; } } @@ -1746,7 +1712,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde { set { - return; } } @@ -1754,7 +1719,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde { set { - return; } } @@ -1778,38 +1742,38 @@ namespace OpenSim.Region.PhysicsModule.ubOde { m_eventsubscription = 0; m_parent_scene.RemoveCollisionEventReporting(this); - lock(CollisionEventsThisFrame) + lock (CollisionEventsThisFrame) CollisionEventsThisFrame.Clear(); } - public override void AddCollisionEvent(uint CollidedWith,ContactPoint contact) + public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { - lock(CollisionEventsThisFrame) - CollisionEventsThisFrame.AddCollider(CollidedWith,contact); + lock (CollisionEventsThisFrame) + CollisionEventsThisFrame.AddCollider(CollidedWith, contact); m_parent_scene.AddCollisionEventReporting(this); } public void SendCollisions(int timestep) { - if(m_cureventsubscription < 50000) + if (m_cureventsubscription < 50000) m_cureventsubscription += timestep; - if(m_cureventsubscription < m_eventsubscription) + if (m_cureventsubscription < m_eventsubscription) return; - if(Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) + if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) return; - lock(CollisionEventsThisFrame) + lock (CollisionEventsThisFrame) { int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; - if(!SentEmptyCollisionsEvent || ncolisions > 0) + if (!SentEmptyCollisionsEvent || ncolisions > 0) { base.SendCollisionUpdate(CollisionEventsThisFrame); m_cureventsubscription = 0; - if(ncolisions == 0) + if (ncolisions == 0) { SentEmptyCollisionsEvent = true; // _parent_scene.RemoveCollisionEventReporting(this); @@ -1825,20 +1789,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override bool SubscribedEvents() { - if(m_eventsubscription > 0) + if (m_eventsubscription > 0) return true; return false; } private void changePhysicsStatus(bool NewStatus) { - if(NewStatus != m_isPhysical) + if (NewStatus != m_isPhysical) { - if(NewStatus) + if (NewStatus) { AvatarGeomAndBodyDestroy(); - AvatarGeomAndBodyCreation(_position.X,_position.Y,_position.Z); + AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z); m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this; m_parent_scene.AddCharacter(this); @@ -1877,11 +1841,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changeSize(Vector3 pSize) { - if(pSize.IsFinite()) + if (pSize.IsFinite()) { // for now only look to Z changes since viewers also don't change X and Y - if(pSize.Z < 0.01f) - pSize.Z = 0.01f; if (pSize.Z != m_size.Z) { float oldsz = m_size.Z; @@ -1938,7 +1900,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changePosition(Vector3 newPos) { - if(Body != IntPtr.Zero) + if (Body != IntPtr.Zero) { SafeNativeMethods.BodySetPosition(Body, newPos.X, newPos.Y, newPos.Z); SafeNativeMethods.BodyEnable(Body); @@ -1952,7 +1914,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changeOrientation(Quaternion newOri) { - if(m_orientation != newOri) + if (m_orientation.NotEqual(newOri)) { m_orientation = newOri; // keep a copy for core use // but only use rotations around Z @@ -1961,7 +1923,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_orientation2D.Z = newOri.Z; float t = m_orientation2D.W * m_orientation2D.W + m_orientation2D.Z * m_orientation2D.Z; - if(t > 0) + if (t > 0) { t = 1.0f / (float)Math.Sqrt(t); m_orientation2D.W *= t; @@ -1977,12 +1939,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (Body != IntPtr.Zero) { - SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); - myrot.X = m_orientation2D.X; - myrot.Y = m_orientation2D.Y; - myrot.Z = m_orientation2D.Z; - myrot.W = m_orientation2D.W; - SafeNativeMethods.BodySetQuaternion(Body,ref myrot); + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion() + { + X = m_orientation2D.X, + Y = m_orientation2D.Y, + Z = m_orientation2D.Z, + W = m_orientation2D.W + }; + SafeNativeMethods.BodySetQuaternion(Body, ref myrot); SafeNativeMethods.BodyEnable(Body); } } @@ -2066,10 +2030,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde { setFreeMove(); - if(Body != IntPtr.Zero) + if (Body != IntPtr.Zero) { - if(newForce.X != 0f || newForce.Y != 0f || newForce.Z != 0) - SafeNativeMethods.BodyAddForce(Body,newForce.X,newForce.Y,newForce.Z); + if (newForce.X != 0f || newForce.Y != 0f || newForce.Z != 0) + SafeNativeMethods.BodyAddForce(Body, newForce.X, newForce.Y, newForce.Z); SafeNativeMethods.BodyEnable(Body); } } @@ -2080,9 +2044,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde _velocity = newmomentum; setFreeMove(); - if(Body != IntPtr.Zero) + if (Body != IntPtr.Zero) { - SafeNativeMethods.BodySetLinearVel(Body,newmomentum.X,newmomentum.Y,newmomentum.Z); + SafeNativeMethods.BodySetLinearVel(Body, newmomentum.X, newmomentum.Y, newmomentum.Z); SafeNativeMethods.BodyEnable(Body); } } @@ -2090,7 +2054,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changePIDHoverHeight(float val) { m_PIDHoverHeight = val; - if(val == 0) + if (val == 0) m_useHoverPID = false; } @@ -2113,15 +2077,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde { } - public bool DoAChange(changes what,object arg) + public bool DoAChange(changes what, object arg) { - if(collider == IntPtr.Zero && what != changes.Add && what != changes.Remove) + if (collider == IntPtr.Zero && what != changes.Add && what != changes.Remove) { return false; } // nasty switch - switch(what) + switch (what) { case changes.Add: changeAdd(); @@ -2154,12 +2118,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde changeTargetVelocity((Vector3)arg); break; - // case changes.Acceleration: - // changeacceleration((Vector3)arg); - // break; - // case changes.AngVelocity: - // changeangvelocity((Vector3)arg); - // break; + //case changes.Acceleration: + // changeacceleration((Vector3)arg); + // break; + //case changes.AngVelocity: + // changeangvelocity((Vector3)arg); + // break; case changes.Force: changeForce((Vector3)arg); @@ -2210,33 +2174,33 @@ namespace OpenSim.Region.PhysicsModule.ubOde break; /* not in use for now - case changes.Shape: - changeShape((PrimitiveBaseShape)arg); - break; + case changes.Shape: + changeShape((PrimitiveBaseShape)arg); + break; - case changes.CollidesWater: - changeFloatOnWater((bool)arg); - break; + case changes.CollidesWater: + changeFloatOnWater((bool)arg); + break; - case changes.VolumeDtc: - changeVolumedetetion((bool)arg); - break; + case changes.VolumeDtc: + changeVolumedetetion((bool)arg); + break; - case changes.Physical: - changePhysicsStatus((bool)arg); - break; + case changes.Physical: + changePhysicsStatus((bool)arg); + break; - case changes.Selected: - changeSelectedStatus((bool)arg); - break; + case changes.Selected: + changeSelectedStatus((bool)arg); + break; - case changes.disabled: - changeDisable((bool)arg); - break; + case changes.disabled: + changeDisable((bool)arg); + break; - case changes.building: - changeBuilding((bool)arg); - break; + case changes.building: + changeBuilding((bool)arg); + break; */ case changes.Null: donullchange(); @@ -2249,9 +2213,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde return false; } - public void AddChange(changes what,object arg) + public void AddChange(changes what, object arg) { - m_parent_scene.AddChange((PhysicsActor)this,what,arg); + m_parent_scene.AddChange((PhysicsActor)this, what, arg); } private struct strAvatarSize diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs index 6322770650..52d2310b63 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs @@ -153,7 +153,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public ODEDynamics(OdePrim rootp) { rootPrim = rootp; - _pParentScene = rootPrim._parent_scene; + _pParentScene = rootPrim.m_parentScene; m_timestep = _pParentScene.ODE_STEPSIZE; m_invtimestep = 1.0f / m_timestep; m_gravmod = rootPrim.GravModifier; @@ -853,10 +853,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde } // hover - if (m_VhoverTimescale < 300 && rootPrim.prim_geom != IntPtr.Zero) + if (m_VhoverTimescale < 300 && rootPrim.m_prim_geom != IntPtr.Zero) { // d.Vector3 pos = d.BodyGetPosition(Body); - SafeNativeMethods.Vector3 pos = SafeNativeMethods.GeomGetPosition(rootPrim.prim_geom); + SafeNativeMethods.Vector3 pos = SafeNativeMethods.GeomGetPosition(rootPrim.m_prim_geom); pos.Z -= 0.21f; // minor offset that seems to be always there in sl float t = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y); @@ -997,10 +997,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde float broll = effroll; /* - if (broll > halfpi) - broll = pi - broll; - else if (broll < -halfpi) - broll = -pi - broll; + if (broll > halfpi) + broll = pi - broll; + else if (broll < -halfpi) + broll = -pi - broll; */ broll *= m_bankingEfficiency; if (m_bankingMix != 0) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 9ad304faee..b54ec588da 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -74,14 +74,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde private byte m_angularlocks = 0; private Quaternion m_lastorientation; - private Quaternion _orientation; + private Quaternion m_orientation; - private Vector3 _position; + private Vector3 m_position; private Vector3 _velocity; private Vector3 m_lastVelocity; private Vector3 m_lastposition; private Vector3 m_rotationalVelocity; - private Vector3 _size; + private Vector3 m_size; private Vector3 m_acceleration; private IntPtr Amotor; @@ -90,8 +90,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde internal Vector3 m_torque; internal Vector3 m_angularForceacc; - private float m_invTimeStep; - private float m_timeStep; + public readonly ODEScene m_parentScene; + private readonly float m_sceneInverseTimeStep; + private readonly float m_sceneTimeStep; private Vector3 m_PIDTarget; private float m_PIDTau; @@ -102,8 +103,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde private bool m_useHoverPID; private PIDHoverType m_PIDHoverType; private float m_targetHoverHeight; - private float m_groundHeight; - private float m_waterHeight; private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. private int m_body_autodisable_frames; @@ -120,9 +119,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde CollisionCategories.Land | CollisionCategories.VolumeDtc); -// private bool m_collidesLand = true; - private bool m_collidesWater; -// public bool m_returnCollisions; + //private bool m_collidesLand = true; + //private bool m_collidesWater; + //public bool m_returnCollisions; private bool m_NoColide; // for now only for internal use for bad meshs @@ -135,20 +134,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde private uint m_localID; private IMesh m_mesh; - private object m_meshlock = new object(); - private PrimitiveBaseShape _pbs; + private readonly object m_meshlock = new object(); + private PrimitiveBaseShape m_pbs; private UUID? m_assetID; private MeshState m_meshState; - public ODEScene _parent_scene; /// /// The physics space which contains prim geometry /// public IntPtr m_targetSpace; - public IntPtr prim_geom; + public IntPtr m_prim_geom; public IntPtr _triMeshData; private PhysicsActor _parent; @@ -158,7 +156,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public float m_collisionscore; private int m_colliderfilter = 0; - public IntPtr collide_geom; // for objects: geom if single prim space it linkset + public IntPtr m_collide_geom; // for objects: geom if single prim space it linkset private float m_density; private byte m_shapetype; @@ -185,9 +183,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde float primVolume; // prim own volume; float m_mass; // object mass acording to case - public int givefakepos; + public int m_givefakepos; private Vector3 fakepos; - public int givefakeori; + public int m_givefakeori; private Quaternion fakeori; private PhysicsInertiaData m_fakeInertiaOverride; @@ -248,8 +246,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde get { return m_building; } set { -// if (value) -// m_building = true; + //if (value) + // m_building = true; AddChange(changes.building, value); } } @@ -259,7 +257,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde cdata.mu = mu; cdata.bounce = bounce; - // cdata.softcolide = m_softcolide; + //cdata.softcolide = m_softcolide; cdata.softcolide = false; if (m_isphysical) @@ -272,7 +270,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (veh != null && veh.Type != Vehicle.TYPE_NONE) cdata.mu *= veh.FrictionFactor; -// cdata.mu *= 0; + // cdata.mu *= 0; } } @@ -311,7 +309,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { uint oldid = m_localID; m_localID = value; - _parent_scene.changePrimID(this, oldid); + m_parentScene.changePrimID(this, oldid); } } @@ -397,28 +395,28 @@ namespace OpenSim.Region.PhysicsModule.ubOde { get { - if (givefakepos > 0) + if (m_givefakepos > 0) return fakepos; else - return _position; + return m_position; } set { fakepos = value; - givefakepos++; + m_givefakepos++; AddChange(changes.Position, value); } } public override Vector3 Size { - get { return _size; } + get { return m_size; } set { if (value.IsFinite()) { - _parent_scene.m_meshWorker.ChangeActorPhysRep(this, _pbs, value, m_fakeShapetype); + m_parentScene.m_meshWorker.ChangeActorPhysRep(this, m_pbs, value, m_fakeShapetype); } else { @@ -513,7 +511,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde inertia.TotalMass = m_mass; - if(Body == IntPtr.Zero || prim_geom == IntPtr.Zero) + if(Body == IntPtr.Zero || m_prim_geom == IntPtr.Zero) { inertia.CenterOfMass = Vector3.Zero; inertia.Inertia = Vector3.Zero; @@ -523,10 +521,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde SafeNativeMethods.Vector3 dtmp; SafeNativeMethods.Mass m = new SafeNativeMethods.Mass(); - lock(_parent_scene.OdeLock) + lock(m_parentScene.OdeLock) { SafeNativeMethods.AllocateODEDataForThread(0); - dtmp = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + dtmp = SafeNativeMethods.GeomGetOffsetPosition(m_prim_geom); SafeNativeMethods.BodyGetMass(Body, out m); } @@ -552,8 +550,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde else m_fakeInertiaOverride = null; - if (inertia.TotalMass > _parent_scene.maximumMassObject) - inertia.TotalMass = _parent_scene.maximumMassObject; + if (inertia.TotalMass > m_parentScene.maximumMassObject) + inertia.TotalMass = m_parentScene.maximumMassObject; AddChange(changes.SetInertia,(object)m_fakeInertiaOverride); } @@ -561,7 +559,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { get { - lock (_parent_scene.OdeLock) + lock (m_parentScene.OdeLock) { SafeNativeMethods.AllocateODEDataForThread(0); @@ -571,11 +569,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde dtmp = SafeNativeMethods.BodyGetPosition(Body); return new Vector3(dtmp.X, dtmp.Y, dtmp.Z); } - else if (prim_geom != IntPtr.Zero) + else if (m_prim_geom != IntPtr.Zero) { - Quaternion q = SafeNativeMethods.GeomGetQuaternionOMV(prim_geom); + Quaternion q = SafeNativeMethods.GeomGetQuaternionOMV(m_prim_geom); Vector3 Ptot = m_OBBOffset * q; - dtmp = SafeNativeMethods.GeomGetPosition(prim_geom); + dtmp = SafeNativeMethods.GeomGetPosition(m_prim_geom); Ptot.X += dtmp.X; Ptot.Y += dtmp.Y; Ptot.Z += dtmp.Z; @@ -605,7 +603,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde */ } else - return _position; + return m_position; } } } @@ -615,7 +613,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde set { // AddChange(changes.Shape, value); - _parent_scene.m_meshWorker.ChangeActorPhysRep(this, value, _size, m_fakeShapetype); + m_parentScene.m_meshWorker.ChangeActorPhysRep(this, value, m_size, m_fakeShapetype); } } @@ -628,7 +626,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde set { m_fakeShapetype = value; - _parent_scene.m_meshWorker.ChangeActorPhysRep(this, _pbs, _size, value); + m_parentScene.m_meshWorker.ChangeActorPhysRep(this, m_pbs, m_size, value); } } @@ -705,18 +703,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde { get { - if (givefakeori > 0) + if (m_givefakeori > 0) return fakeori; else - return _orientation; + return m_orientation; } set { if (QuaternionIsFinite(value)) { fakeori = value; - givefakeori++; + m_givefakeori++; value.Normalize(); @@ -780,7 +778,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { set { - AddChange(changes.CollidesWater, value); + //AddChange(changes.CollidesWater, value); } } @@ -816,7 +814,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde float tmp = 0; if (value > 0) { - float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); + float mint = (0.05f > m_sceneTimeStep ? 0.05f : m_sceneTimeStep); if (value < mint) tmp = mint; else @@ -860,7 +858,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde float tmp =0; if (value > 0) { - float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); + float mint = (0.05f > m_sceneTimeStep ? 0.05f : m_sceneTimeStep); if (value < mint) tmp = mint; else @@ -942,7 +940,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(pushforce) AddChange(changes.AddForce, force); else // a impulse - AddChange(changes.AddForce, force * m_invTimeStep); + AddChange(changes.AddForce, force * m_sceneInverseTimeStep); } else { @@ -968,18 +966,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override void CrossingFailure() { - lock(_parent_scene.OdeLock) + lock(m_parentScene.OdeLock) { if (m_outbounds) { - _position.X = Utils.Clamp(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f); - _position.Y = Utils.Clamp(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f); - _position.Z = Utils.Clamp(_position.Z + 0.2f, Constants.MinSimulationHeight, Constants.MaxSimulationHeight); + m_position.X = Utils.Clamp(m_position.X, 0.5f, m_parentScene.WorldExtents.X - 0.5f); + m_position.Y = Utils.Clamp(m_position.Y, 0.5f, m_parentScene.WorldExtents.Y - 0.5f); + m_position.Z = Utils.Clamp(m_position.Z + 0.2f, Constants.MinSimulationHeight, Constants.MaxSimulationHeight); - m_lastposition = _position; - _velocity.X = 0; - _velocity.Y = 0; - _velocity.Z = 0; + m_lastposition = m_position; + _velocity = Vector3.Zero; SafeNativeMethods.AllocateODEDataForThread(0); @@ -989,8 +985,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(Body != IntPtr.Zero) SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it - if (prim_geom != IntPtr.Zero) - SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + if (m_prim_geom != IntPtr.Zero) + SafeNativeMethods.GeomSetPosition(m_prim_geom, m_position.X, m_position.Y, m_position.Z); m_outbounds = false; changeDisable(false); @@ -1001,15 +997,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override void CrossingStart() { - lock(_parent_scene.OdeLock) + lock(m_parentScene.OdeLock) { if (m_outbounds || childPrim) return; m_outbounds = true; - m_lastposition = _position; - m_lastorientation = _orientation; + m_lastposition = m_position; + m_lastorientation = m_orientation; SafeNativeMethods.AllocateODEDataForThread(0); if(Body != IntPtr.Zero) @@ -1027,8 +1023,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0); } - if(prim_geom != IntPtr.Zero) - SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + if(m_prim_geom != IntPtr.Zero) + SafeNativeMethods.GeomSetPosition(m_prim_geom, m_position.X, m_position.Y, m_position.Z); disableBodySoft(); // stop collisions UnSubscribeEvents(); } @@ -1041,8 +1037,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override void SetMaterial(int pMaterial) { m_material = pMaterial; - mu = _parent_scene.m_materialContactsData[pMaterial].mu; - bounce = _parent_scene.m_materialContactsData[pMaterial].bounce; + mu = m_parentScene.m_materialContactsData[pMaterial].mu; + bounce = m_parentScene.m_materialContactsData[pMaterial].bounce; } public override float Density @@ -1113,7 +1109,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override void LockAngularMotion(byte axislock) { -// m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); + //m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); AddChange(changes.AngLock, axislock); } @@ -1142,7 +1138,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde CollisionEvents = null; } m_eventsubscription = 0; - _parent_scene.RemoveCollisionEventReporting(this); + m_parentScene.RemoveCollisionEventReporting(this); } public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) @@ -1151,7 +1147,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde CollisionEvents = new CollisionEventUpdate(); CollisionEvents.AddCollider(CollidedWith, contact); - _parent_scene.AddCollisionEventReporting(this); + m_parentScene.AddCollisionEventReporting(this); } public override void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact) @@ -1160,7 +1156,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde CollisionVDTCEvents = new CollisionEventUpdate(); CollisionVDTCEvents.AddCollider(CollidedWith, contact); - _parent_scene.AddCollisionEventReporting(this); + m_parentScene.AddCollisionEventReporting(this); } internal void SleeperAddCollisionEvents() @@ -1171,7 +1167,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if(kvp.Key == 0) continue; - OdePrim other = _parent_scene.getPrim(kvp.Key); + OdePrim other = m_parentScene.getPrim(kvp.Key); if(other == null) continue; ContactPoint cp = kvp.Value; @@ -1184,7 +1180,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { foreach(KeyValuePair kvp in CollisionVDTCEvents.m_objCollisionList) { - OdePrim other = _parent_scene.getPrim(kvp.Key); + OdePrim other = m_parentScene.getPrim(kvp.Key); if(other == null) continue; ContactPoint cp = kvp.Value; @@ -1243,7 +1239,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public OdePrim(String primName, ODEScene parent_scene, Vector3 pos, Vector3 size, Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID) { - _parent_scene = parent_scene; + m_parentScene = parent_scene; Name = primName; m_localID = plocalID; @@ -1256,17 +1252,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde parent_scene.GetTerrainHeightAtXY(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f)) + 0.5f); m_log.WarnFormat("[PHYSICS]: Got nonFinite Object create Position for {0}", Name); } - _position = pos; - givefakepos = 0; + m_position = pos; + m_givefakepos = 0; - m_timeStep = parent_scene.ODE_STEPSIZE; - m_invTimeStep = 1f / m_timeStep; + m_sceneTimeStep = parent_scene.ODE_STEPSIZE; + m_sceneInverseTimeStep = 1f / m_sceneTimeStep; m_density = parent_scene.geomDefaultDensity; m_body_autodisable_frames = parent_scene.bodyFramesAutoDisable; - prim_geom = IntPtr.Zero; - collide_geom = IntPtr.Zero; + m_prim_geom = IntPtr.Zero; + m_collide_geom = IntPtr.Zero; Body = IntPtr.Zero; if (!size.IsFinite()) @@ -1275,11 +1271,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_log.WarnFormat("[PHYSICS]: Got nonFinite Object create Size for {0}", Name); } - if (size.X <= 0) size.X = 0.01f; - if (size.Y <= 0) size.Y = 0.01f; - if (size.Z <= 0) size.Z = 0.01f; - - _size = size; + m_size.X = (size.X <= 0) ? 0.01f : size.X; + m_size.Y = (size.Y <= 0) ? 0.01f : size.Y; + m_size.Z = (size.Z <= 0) ? 0.01f : size.Z; if (!QuaternionIsFinite(rotation)) { @@ -1287,21 +1281,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_log.WarnFormat("[PHYSICS]: Got nonFinite Object create Rotation for {0}", Name); } - _orientation = rotation; - givefakeori = 0; + m_orientation = rotation; + m_givefakeori = 0; - _pbs = pbs; + m_pbs = pbs; m_targetSpace = IntPtr.Zero; - if (pos.Z < 0) - { - m_isphysical = false; - } - else - { - m_isphysical = pisPhysical; - } + m_isphysical = pos.Z < Constants.MinSimulationHeight || pos.Z > Constants.MaxSimulationHeight ? false : pisPhysical; m_fakeisphysical = m_isphysical; m_isVolumeDetect = false; @@ -1332,7 +1319,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde AddChange(changes.Add, null); // get basic mass parameters - ODEPhysRepData repData = _parent_scene.m_meshWorker.NewActorPhysRep(this, _pbs, _size, _shapeType); + ODEPhysRepData repData = m_parentScene.m_meshWorker.NewActorPhysRep(this, m_pbs, m_size, _shapeType); primVolume = repData.volume; m_OBB = repData.OBB; @@ -1388,7 +1375,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void ApplyCollisionCatFlags() { - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { if (!childPrim && childrenPrim.Count > 0) { @@ -1430,20 +1417,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - if (prm.prim_geom != IntPtr.Zero) + if (prm.m_prim_geom != IntPtr.Zero) { if (prm.m_NoColide) { - SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(prm.m_prim_geom, 0); if (m_isphysical) - SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land); + SafeNativeMethods.GeomSetCollideBits(prm.m_prim_geom, (int)CollisionCategories.Land); else - SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(prm.m_prim_geom, 0); } else { - SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prm.m_prim_geom, (uint)prm.m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prm.m_prim_geom, (uint)prm.m_collisionFlags); } } } @@ -1451,22 +1438,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_NoColide) { - SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0); - SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land); - if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) + SafeNativeMethods.GeomSetCategoryBits(m_prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(m_prim_geom, (uint)CollisionCategories.Land); + if (m_collide_geom != m_prim_geom && m_collide_geom != IntPtr.Zero) { - SafeNativeMethods.GeomSetCategoryBits(collide_geom, 0); - SafeNativeMethods.GeomSetCollideBits(collide_geom, (uint)CollisionCategories.Land); + SafeNativeMethods.GeomSetCategoryBits(m_collide_geom, 0); + SafeNativeMethods.GeomSetCollideBits(m_collide_geom, (uint)CollisionCategories.Land); } } else { - SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); - if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) + SafeNativeMethods.GeomSetCategoryBits(m_prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(m_prim_geom, (uint)m_collisionFlags); + if (m_collide_geom != m_prim_geom && m_collide_geom != IntPtr.Zero) { - SafeNativeMethods.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(m_collide_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(m_collide_geom, (uint)m_collisionFlags); } } } @@ -1509,7 +1496,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde SafeNativeMethods.BodySetTorque(Body, 0, 0, 0); SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0); - Amotor = SafeNativeMethods.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); + Amotor = SafeNativeMethods.JointCreateAMotor(m_parentScene.world, IntPtr.Zero); SafeNativeMethods.JointAttach(Amotor, Body, IntPtr.Zero); SafeNativeMethods.JointSetAMotorMode(Amotor, 0); @@ -1584,32 +1571,32 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void SetGeom(IntPtr geom) { - prim_geom = geom; + m_prim_geom = geom; //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { if (m_NoColide) { - SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(m_prim_geom, 0); if (m_isphysical) { - SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land); + SafeNativeMethods.GeomSetCollideBits(m_prim_geom, (uint)CollisionCategories.Land); } else { - SafeNativeMethods.GeomSetCollideBits(prim_geom, 0); - SafeNativeMethods.GeomDisable(prim_geom); + SafeNativeMethods.GeomSetCollideBits(m_prim_geom, 0); + SafeNativeMethods.GeomDisable(m_prim_geom); } } else { - SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(m_prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(m_prim_geom, (uint)m_collisionFlags); } UpdatePrimBodyData(); - _parent_scene.actor_name_map[prim_geom] = this; + m_parentScene.actor_name_map[m_prim_geom] = this; /* // debug @@ -1648,16 +1635,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (vertexCount == 0 || indexCount == 0) { m_log.WarnFormat("[PHYSICS]: Invalid mesh data on OdePrim {0}, mesh {1} at {2}", - Name, _pbs.SculptEntry ? _pbs.SculptTexture.ToString() : "primMesh",_position.ToString()); + Name, m_pbs.SculptEntry ? m_pbs.SculptTexture.ToString() : "primMesh",m_position.ToString()); m_hasOBB = false; m_OBBOffset = Vector3.Zero; - m_OBB = _size * 0.5f; + m_OBB = m_size * 0.5f; m_physCost = 0.1f; m_streamCost = 1.0f; - _parent_scene.mesher.ReleaseMesh(mesh); + m_parentScene.mesher.ReleaseMesh(mesh); m_meshState = MeshState.MeshFailed; m_mesh = null; return false; @@ -1666,8 +1653,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (vertexCount > 64000 || indexCount > 64000) { m_log.WarnFormat("[PHYSICS]: large mesh data on OdePrim {0}, mesh {1} at {2}, {3} vertices, {4} indexes", - Name, _pbs.SculptEntry ? _pbs.SculptTexture.ToString() : "primMesh", - _position.ToString() ,vertexCount , indexCount ); + Name, m_pbs.SculptEntry ? m_pbs.SculptTexture.ToString() : "primMesh", + m_position.ToString() ,vertexCount , indexCount ); } IntPtr geo = IntPtr.Zero; @@ -1698,11 +1685,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_hasOBB = false; m_OBBOffset = Vector3.Zero; - m_OBB = _size * 0.5f; + m_OBB = m_size * 0.5f; m_physCost = 0.1f; m_streamCost = 1.0f; - _parent_scene.mesher.ReleaseMesh(mesh); + m_parentScene.mesher.ReleaseMesh(mesh); m_meshState = MeshState.MeshFailed; m_mesh = null; return false; @@ -1739,12 +1726,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde { IntPtr geo = IntPtr.Zero; - if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1 - && _size.X == _size.Y && _size.Y == _size.Z) + if (m_pbs.ProfileShape == ProfileShape.HalfCircle && m_pbs.PathCurve == (byte)Extrusion.Curve1 + && m_size.X == m_size.Y && m_size.Y == m_size.Z) { // it's a sphere try { - geo = SafeNativeMethods.CreateSphere(m_targetSpace, _size.X * 0.5f); + geo = SafeNativeMethods.CreateSphere(m_targetSpace, m_size.X * 0.5f); } catch (Exception e) { @@ -1756,7 +1743,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde {// do it as a box try { - geo = SafeNativeMethods.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); + geo = SafeNativeMethods.CreateBox(m_targetSpace, m_size.X, m_size.Y, m_size.Z); } catch (Exception e) { @@ -1772,13 +1759,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void RemoveGeom() { - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { - _parent_scene.actor_name_map.Remove(prim_geom); + m_parentScene.actor_name_map.Remove(m_prim_geom); try { - SafeNativeMethods.GeomDestroy(prim_geom); + SafeNativeMethods.GeomDestroy(m_prim_geom); if (_triMeshData != IntPtr.Zero) { SafeNativeMethods.GeomTriMeshDataDestroy(_triMeshData); @@ -1790,8 +1777,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction failed for {0} exception {1}", Name, e); } - prim_geom = IntPtr.Zero; - collide_geom = IntPtr.Zero; + m_prim_geom = IntPtr.Zero; + m_collide_geom = IntPtr.Zero; m_targetSpace = IntPtr.Zero; } else @@ -1803,7 +1790,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_mesh != null) { - _parent_scene.mesher.ReleaseMesh(m_mesh); + m_parentScene.mesher.ReleaseMesh(m_mesh); m_mesh = null; } } @@ -1816,9 +1803,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde // should only be called for non physical prims unless they are becoming non physical private void SetInStaticSpace(OdePrim prim) { - IntPtr targetSpace = _parent_scene.MoveGeomToStaticSpace(prim.prim_geom, prim.m_targetSpace); + IntPtr targetSpace = m_parentScene.MoveGeomToStaticSpace(prim.m_prim_geom, prim.m_targetSpace); prim.m_targetSpace = targetSpace; - collide_geom = IntPtr.Zero; + m_collide_geom = IntPtr.Zero; } public void enableBodySoft() @@ -1868,7 +1855,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_building) return; - if (prim_geom == IntPtr.Zero) + if (m_prim_geom == IntPtr.Zero) { m_log.Warn("[PHYSICS]: Unable to link the linkset. Root has no geom yet"); return; @@ -1880,19 +1867,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_log.Warn("[PHYSICS]: MakeBody called having a body"); } - if (SafeNativeMethods.GeomGetBody(prim_geom) != IntPtr.Zero) + if (SafeNativeMethods.GeomGetBody(m_prim_geom) != IntPtr.Zero) { - SafeNativeMethods.GeomSetBody(prim_geom, IntPtr.Zero); + SafeNativeMethods.GeomSetBody(m_prim_geom, IntPtr.Zero); m_log.Warn("[PHYSICS]: MakeBody root geom already had a body"); } bool noInertiaOverride = (m_InertiaOverride == null); - Body = SafeNativeMethods.BodyCreate(_parent_scene.world); + Body = SafeNativeMethods.BodyCreate(m_parentScene.world); // set the body rotation SafeNativeMethods.Matrix3 mymat = new SafeNativeMethods.Matrix3(); - SafeNativeMethods.RfromQ(ref mymat, ref _orientation); + SafeNativeMethods.RfromQ(ref mymat, ref m_orientation); SafeNativeMethods.BodySetRotation(Body, ref mymat); SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass { }; @@ -1911,44 +1898,40 @@ namespace OpenSim.Region.PhysicsModule.ubOde SafeNativeMethods.Mass tmpdmass = new SafeNativeMethods.Mass { }; Vector3 rcm; - rcm.X = _position.X; - rcm.Y = _position.Y; - rcm.Z = _position.Z; + rcm = m_position; lock (childrenPrim) { foreach (OdePrim prm in childrenPrim) { - if (prm.prim_geom == IntPtr.Zero) + if (prm.m_prim_geom == IntPtr.Zero) { m_log.Warn("[PHYSICS]: Unable to link one of the linkset elements, skipping it. No geom yet"); continue; } - SafeNativeMethods.RfromQ(ref mat, ref prm._orientation); + SafeNativeMethods.RfromQ(ref mat, ref prm.m_orientation); // fix prim colision cats - if (SafeNativeMethods.GeomGetBody(prm.prim_geom) != IntPtr.Zero) + if (SafeNativeMethods.GeomGetBody(prm.m_prim_geom) != IntPtr.Zero) { - SafeNativeMethods.GeomSetBody(prm.prim_geom, IntPtr.Zero); + SafeNativeMethods.GeomSetBody(prm.m_prim_geom, IntPtr.Zero); m_log.Warn("[PHYSICS]: MakeBody child geom already had a body"); } - SafeNativeMethods.GeomClearOffset(prm.prim_geom); - SafeNativeMethods.GeomSetBody(prm.prim_geom, Body); + SafeNativeMethods.GeomClearOffset(prm.m_prim_geom); + SafeNativeMethods.GeomSetBody(prm.m_prim_geom, Body); prm.Body = Body; - SafeNativeMethods.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); // set relative rotation + SafeNativeMethods.GeomSetOffsetWorldRotation(prm.m_prim_geom, ref mat); // set relative rotation if(noInertiaOverride) { tmpdmass = prm.primdMass; SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); - Vector3 ppos = prm._position; - ppos.X -= rcm.X; - ppos.Y -= rcm.Y; - ppos.Z -= rcm.Z; + Vector3 ppos = prm.m_position; + ppos -= rcm; // refer inertia to root prim center of mass position SafeNativeMethods.MassTranslate(ref tmpdmass, ppos.X, @@ -1961,27 +1944,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - SafeNativeMethods.GeomClearOffset(prim_geom); // make sure we don't have a hidden offset + SafeNativeMethods.GeomClearOffset(m_prim_geom); // make sure we don't have a hidden offset // associate root geom with body - SafeNativeMethods.GeomSetBody(prim_geom, Body); + SafeNativeMethods.GeomSetBody(m_prim_geom, Body); if(noInertiaOverride) - SafeNativeMethods.BodySetPosition(Body, _position.X + objdmass.c.X, _position.Y + objdmass.c.Y, _position.Z + objdmass.c.Z); + SafeNativeMethods.BodySetPosition(Body, m_position.X + objdmass.c.X, m_position.Y + objdmass.c.Y, m_position.Z + objdmass.c.Z); else { - Vector3 ncm = m_InertiaOverride.CenterOfMass * _orientation; + Vector3 ncm = m_InertiaOverride.CenterOfMass * m_orientation; SafeNativeMethods.BodySetPosition(Body, - _position.X + ncm.X, - _position.Y + ncm.Y, - _position.Z + ncm.Z); + m_position.X + ncm.X, + m_position.Y + ncm.Y, + m_position.Z + ncm.Z); } - SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.GeomSetOffsetWorldPosition(m_prim_geom, m_position.X, m_position.Y, m_position.Z); if(noInertiaOverride) { SafeNativeMethods.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body - Quaternion mr = Quaternion.Conjugate(_orientation); + Quaternion mr = Quaternion.Conjugate(m_orientation); SafeNativeMethods.RfromQ(ref mymat, ref mr); SafeNativeMethods.MassRotate(ref objdmass, ref mymat); @@ -2023,19 +2006,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_targetSpace != IntPtr.Zero) { - _parent_scene.waitForSpaceUnlock(m_targetSpace); - if (SafeNativeMethods.SpaceQuery(m_targetSpace, prim_geom)) - SafeNativeMethods.SpaceRemove(m_targetSpace, prim_geom); + m_parentScene.waitForSpaceUnlock(m_targetSpace); + if (SafeNativeMethods.SpaceQuery(m_targetSpace, m_prim_geom)) + SafeNativeMethods.SpaceRemove(m_targetSpace, m_prim_geom); } if (childrenPrim.Count == 0) { - collide_geom = prim_geom; - m_targetSpace = _parent_scene.ActiveSpace; + m_collide_geom = m_prim_geom; + m_targetSpace = m_parentScene.ActiveSpace; } else { - m_targetSpace = SafeNativeMethods.SimpleSpaceCreate(_parent_scene.ActiveSpace); + m_targetSpace = SafeNativeMethods.SimpleSpaceCreate(m_parentScene.ActiveSpace); SafeNativeMethods.SpaceSetSublevel(m_targetSpace, 3); SafeNativeMethods.SpaceSetCleanup(m_targetSpace, false); @@ -2045,13 +2028,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde CollisionCategories.VolumeDtc )); SafeNativeMethods.GeomSetCollideBits(m_targetSpace, 0); - collide_geom = m_targetSpace; + m_collide_geom = m_targetSpace; } - if (SafeNativeMethods.SpaceQuery(m_targetSpace, prim_geom)) + if (SafeNativeMethods.SpaceQuery(m_targetSpace, m_prim_geom)) m_log.Debug("[PRIM]: parent already in target space"); else - SafeNativeMethods.SpaceAdd(m_targetSpace, prim_geom); + SafeNativeMethods.SpaceAdd(m_targetSpace, m_prim_geom); if (m_delaySelect) { @@ -2064,25 +2047,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde UpdateCollisionCatFlags(); ApplyCollisionCatFlags(); - _parent_scene.addActivePrim(this); + m_parentScene.addActivePrim(this); lock (childrenPrim) { foreach (OdePrim prm in childrenPrim) { - IntPtr prmgeom = prm.prim_geom; + IntPtr prmgeom = prm.m_prim_geom; if (prmgeom == IntPtr.Zero) continue; - Vector3 ppos = prm._position; - SafeNativeMethods.GeomSetOffsetWorldPosition(prm.prim_geom, ppos.X, ppos.Y, ppos.Z); // set relative position + Vector3 ppos = prm.m_position; + SafeNativeMethods.GeomSetOffsetWorldPosition(prm.m_prim_geom, ppos.X, ppos.Y, ppos.Z); // set relative position IntPtr prmspace = prm.m_targetSpace; if (prmspace != m_targetSpace) { if (prmspace != IntPtr.Zero) { - _parent_scene.waitForSpaceUnlock(prmspace); + m_parentScene.waitForSpaceUnlock(prmspace); if (SafeNativeMethods.SpaceQuery(prmspace, prmgeom)) SafeNativeMethods.SpaceRemove(prmspace, prmgeom); } @@ -2098,7 +2081,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(!m_disabled) prm.m_disabled = false; - _parent_scene.addActivePrim(prm); + m_parentScene.addActivePrim(prm); } } @@ -2121,16 +2104,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde _zeroFlag = false; m_bodydisablecontrol = 0; } - _parent_scene.addActiveGroups(this); + m_parentScene.addActiveGroups(this); } private void DestroyBody() { if (Body != IntPtr.Zero) { - _parent_scene.remActivePrim(this); + m_parentScene.remActivePrim(this); - collide_geom = IntPtr.Zero; + m_collide_geom = IntPtr.Zero; if (m_disabled) m_collisionCategories = 0; @@ -2145,20 +2128,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_collisionFlags = 0; - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { if (m_NoColide) { - SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0); - SafeNativeMethods.GeomSetCollideBits(prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(m_prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(m_prim_geom, 0); } else { - SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(m_prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(m_prim_geom, (uint)m_collisionFlags); } UpdateDataFromGeom(); - SafeNativeMethods.GeomSetBody(prim_geom, IntPtr.Zero); + SafeNativeMethods.GeomSetBody(m_prim_geom, IntPtr.Zero); SetInStaticSpace(this); } @@ -2168,7 +2151,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { foreach (OdePrim prm in childrenPrim) { - _parent_scene.remActivePrim(prm); + m_parentScene.remActivePrim(prm); if (prm.m_isSelected) prm.m_collisionCategories = CollisionCategories.Selected; @@ -2181,17 +2164,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde prm.m_collisionFlags = 0; - if (prm.prim_geom != IntPtr.Zero) + if (prm.m_prim_geom != IntPtr.Zero) { if (prm.m_NoColide) { - SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0); - SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(prm.m_prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(prm.m_prim_geom, 0); } else { - SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prm.m_prim_geom, (uint)prm.m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prm.m_prim_geom, (uint)prm.m_collisionFlags); } prm.UpdateDataFromGeom(); SetInStaticSpace(prm); @@ -2206,7 +2189,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde SafeNativeMethods.JointDestroy(Amotor); Amotor = IntPtr.Zero; } - _parent_scene.remActiveGroup(this); + m_parentScene.remActiveGroup(this); SafeNativeMethods.BodyDestroy(Body); } Body = IntPtr.Zero; @@ -2236,10 +2219,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde tmpdmass = primdMass; // transform to object frame - mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + mat = SafeNativeMethods.GeomGetOffsetRotation(m_prim_geom); SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); - thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + thispos = SafeNativeMethods.GeomGetOffsetPosition(m_prim_geom); SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, thispos.Y, @@ -2252,19 +2235,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde tmpdmass = primdMass; // update to new position and orientation - _position = NewPos; - SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z); - _orientation = newrot; + m_position = NewPos; + SafeNativeMethods.GeomSetOffsetWorldPosition(m_prim_geom, NewPos.X, NewPos.Y, NewPos.Z); + m_orientation = newrot; quat.X = newrot.X; quat.Y = newrot.Y; quat.Z = newrot.Z; quat.W = newrot.W; - SafeNativeMethods.GeomSetOffsetWorldQuaternion(prim_geom, ref quat); + SafeNativeMethods.GeomSetOffsetWorldQuaternion(m_prim_geom, ref quat); - mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + mat = SafeNativeMethods.GeomGetOffsetRotation(m_prim_geom); SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); - thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + thispos = SafeNativeMethods.GeomGetOffsetPosition(m_prim_geom); SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, thispos.Y, @@ -2306,12 +2289,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde // get prim own inertia in its local frame primmass = primdMass; // transform to object frame - primmat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + primmat = SafeNativeMethods.GeomGetOffsetRotation(m_prim_geom); SafeNativeMethods.MassRotate(ref primmass, ref primmat); tmpdmass = primmass; - thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + thispos = SafeNativeMethods.GeomGetOffsetPosition(m_prim_geom); SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, thispos.Y, @@ -2321,10 +2304,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde DMassSubPartFromObj(ref tmpdmass, ref objdmass); // update to new position - _position = NewPos; - SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z); + m_position = NewPos; + SafeNativeMethods.GeomSetOffsetWorldPosition(m_prim_geom, NewPos.X, NewPos.Y, NewPos.Z); - thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + thispos = SafeNativeMethods.GeomGetOffsetPosition(m_prim_geom); SafeNativeMethods.MassTranslate(ref primmass, thispos.X, thispos.Y, @@ -2369,10 +2352,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde // get prim own inertia in its local frame tmpdmass = primdMass; - mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + mat = SafeNativeMethods.GeomGetOffsetRotation(m_prim_geom); SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); // transform to object frame - thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + thispos = SafeNativeMethods.GeomGetOffsetPosition(m_prim_geom); SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, thispos.Y, @@ -2382,15 +2365,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde DMassSubPartFromObj(ref tmpdmass, ref objdmass); // update to new orientation - _orientation = newrot; + m_orientation = newrot; quat.X = newrot.X; quat.Y = newrot.Y; quat.Z = newrot.Z; quat.W = newrot.W; - SafeNativeMethods.GeomSetOffsetWorldQuaternion(prim_geom, ref quat); + SafeNativeMethods.GeomSetOffsetWorldQuaternion(m_prim_geom, ref quat); tmpdmass = primdMass; - mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + mat = SafeNativeMethods.GeomGetOffsetRotation(m_prim_geom); SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, @@ -2430,8 +2413,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (primMass <= 0) primMass = 0.0001f;//ckrinke: Mass must be greater then zero. - if (primMass > _parent_scene.maximumMassObject) - primMass = _parent_scene.maximumMassObject; + if (primMass > m_parentScene.maximumMassObject) + primMass = m_parentScene.maximumMassObject; m_mass = primMass; // just in case @@ -2491,8 +2474,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (prm.Body != IntPtr.Zero) { - if (prm.prim_geom != IntPtr.Zero) - SafeNativeMethods.GeomSetBody(prm.prim_geom, IntPtr.Zero); + if (prm.m_prim_geom != IntPtr.Zero) + SafeNativeMethods.GeomSetBody(prm.m_prim_geom, IntPtr.Zero); if (prm.Body != prim.Body) prm.DestroyBody(); // don't loose bodies around prm.Body = IntPtr.Zero; @@ -2508,8 +2491,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (prim.Body != IntPtr.Zero) { - if (prim.prim_geom != IntPtr.Zero) - SafeNativeMethods.GeomSetBody(prim.prim_geom, IntPtr.Zero); + if (prim.m_prim_geom != IntPtr.Zero) + SafeNativeMethods.GeomSetBody(prim.m_prim_geom, IntPtr.Zero); prim.DestroyBody(); // don't loose bodies around prim.Body = IntPtr.Zero; } @@ -2532,14 +2515,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void UpdateDataFromGeom() { - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { SafeNativeMethods.Quaternion qtmp; - SafeNativeMethods.GeomCopyQuaternion(prim_geom, out qtmp); - _orientation.X = qtmp.X; - _orientation.Y = qtmp.Y; - _orientation.Z = qtmp.Z; - _orientation.W = qtmp.W; + SafeNativeMethods.GeomCopyQuaternion(m_prim_geom, out qtmp); + m_orientation.X = qtmp.X; + m_orientation.Y = qtmp.Y; + m_orientation.Z = qtmp.Z; + m_orientation.W = qtmp.W; /* // Debug float qlen = _orientation.Length(); @@ -2547,12 +2530,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_log.WarnFormat("[PHYSICS]: Got nonnorm quaternion from geom in Object {0} norm {1}", Name, qlen); // */ - _orientation.Normalize(); + m_orientation.Normalize(); - SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(prim_geom); - _position.X = lpos.X; - _position.Y = lpos.Y; - _position.Z = lpos.Z; + SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(m_prim_geom); + m_position.X = lpos.X; + m_position.Y = lpos.Y; + m_position.Z = lpos.Z; } } @@ -2658,7 +2641,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changeadd() { - _parent_scene.addToPrims(this); + m_parentScene.addToPrims(this); } private void changeAngularLock(byte newLocks) @@ -2814,18 +2797,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde prm.m_collisionCategories = m_collisionCategories; prm.m_collisionFlags = m_collisionFlags; - if (prm.prim_geom != IntPtr.Zero) + if (prm.m_prim_geom != IntPtr.Zero) { if (prm.m_NoColide) { - SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0); - SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(prm.m_prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(prm.m_prim_geom, 0); } else { - SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prm.m_prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prm.m_prim_geom, (uint)m_collisionFlags); } } prm.m_delaySelect = false; @@ -2835,27 +2818,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde // ((OdePrim)_parent).ChildSelectedChange(true); - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { if (m_NoColide) { - SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0); - SafeNativeMethods.GeomSetCollideBits(prim_geom, 0); - if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) + SafeNativeMethods.GeomSetCategoryBits(m_prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(m_prim_geom, 0); + if (m_collide_geom != m_prim_geom && m_collide_geom != IntPtr.Zero) { - SafeNativeMethods.GeomSetCategoryBits(collide_geom, 0); - SafeNativeMethods.GeomSetCollideBits(collide_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(m_collide_geom, 0); + SafeNativeMethods.GeomSetCollideBits(m_collide_geom, 0); } - } else { - SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); - if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) + SafeNativeMethods.GeomSetCategoryBits(m_prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(m_prim_geom, (uint)m_collisionFlags); + if (m_collide_geom != m_prim_geom && m_collide_geom != IntPtr.Zero) { - SafeNativeMethods.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories); - SafeNativeMethods.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(m_collide_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(m_collide_geom, (uint)m_collisionFlags); } } } @@ -2899,10 +2881,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_building) { - _position = newPos; + m_position = newPos; } - else if (m_forcePosOrRotation && _position != newPos && Body != IntPtr.Zero) + else if (m_forcePosOrRotation && Body != IntPtr.Zero && m_position.NotEqual(newPos)) { FixInertia(newPos); if (!SafeNativeMethods.BodyIsEnabled(Body)) @@ -2915,10 +2897,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - if (_position != newPos) + if (m_position.NotEqual(newPos)) { - SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); - _position = newPos; + SafeNativeMethods.GeomSetPosition(m_prim_geom, newPos.X, newPos.Y, newPos.Z); + m_position = newPos; } if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) { @@ -2930,20 +2912,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { - if (newPos != _position) + if (m_position.NotEqual(newPos)) { - SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); - _position = newPos; + SafeNativeMethods.GeomSetPosition(m_prim_geom, newPos.X, newPos.Y, newPos.Z); + m_position = newPos; - m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace); + m_targetSpace = m_parentScene.MoveGeomToStaticSpace(m_prim_geom, m_targetSpace); } } } - givefakepos--; - if (givefakepos < 0) - givefakepos = 0; + m_givefakepos--; + if (m_givefakepos < 0) + m_givefakepos = 0; // changeSelectedStatus(); resetCollisionAccounting(); } @@ -2957,7 +2939,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_building) { - _orientation = newOri; + m_orientation = newOri; } /* else if (m_forcePosOrRotation && _orientation != newOri && Body != IntPtr.Zero) @@ -2970,15 +2952,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - if (newOri != _orientation) + if (newOri.NotEqual(m_orientation)) { - SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); - myrot.X = newOri.X; - myrot.Y = newOri.Y; - myrot.Z = newOri.Z; - myrot.W = newOri.W; - SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); - _orientation = newOri; + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion() + { + X = newOri.X, + Y = newOri.Y, + Z = newOri.Z, + W = newOri.W + }; + SafeNativeMethods.GeomSetQuaternion(m_prim_geom, ref myrot); + m_orientation = newOri; if (Body != IntPtr.Zero) { @@ -2996,23 +2980,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { - if (newOri != _orientation) + if (newOri.NotEqual(m_orientation)) { - SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); - myrot.X = newOri.X; - myrot.Y = newOri.Y; - myrot.Z = newOri.Z; - myrot.W = newOri.W; - SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); - _orientation = newOri; + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion() + { + X = newOri.X, + Y = newOri.Y, + Z = newOri.Z, + W = newOri.W + }; + SafeNativeMethods.GeomSetQuaternion(m_prim_geom, ref myrot); + m_orientation = newOri; } } } - givefakeori--; - if (givefakeori < 0) - givefakeori = 0; + m_givefakeori--; + if (m_givefakeori < 0) + m_givefakeori = 0; resetCollisionAccounting(); } @@ -3023,27 +3009,29 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (childPrim && m_building) // inertia is messed, must rebuild { - _position = newPos; - _orientation = newOri; + m_position = newPos; + m_orientation = newOri; } else { - if (newOri != _orientation) + if (newOri.NotEqual(m_orientation)) { - SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); - myrot.X = newOri.X; - myrot.Y = newOri.Y; - myrot.Z = newOri.Z; - myrot.W = newOri.W; - SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); - _orientation = newOri; + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion() + { + X = newOri.X, + Y = newOri.Y, + Z = newOri.Z, + W = newOri.W + }; + SafeNativeMethods.GeomSetQuaternion(m_prim_geom, ref myrot); + m_orientation = newOri; if (Body != IntPtr.Zero && m_angularlocks != 0) createAMotor(m_angularlocks); } - if (_position != newPos) + if (m_position.NotEqual(newPos)) { - SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); - _position = newPos; + SafeNativeMethods.GeomSetPosition(m_prim_geom, newPos.X, newPos.Y, newPos.Z); + m_position = newPos; } if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) { @@ -3058,34 +3046,36 @@ namespace OpenSim.Region.PhysicsModule.ubOde // string primScenAvatarIn = _parent_scene.whichspaceamIin(_position); // int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { - if (newOri != _orientation) + if (newOri.NotEqual(m_orientation)) { - SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); - myrot.X = newOri.X; - myrot.Y = newOri.Y; - myrot.Z = newOri.Z; - myrot.W = newOri.W; - SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); - _orientation = newOri; + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion() + { + X = newOri.X, + Y = newOri.Y, + Z = newOri.Z, + W = newOri.W + }; + SafeNativeMethods.GeomSetQuaternion(m_prim_geom, ref myrot); + m_orientation = newOri; } - if (newPos != _position) + if (newPos.NotEqual(m_position)) { - SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); - _position = newPos; + SafeNativeMethods.GeomSetPosition(m_prim_geom, newPos.X, newPos.Y, newPos.Z); + m_position = newPos; - m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace); + m_targetSpace = m_parentScene.MoveGeomToStaticSpace(m_prim_geom, m_targetSpace); } } } - givefakepos--; - if (givefakepos < 0) - givefakepos = 0; - givefakeori--; - if (givefakeori < 0) - givefakeori = 0; + m_givefakepos--; + if (m_givefakepos < 0) + m_givefakepos = 0; + m_givefakeori--; + if (m_givefakeori < 0) + m_givefakeori = 0; resetCollisionAccounting(); } @@ -3139,8 +3129,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changeAddPhysRep(ODEPhysRepData repData) { - _size = repData.size; //?? - _pbs = repData.pbs; + m_size = repData.size; //?? + m_pbs = repData.pbs; m_mesh = repData.mesh; @@ -3155,15 +3145,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde CreateGeom(repData.isTooSmall); - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { - SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.GeomSetPosition(m_prim_geom, m_position.X, m_position.Y, m_position.Z); SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); - myrot.X = _orientation.X; - myrot.Y = _orientation.Y; - myrot.Z = _orientation.Z; - myrot.W = _orientation.W; - SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); + myrot.X = m_orientation.X; + myrot.Y = m_orientation.Y; + myrot.Z = m_orientation.Z; + myrot.W = m_orientation.W; + SafeNativeMethods.GeomSetQuaternion(m_prim_geom, ref myrot); } if (!m_isphysical) @@ -3177,10 +3167,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde if ((m_meshState & MeshState.NeedMask) != 0) { - repData.size = _size; - repData.pbs = _pbs; + repData.size = m_size; + repData.pbs = m_pbs; repData.shapetype = m_fakeShapetype; - _parent_scene.m_meshWorker.RequestMesh(repData); + m_parentScene.m_meshWorker.RequestMesh(repData); } else m_shapetype = repData.shapetype; @@ -3188,8 +3178,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changePhysRepData(ODEPhysRepData repData) { - if(_size == repData.size && - _pbs == repData.pbs && + if(m_size == repData.size && + m_pbs == repData.pbs && m_shapetype == repData.shapetype && m_mesh == repData.mesh && primVolume == repData.volume) @@ -3215,8 +3205,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde RemoveGeom(); - _size = repData.size; - _pbs = repData.pbs; + m_size = repData.size; + m_pbs = repData.pbs; m_mesh = repData.mesh; @@ -3231,15 +3221,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde CreateGeom(repData.isTooSmall); - if (prim_geom != IntPtr.Zero) + if (m_prim_geom != IntPtr.Zero) { - SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.GeomSetPosition(m_prim_geom, m_position.X, m_position.Y, m_position.Z); SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); - myrot.X = _orientation.X; - myrot.Y = _orientation.Y; - myrot.Z = _orientation.Z; - myrot.W = _orientation.W; - SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); + myrot.X = m_orientation.X; + myrot.Y = m_orientation.Y; + myrot.Z = m_orientation.Z; + myrot.W = m_orientation.W; + SafeNativeMethods.GeomSetQuaternion(m_prim_geom, ref myrot); } if (m_isphysical) @@ -3265,15 +3255,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde if ((m_meshState & MeshState.NeedMask) != 0) { - repData.size = _size; - repData.pbs = _pbs; + repData.size = m_size; + repData.pbs = m_pbs; repData.shapetype = m_fakeShapetype; - _parent_scene.m_meshWorker.RequestMesh(repData); + m_parentScene.m_meshWorker.RequestMesh(repData); } else m_shapetype = repData.shapetype; } + /* private void changeFloatOnWater(bool newval) { m_collidesWater = newval; @@ -3281,7 +3272,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde UpdateCollisionCatFlags(); ApplyCollisionCatFlags(); } - + */ private void changeSetTorque(Vector3 newtorque) { if (!m_isSelected && !m_outbounds) @@ -3336,7 +3327,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // actually angular impulse private void changeAddAngularImpulse(Vector3 aimpulse) { - m_angularForceacc += aimpulse * m_invTimeStep; + m_angularForceacc += aimpulse * m_sceneInverseTimeStep; if (!m_isSelected && !m_outbounds) { lock (this) @@ -3386,9 +3377,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changeangvelocity(Vector3 newAngVel) { float len = newAngVel.LengthSquared(); - if (len > _parent_scene.maxAngVelocitySQ) + if (len > m_parentScene.maxAngVelocitySQ) { - len = _parent_scene.maximumAngularVelocity / (float)Math.Sqrt(len); + len = m_parentScene.maximumAngularVelocity / (float)Math.Sqrt(len); newAngVel *= len; } @@ -3635,7 +3626,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(m_bodydisablecontrol < 0) m_bodydisablecontrol++; - SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator + SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(m_prim_geom); // root position that is seem by rest of simulator if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) { @@ -3687,9 +3678,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde } SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body); - fx = (_target_velocity.X - vel.X) * m_invTimeStep; - fy = (_target_velocity.Y - vel.Y) * m_invTimeStep; - fz = (_target_velocity.Z - vel.Z) * m_invTimeStep; + fx = (_target_velocity.X - vel.X) * m_sceneInverseTimeStep; + fy = (_target_velocity.Y - vel.Y) * m_sceneInverseTimeStep; + fz = (_target_velocity.Z - vel.Z) * m_sceneInverseTimeStep; // d.BodySetLinearVel(Body, _target_velocity.X, _target_velocity.Y, _target_velocity.Z); } } // end if (m_usePID) @@ -3701,26 +3692,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde // Non-Vehicles have a limited set of Hover options. // determine what our target height really is based on HoverType - m_groundHeight = _parent_scene.GetTerrainHeightAtXY(lpos.X, lpos.Y); + float groundHeight = m_parentScene.GetTerrainHeightAtXY(lpos.X, lpos.Y); switch (m_PIDHoverType) { case PIDHoverType.Ground: - m_targetHoverHeight = m_groundHeight + m_PIDHoverHeight; + m_targetHoverHeight = groundHeight + m_PIDHoverHeight; break; case PIDHoverType.GroundAndWater: - m_waterHeight = _parent_scene.GetWaterLevel(); - if (m_groundHeight > m_waterHeight) - m_targetHoverHeight = m_groundHeight + m_PIDHoverHeight; + float waterHeight = m_parentScene.GetWaterLevel(); + if (groundHeight > waterHeight) + m_targetHoverHeight = groundHeight + m_PIDHoverHeight; else - m_targetHoverHeight = m_waterHeight + m_PIDHoverHeight; + m_targetHoverHeight = waterHeight + m_PIDHoverHeight; break; } // end switch (m_PIDHoverType) // don't go underground unless volumedetector - if (m_targetHoverHeight > m_groundHeight || m_isVolumeDetect) + if (m_targetHoverHeight > groundHeight || m_isVolumeDetect) { SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body); @@ -3743,16 +3734,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde else if (tmp < 0.1) fz = 0.1f * Math.Sign(fz); - fz = ((fz - vel.Z) * m_invTimeStep); + fz = ((fz - vel.Z) * m_sceneInverseTimeStep); } } } else { float b = (1.0f - m_buoyancy) * m_gravmod; - fx = _parent_scene.gravityx * b; - fy = _parent_scene.gravityy * b; - fz = _parent_scene.gravityz * b; + fx = m_parentScene.gravityx * b; + fy = m_parentScene.gravityy * b; + fz = m_parentScene.gravityz * b; } fx *= mass; @@ -3808,7 +3799,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { bool lastZeroFlag = _zeroFlag; - SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(prim_geom); + SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(m_prim_geom); // check outside region if (lpos.Z < -100 || lpos.Z > 100000f) @@ -3830,8 +3821,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0); // stop it SafeNativeMethods.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere - m_lastposition = _position; - m_lastorientation = _orientation; + m_lastposition = m_position; + m_lastorientation = m_orientation; base.RequestPhysicsterseUpdate(); @@ -3839,35 +3830,35 @@ namespace OpenSim.Region.PhysicsModule.ubOde _zeroFlag = true; disableBodySoft(); // disable it and colisions - base.RaiseOutOfBounds(_position); + base.RaiseOutOfBounds(m_position); return; } if (lpos.X < 0f) { - _position.X = Utils.Clamp(lpos.X, -2f, -0.1f); + m_position.X = Utils.Clamp(lpos.X, -2f, -0.1f); m_outbounds = true; } - else if (lpos.X > _parent_scene.WorldExtents.X) + else if (lpos.X > m_parentScene.WorldExtents.X) { - _position.X = Utils.Clamp(lpos.X, _parent_scene.WorldExtents.X + 0.1f, _parent_scene.WorldExtents.X + 2f); + m_position.X = Utils.Clamp(lpos.X, m_parentScene.WorldExtents.X + 0.1f, m_parentScene.WorldExtents.X + 2f); m_outbounds = true; } if (lpos.Y < 0f) { - _position.Y = Utils.Clamp(lpos.Y, -2f, -0.1f); + m_position.Y = Utils.Clamp(lpos.Y, -2f, -0.1f); m_outbounds = true; } - else if (lpos.Y > _parent_scene.WorldExtents.Y) + else if (lpos.Y > m_parentScene.WorldExtents.Y) { - _position.Y = Utils.Clamp(lpos.Y, _parent_scene.WorldExtents.Y + 0.1f, _parent_scene.WorldExtents.Y + 2f); + m_position.Y = Utils.Clamp(lpos.Y, m_parentScene.WorldExtents.Y + 0.1f, m_parentScene.WorldExtents.Y + 2f); m_outbounds = true; } if (m_outbounds) { - m_lastposition = _position; - m_lastorientation = _orientation; + m_lastposition = m_position; + m_lastorientation = m_orientation; SafeNativeMethods.Vector3 dtmp = SafeNativeMethods.BodyGetAngularVel(Body); m_rotationalVelocity.X = dtmp.X; @@ -3881,7 +3872,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0); - SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.GeomSetPosition(m_prim_geom, m_position.X, m_position.Y, m_position.Z); disableBodySoft(); // stop collisions UnSubscribeEvents(); @@ -3890,7 +3881,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } SafeNativeMethods.Quaternion ori; - SafeNativeMethods.GeomCopyQuaternion(prim_geom, out ori); + SafeNativeMethods.GeomCopyQuaternion(m_prim_geom, out ori); // decide if moving // use positions since this are integrated quantities @@ -3916,12 +3907,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde } if ( - (Math.Abs(_position.X - lpos.X) < poserror) - && (Math.Abs(_position.Y - lpos.Y) < poserror) - && (Math.Abs(_position.Z - lpos.Z) < poserror) - && (Math.Abs(_orientation.X - ori.X) < angerror) - && (Math.Abs(_orientation.Y - ori.Y) < angerror) - && (Math.Abs(_orientation.Z - ori.Z) < angerror) // ignore W + (Math.Abs(m_position.X - lpos.X) < poserror) + && (Math.Abs(m_position.Y - lpos.Y) < poserror) + && (Math.Abs(m_position.Z - lpos.Z) < poserror) + && (Math.Abs(m_orientation.X - ori.X) < angerror) + && (Math.Abs(m_orientation.Y - ori.Y) < angerror) + && (Math.Abs(m_orientation.Z - ori.Z) < angerror) // ignore W ) _zeroFlag = true; else @@ -3931,14 +3922,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde // update position if (!(_zeroFlag && lastZeroFlag)) { - _position.X = lpos.X; - _position.Y = lpos.Y; - _position.Z = lpos.Z; + m_position.X = lpos.X; + m_position.Y = lpos.Y; + m_position.Z = lpos.Z; - _orientation.X = ori.X; - _orientation.Y = ori.Y; - _orientation.Z = ori.Z; - _orientation.W = ori.W; + m_orientation.X = ori.X; + m_orientation.Y = ori.Y; + m_orientation.Z = ori.Z; + m_orientation.W = ori.W; } // update velocities and acceleration @@ -3960,7 +3951,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde (Math.Abs(vel.Z) < 0.005f)) { _velocity = Vector3.Zero; - float t = -m_invTimeStep; + float t = -m_sceneInverseTimeStep; m_acceleration = m_acceleration * t; } else @@ -3968,7 +3959,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde _velocity.X = vel.X; _velocity.Y = vel.Y; _velocity.Z = vel.Z; - m_acceleration = (_velocity - m_acceleration) * m_invTimeStep; + m_acceleration = (_velocity - m_acceleration) * m_sceneInverseTimeStep; } if ((Math.Abs(m_acceleration.X) < 0.01f) && @@ -4053,7 +4044,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public bool DoAChange(changes what, object arg) { - if (prim_geom == IntPtr.Zero && what != changes.Add && what != changes.AddPhysRep && what != changes.Remove) + if (m_prim_geom == IntPtr.Zero && what != changes.Add && what != changes.AddPhysRep && what != changes.Remove) { return false; } @@ -4158,9 +4149,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde changePhysRepData((ODEPhysRepData) arg); break; - case changes.CollidesWater: - changeFloatOnWater((bool)arg); - break; + //case changes.CollidesWater: + // changeFloatOnWater((bool)arg); + // break; case changes.VolumeDtc: changeVolumedetetion((bool)arg); @@ -4259,7 +4250,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public void AddChange(changes what, object arg) { - _parent_scene.AddChange((PhysicsActor) this, what, arg); + m_parentScene.AddChange((PhysicsActor) this, what, arg); } private struct strVehicleBoolParam diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs index 2e3a197621..18b4333ffe 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// /// Scene that created this object. /// - private ODEScene m_scene; + private readonly ODEScene m_scene; IntPtr ray; // the ray. we only need one for our lifetime IntPtr Sphere; @@ -65,9 +65,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// /// ODE near callback delegate /// - private SafeNativeMethods.NearCallback nearCallback; + private readonly SafeNativeMethods.NearCallback nearCallback; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private List m_contactResults = new List(); + private readonly List m_contactResults = new List(); private RayFilterFlags CurrentRayFilter; private int CurrentMaxCount; @@ -127,9 +127,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_scene.haveActor(req.actor)) { if (req.actor is OdePrim) - geom = ((OdePrim)req.actor).prim_geom; + geom = ((OdePrim)req.actor).m_prim_geom; else if (req.actor is OdeCharacter) - geom = ((OdePrim)req.actor).prim_geom; + geom = ((OdePrim)req.actor).m_prim_geom; } if (geom == IntPtr.Zero) { @@ -649,7 +649,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// internal void Dispose() { - m_scene = null; if (ray != IntPtr.Zero) { SafeNativeMethods.GeomDestroy(ray); diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 4c96dbaa3f..2bc0d39641 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -227,21 +227,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde private SafeNativeMethods.NearCallback nearCallback; - private Dictionary _prims = new Dictionary(); - private HashSet _characters = new HashSet(); - private HashSet _activeprims = new HashSet(); - private HashSet _activegroups = new HashSet(); + private readonly Dictionary _prims = new Dictionary(); + private readonly HashSet _characters = new HashSet(); + private readonly HashSet _activeprims = new HashSet(); + private readonly HashSet _activegroups = new HashSet(); - public ConcurrentQueue ChangesQueue = new ConcurrentQueue(); + public readonly ConcurrentQueue ChangesQueue = new ConcurrentQueue(); /// /// A list of actors that should receive collision events. /// - private List _collisionEventPrim = new List(); - private List _collisionEventPrimRemove = new List(); + private readonly List _collisionEventPrim = new List(); + private readonly List _collisionEventPrimRemove = new List(); - private HashSet _badCharacter = new HashSet(); - public Dictionary actor_name_map = new Dictionary(); + private readonly HashSet _badCharacter = new HashSet(); + public readonly Dictionary actor_name_map = new Dictionary(); private float contactsurfacelayer = 0.002f; @@ -255,7 +255,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private IntPtr contactgroup; - public ContactData[] m_materialContactsData = new ContactData[8]; + public readonly ContactData[] m_materialContactsData = new ContactData[8]; private IntPtr m_terrainGeom; private float[] m_terrainHeights; @@ -283,8 +283,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde public IntPtr StaticSpace; // space for the static things around public IntPtr GroundSpace; // space for ground - public object OdeLock = new object(); - public static object SimulationLock = new object(); + public readonly object OdeLock = new object(); + public static readonly object SimulationLock = new object(); public IMesher mesher; @@ -1054,10 +1054,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde foreach (OdePrim aprim in _activegroups) { if(!aprim.m_outbounds && SafeNativeMethods.BodyIsEnabled(aprim.Body) && - aprim.collide_geom != IntPtr.Zero) + aprim.m_collide_geom != IntPtr.Zero) { - SafeNativeMethods.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); - SafeNativeMethods.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(StaticSpace, aprim.m_collide_geom, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(GroundSpace, aprim.m_collide_geom, IntPtr.Zero, nearCallback); } } } @@ -2289,9 +2289,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde IntPtr geom; if (actor is OdePrim) - geom = ((OdePrim)actor).prim_geom; + geom = ((OdePrim)actor).m_prim_geom; else if (actor is OdeCharacter) - geom = ((OdePrim)actor).prim_geom; + geom = ((OdePrim)actor).m_prim_geom; else return new List(); @@ -2405,9 +2405,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (actor != null) { if (actor is OdePrim) - geom = ((OdePrim)actor).prim_geom; + geom = ((OdePrim)actor).m_prim_geom; else if (actor is OdeCharacter) - geom = ((OdePrim)actor).prim_geom; + geom = ((OdePrim)actor).m_prim_geom; } List ourResults = null; diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs b/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs index f882e6ccf2..374b74ddd3 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs @@ -36,8 +36,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public class ODESitAvatar { - private ODEScene m_scene; - private ODERayCastRequestManager m_raymanager; + private readonly ODEScene m_scene; + private readonly ODERayCastRequestManager m_raymanager; public ODESitAvatar(ODEScene pScene, ODERayCastRequestManager raymanager) { @@ -45,7 +45,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_raymanager = raymanager; } - private static Vector3 SitAjust = new Vector3(0, 0, 0.4f); + private static readonly Vector3 SitAjust = new Vector3(0, 0, 0.4f); private const RayFilterFlags RaySitFlags = RayFilterFlags.AllPrims | RayFilterFlags.ClosestHit; private void RotAroundZ(float x, float y, ref Quaternion ori) @@ -64,22 +64,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde public void Sit(PhysicsActor actor, Vector3 avPos, Vector3 avCameraPosition, Vector3 offset, Vector3 avOffset, SitAvatarCallback PhysicsSitResponse) { - if (!m_scene.haveActor(actor) || !(actor is OdePrim) || ((OdePrim)actor).prim_geom == IntPtr.Zero) + if (!m_scene.haveActor(actor) || !(actor is OdePrim) || ((OdePrim)actor).m_prim_geom == IntPtr.Zero) { PhysicsSitResponse(-1, actor.LocalID, offset, Quaternion.Identity); return; } - IntPtr geom = ((OdePrim)actor).prim_geom; + IntPtr geom = ((OdePrim)actor).m_prim_geom; Vector3 geopos = SafeNativeMethods.GeomGetPositionOMV(geom); Quaternion geomOri = SafeNativeMethods.GeomGetQuaternionOMV(geom); -// Vector3 geopos = actor.Position; -// Quaternion geomOri = actor.Orientation; + //Vector3 geopos = actor.Position; + //Quaternion geomOri = actor.Orientation; Quaternion geomInvOri = Quaternion.Conjugate(geomOri); - Quaternion ori = Quaternion.Identity; Vector3 rayDir = geopos + offset - avCameraPosition; @@ -90,25 +89,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde PhysicsSitResponse(-1, actor.LocalID, offset, Quaternion.Identity); return; } + float t = 1 / raylen; rayDir.X *= t; rayDir.Y *= t; rayDir.Z *= t; raylen += 30f; // focal point may be far - List rayResults; - rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir, raylen, 1, RaySitFlags); + List rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir, raylen, 1, RaySitFlags); if (rayResults.Count == 0) { -/* if this fundamental ray failed, then just fail so user can try another spot and not be sitted far on a big prim + /* if this fundamental ray failed, then just fail so user can try another spot and not be sitted far on a big prim d.AABB aabb; d.GeomGetAABB(geom, out aabb); offset = new Vector3(avOffset.X, 0, aabb.MaxZ + avOffset.Z - geopos.Z); ori = geomInvOri; offset *= geomInvOri; PhysicsSitResponse(1, actor.LocalID, offset, ori); -*/ + */ PhysicsSitResponse(0, actor.LocalID, offset, ori); return; } diff --git a/bin/OpenMetaverse.Rendering.Meshmerizer.dll b/bin/OpenMetaverse.Rendering.Meshmerizer.dll index 14489b978b..0790735120 100755 Binary files a/bin/OpenMetaverse.Rendering.Meshmerizer.dll and b/bin/OpenMetaverse.Rendering.Meshmerizer.dll differ diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index f5ef985cfd..84a8a29aba 100755 Binary files a/bin/OpenMetaverse.StructuredData.dll and b/bin/OpenMetaverse.StructuredData.dll differ diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index 7043733e0b..6ec79b460f 100755 Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index 9a93b9eb0f..cbea8c538c 100755 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ