reduce access to ODECharacter methods to make code analysis easier. Eliminate redundant argument on ProcessTaints()

0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-10-15 01:41:39 +01:00
parent 4d1ab38068
commit 41e7e613a2
2 changed files with 35 additions and 53 deletions

View File

@ -78,17 +78,17 @@ namespace OpenSim.Region.Physics.OdePlugin
private Vector3 _acceleration; private Vector3 _acceleration;
private Vector3 m_rotationalVelocity; private Vector3 m_rotationalVelocity;
private float m_mass = 80f; private float m_mass = 80f;
public float m_density = 60f; private float m_density = 60f;
private bool m_pidControllerActive = true; private bool m_pidControllerActive = true;
public float PID_D = 800.0f; private float PID_D = 800.0f;
public float PID_P = 900.0f; private float PID_P = 900.0f;
//private static float POSTURE_SERVO = 10000.0f; //private static float POSTURE_SERVO = 10000.0f;
public float CAPSULE_RADIUS = 0.37f; private float CAPSULE_RADIUS = 0.37f;
public float CAPSULE_LENGTH = 2.140599f; private float CAPSULE_LENGTH = 2.140599f;
public float m_tensor = 3800000f; private float m_tensor = 3800000f;
public float heightFudgeFactor = 0.52f; private float heightFudgeFactor = 0.52f;
public float walkDivisor = 1.3f; private float walkDivisor = 1.3f;
public float runDivisor = 0.8f; private float runDivisor = 0.8f;
private bool flying = false; private bool flying = false;
private bool m_iscolliding = false; private bool m_iscolliding = false;
private bool m_iscollidingGround = false; private bool m_iscollidingGround = false;
@ -100,12 +100,11 @@ namespace OpenSim.Region.Physics.OdePlugin
private bool m_hackSentFly = false; private bool m_hackSentFly = false;
private int m_requestedUpdateFrequency = 0; private int m_requestedUpdateFrequency = 0;
private Vector3 m_taintPosition = Vector3.Zero; private Vector3 m_taintPosition = Vector3.Zero;
public uint m_localID = 0; internal uint m_localID = 0;
public bool m_returnCollisions = false;
// taints and their non-tainted counterparts // taints and their non-tainted counterparts
public bool m_isPhysical = false; // the current physical status private bool m_isPhysical = false; // the current physical status
public bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing) private bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing)
public float MinimumGroundFlightOffset = 3f; internal float MinimumGroundFlightOffset = 3f;
private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes.
@ -132,19 +131,18 @@ namespace OpenSim.Region.Physics.OdePlugin
| CollisionCategories.Body | CollisionCategories.Body
| CollisionCategories.Character | CollisionCategories.Character
| CollisionCategories.Land); | CollisionCategories.Land);
public IntPtr Body = IntPtr.Zero; internal IntPtr Body = IntPtr.Zero;
private OdeScene _parent_scene; private OdeScene _parent_scene;
public IntPtr Shell = IntPtr.Zero; internal IntPtr Shell = IntPtr.Zero;
public IntPtr Amotor = IntPtr.Zero; internal IntPtr Amotor = IntPtr.Zero;
public d.Mass ShellMass; private d.Mass ShellMass;
public bool collidelock = false;
public int m_eventsubscription = 0; private int m_eventsubscription = 0;
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
// unique UUID of this character object // unique UUID of this character object
public UUID m_uuid; internal UUID m_uuid { get; private set; }
public bool bad = false; internal bool bad = false;
public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
{ {
@ -680,20 +678,12 @@ namespace OpenSim.Region.Physics.OdePlugin
return m_density*AVvolume; return m_density*AVvolume;
} }
} }
public override void link(PhysicsActor obj)
{
} public override void link(PhysicsActor obj) {}
public override void delink() public override void delink() {}
{
} public override void LockAngularMotion(Vector3 axis) {}
public override void LockAngularMotion(Vector3 axis)
{
}
// This code is very useful. Written by DanX0r. We're just not using it right now. // This code is very useful. Written by DanX0r. We're just not using it right now.
// Commented out to prevent a warning. // Commented out to prevent a warning.
@ -732,27 +722,22 @@ namespace OpenSim.Region.Physics.OdePlugin
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)
{ {
} }
public override void SetVolumeDetect(int param) public override void SetVolumeDetect(int param)
{ {
} }
public override Vector3 CenterOfMass public override Vector3 CenterOfMass
@ -772,13 +757,15 @@ namespace OpenSim.Region.Physics.OdePlugin
public override Vector3 Velocity public override Vector3 Velocity
{ {
get { get
{
// There's a problem with Vector3.Zero! Don't Use it Here! // There's a problem with Vector3.Zero! Don't Use it Here!
if (_zeroFlag) if (_zeroFlag)
return Vector3.Zero; return Vector3.Zero;
m_lastUpdateSent = false; m_lastUpdateSent = false;
return _velocity; return _velocity;
} }
set set
{ {
if (value.IsFinite()) if (value.IsFinite())
@ -872,7 +859,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public override void AddAngularForce(Vector3 force, bool pushforce) public override void AddAngularForce(Vector3 force, bool pushforce)
{ {
} }
/// <summary> /// <summary>
@ -880,14 +866,11 @@ namespace OpenSim.Region.Physics.OdePlugin
/// </summary> /// </summary>
/// <param name="force"></param> /// <param name="force"></param>
public void doForce(Vector3 force) public void doForce(Vector3 force)
{
if (!collidelock)
{ {
d.BodyAddForce(Body, force.X, force.Y, force.Z); d.BodyAddForce(Body, force.X, force.Y, force.Z);
//d.BodySetRotation(Body, ref m_StandUpRotation); //d.BodySetRotation(Body, ref m_StandUpRotation);
//standupStraight(); //standupStraight();
} }
}
public override void SetMomentum(Vector3 momentum) public override void SetMomentum(Vector3 momentum)
{ {
@ -1073,7 +1056,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <summary> /// <summary>
/// Updates the reported position and velocity. This essentially sends the data up to ScenePresence. /// Updates the reported position and velocity. This essentially sends the data up to ScenePresence.
/// </summary> /// </summary>
public void UpdatePositionAndVelocity() internal void UpdatePositionAndVelocity()
{ {
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
d.Vector3 vec; d.Vector3 vec;
@ -1161,7 +1144,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <summary> /// <summary>
/// Cleanup the things we use in the scene. /// Cleanup the things we use in the scene.
/// </summary> /// </summary>
public void Destroy() internal void Destroy()
{ {
m_tainted_isPhysical = false; m_tainted_isPhysical = false;
_parent_scene.AddPhysicsActorTaint(this); _parent_scene.AddPhysicsActorTaint(this);
@ -1220,7 +1203,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public override float APIDDamping{ set { return; } } public override float APIDDamping{ set { return; } }
public override void SubscribeEvents(int ms) public override void SubscribeEvents(int ms)
{ {
m_requestedUpdateFrequency = ms; m_requestedUpdateFrequency = ms;
@ -1235,7 +1217,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_eventsubscription = 0; m_eventsubscription = 0;
} }
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) internal void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
{ {
if (m_eventsubscription > 0) if (m_eventsubscription > 0)
{ {
@ -1246,7 +1228,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
public void SendCollisions() internal void SendCollisions()
{ {
if (m_eventsubscription > m_requestedUpdateFrequency) if (m_eventsubscription > m_requestedUpdateFrequency)
{ {
@ -1266,7 +1248,7 @@ namespace OpenSim.Region.Physics.OdePlugin
return false; return false;
} }
public void ProcessTaints(float timestep) internal void ProcessTaints()
{ {
if (m_tainted_isPhysical != m_isPhysical) if (m_tainted_isPhysical != m_isPhysical)
{ {

View File

@ -2703,7 +2703,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
{ {
foreach (OdeCharacter character in _taintedActors) foreach (OdeCharacter character in _taintedActors)
{ {
character.ProcessTaints(timeStep); character.ProcessTaints();
processedtaints = true; processedtaints = true;
//character.m_collisionscore = 0; //character.m_collisionscore = 0;