From 256624566f4708fc6e3280c240393d0abdb7beb6 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Wed, 26 Aug 2009 12:58:37 +0900 Subject: Formatting cleanup, minor refactoring. --- .../Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | 1 + OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 4 ---- OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | 6 +++--- OpenSim/Region/Physics/POSPlugin/POSScene.cs | 14 +++++--------- 4 files changed, 9 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index a74eb0c..8d8b3fe 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs @@ -43,6 +43,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; private bool flying; private bool iscolliding; + public BasicActor() { _velocity = new PhysicsVector(); diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 759692f..d192018 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -1025,7 +1025,6 @@ namespace OpenSim.Region.Physics.OdePlugin } } - if (flying) { vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); @@ -1044,7 +1043,6 @@ namespace OpenSim.Region.Physics.OdePlugin vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f; } // end add Kitto Flora - } if (PhysicsVector.isFinite(vec)) { @@ -1080,8 +1078,6 @@ namespace OpenSim.Region.Physics.OdePlugin _parent_scene.geom_name_map.Remove(Shell); Shell = IntPtr.Zero; } - - return; } } diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index 1973adf..35fc616 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.Physics.POSPlugin private PhysicsVector _acceleration; private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; private bool flying; - private bool iscolliding; + private bool isColliding; public POSCharacter() { @@ -116,8 +116,8 @@ namespace OpenSim.Region.Physics.POSPlugin public override bool IsColliding { - get { return iscolliding; } - set { iscolliding = value; } + get { return isColliding; } + set { isColliding = value; } } public override bool CollidingGround diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs index 5361be0..fa8cc70 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs @@ -113,20 +113,16 @@ namespace OpenSim.Region.Physics.POSPlugin c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation); Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation); - if (Math.Abs(rotatedPos.X) >= (p.Size.X*0.5 + Math.Abs(avatarSize.X)) || - Math.Abs(rotatedPos.Y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) || - Math.Abs(rotatedPos.Z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.Z))) - { - return false; - } - return true; + return (Math.Abs(rotatedPos.X) < (p.Size.X*0.5 + Math.Abs(avatarSize.X)) && + Math.Abs(rotatedPos.Y) < (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) && + Math.Abs(rotatedPos.Z) < (p.Size.Z*0.5 + Math.Abs(avatarSize.Z))); } private bool isCollidingWithPrim(POSCharacter c) { - for (int i = 0; i < _prims.Count; ++i) + foreach (POSPrim p in _prims) { - if (isColliding(c, _prims[i])) + if (isColliding(c, p)) { return true; } -- cgit v1.1 From cf2d1b5c1007958193bb1d84492e0d2714403ebb Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Wed, 26 Aug 2009 13:59:53 +0900 Subject: Add copy constructor to PhysicsVector. --- OpenSim/Region/Physics/Manager/PhysicsVector.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index c275021..d6f4d0d 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs @@ -46,12 +46,17 @@ namespace OpenSim.Region.Physics.Manager Z = z; } + public PhysicsVector(PhysicsVector pv) : this(pv.X, pv.Y, pv.Z) + { + } + public void setValues(float x, float y, float z) { X = x; Y = y; Z = z; } + public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); public override string ToString() -- cgit v1.1