aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-12 21:45:49 +0000
committerTeravus Ovares2007-11-12 21:45:49 +0000
commit5952441fcc886902f7b2f72eb839ae49d2c85012 (patch)
treeff7ea06cbdaa36e14b1d14da79d5535cb0dcba14 /OpenSim
parentfix compile issue on mono (diff)
downloadopensim-SC-5952441fcc886902f7b2f72eb839ae49d2c85012.zip
opensim-SC-5952441fcc886902f7b2f72eb839ae49d2c85012.tar.gz
opensim-SC-5952441fcc886902f7b2f72eb839ae49d2c85012.tar.bz2
opensim-SC-5952441fcc886902f7b2f72eb839ae49d2c85012.tar.xz
* Added a lot of Glue to help with reporting proper collisions.
* ODE - Fixed the iscolliding property to report a static true when colliding. * Added reporting of collisions to call UpdateMovementAnimations * Added Jump - air animation (with arms outstretched). * Added Fall Animations * ODE - Added a small amount of X, Y motion control while jumping or Falling * ODE - Avatar movement animations are still a bit odd sometimes, and had to get this up there.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs46
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs16
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs29
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs87
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs110
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs34
6 files changed, 294 insertions, 28 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index ab19973..5d643d1 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.Environment.Scenes
52 private uint m_requestedSitTargetID = 0; 52 private uint m_requestedSitTargetID = 0;
53 private LLVector3 m_requestedSitOffset = new LLVector3(); 53 private LLVector3 m_requestedSitOffset = new LLVector3();
54 private float m_sitAvatarHeight = 2.0f; 54 private float m_sitAvatarHeight = 2.0f;
55 private bool m_oldColliding = true;
55 56
56 private bool m_isTyping = false; 57 private bool m_isTyping = false;
57 58
@@ -388,6 +389,7 @@ namespace OpenSim.Region.Environment.Scenes
388 { 389 {
389 m_scene.PhysScene.RemoveAvatar(PhysicsActor); 390 m_scene.PhysScene.RemoveAvatar(PhysicsActor);
390 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 391 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
392 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
391 PhysicsActor = null; 393 PhysicsActor = null;
392 } 394 }
393 } 395 }
@@ -407,6 +409,7 @@ namespace OpenSim.Region.Environment.Scenes
407 /// </summary> 409 /// </summary>
408 public void StopMovement() 410 public void StopMovement()
409 { 411 {
412 int x = 0;
410 } 413 }
411 414
412 public void AddNeighbourRegion(ulong regionHandle) 415 public void AddNeighbourRegion(ulong regionHandle)
@@ -489,7 +492,7 @@ namespace OpenSim.Region.Environment.Scenes
489 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!"); 492 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!");
490 return; 493 return;
491 } 494 }
492 495
493 int i = 0; 496 int i = 0;
494 bool update_movementflag = false; 497 bool update_movementflag = false;
495 bool update_rotation = false; 498 bool update_rotation = false;
@@ -497,6 +500,8 @@ namespace OpenSim.Region.Environment.Scenes
497 Vector3 agent_control_v3 = new Vector3(0, 0, 0); 500 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
498 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 501 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
499 bool oldflying = PhysicsActor.Flying; 502 bool oldflying = PhysicsActor.Flying;
503
504
500 PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 505 PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
501 if (PhysicsActor.Flying != oldflying) 506 if (PhysicsActor.Flying != oldflying)
502 { 507 {
@@ -652,7 +657,18 @@ namespace OpenSim.Region.Environment.Scenes
652 } 657 }
653 else 658 else
654 { 659 {
655 SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); 660 if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z > 6)
661 {
662 SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1);
663 }
664 else if (!PhysicsActor.IsColliding && Velocity.Z > 0)
665 {
666 SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1);
667 }
668 else
669 {
670 SendAnimPack(Animations.AnimsLLUUID["WALK"], 1);
671 }
656 } 672 }
657 } 673 }
658 } 674 }
@@ -669,7 +685,22 @@ namespace OpenSim.Region.Environment.Scenes
669 } 685 }
670 else 686 else
671 { 687 {
672 SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); 688 if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z > 6 && !m_physicsActor.Flying)
689 {
690 SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1);
691 }
692 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying)
693 {
694 SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1);
695 }
696 else
697 {
698 if (!m_physicsActor.Flying)
699 {
700 SendAnimPack(Animations.AnimsLLUUID["STAND"], 1);
701 }
702 }
703
673 } 704 }
674 } 705 }
675 } 706 }
@@ -702,6 +733,7 @@ namespace OpenSim.Region.Environment.Scenes
702 direc.z *= 3; 733 direc.z *= 3;
703 //System.Console.WriteLine("Jump"); 734 //System.Console.WriteLine("Jump");
704 SendAnimPack(Animations.AnimsLLUUID["PRE_JUMP"], 1); 735 SendAnimPack(Animations.AnimsLLUUID["PRE_JUMP"], 1);
736 SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1);
705 } 737 }
706 } 738 }
707 } 739 }
@@ -1115,8 +1147,16 @@ namespace OpenSim.Region.Environment.Scenes
1115 1147
1116 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec); 1148 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec);
1117 m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 1149 m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
1150 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
1118 } 1151 }
1152 private void PhysicsCollisionUpdate(EventArgs e)
1153 {
1154 bool isUserMoving = false;
1155 if (Velocity.X > 0 || Velocity.Y > 0)
1156 isUserMoving = true;
1157 UpdateMovementAnimations(isUserMoving);
1119 1158
1159 }
1120 internal void Close() 1160 internal void Close()
1121 { 1161 {
1122 RemoveFromPhysicalScene(); 1162 RemoveFromPhysicalScene();
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 1d1c14f..3283ec0 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -196,6 +196,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
196 _position = new PhysicsVector(); 196 _position = new PhysicsVector();
197 _acceleration = new PhysicsVector(); 197 _acceleration = new PhysicsVector();
198 } 198 }
199 public override int PhysicsActorType
200 {
201 get { return (int)ActorTypes.Agent; }
202 set { return; }
203 }
199 public override PhysicsVector RotationalVelocity 204 public override PhysicsVector RotationalVelocity
200 { 205 {
201 get { return m_rotationalVelocity; } 206 get { return m_rotationalVelocity; }
@@ -222,7 +227,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
222 get { return iscolliding; } 227 get { return iscolliding; }
223 set { iscolliding = value; } 228 set { iscolliding = value; }
224 } 229 }
225 230 public override bool CollidingGround
231 {
232 get { return false; }
233 set { return; }
234 }
235 public override bool CollidingObj
236 {
237 get { return false; }
238 set { return; }
239 }
226 public override PhysicsVector Position 240 public override PhysicsVector Position
227 { 241 {
228 get { return _position; } 242 get { return _position; }
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 2db7a54..b51f024 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -705,6 +705,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
705 protected AxiomQuaternion _orientation; 705 protected AxiomQuaternion _orientation;
706 protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 706 protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
707 protected RigidBody rigidBody; 707 protected RigidBody rigidBody;
708 protected int m_PhysicsActorType;
708 private Boolean iscolliding = false; 709 private Boolean iscolliding = false;
709 internal string _name; 710 internal string _name;
710 711
@@ -784,6 +785,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
784 { 785 {
785 get { return 0; } 786 get { return 0; }
786 } 787 }
788 public override int PhysicsActorType
789 {
790 get { return (int) m_PhysicsActorType; }
791 set { m_PhysicsActorType = value; }
792 }
793
787 public RigidBody RigidBody 794 public RigidBody RigidBody
788 { 795 {
789 get { return rigidBody; } 796 get { return rigidBody; }
@@ -814,6 +821,16 @@ namespace OpenSim.Region.Physics.BulletXPlugin
814 get { return iscolliding; } 821 get { return iscolliding; }
815 set { iscolliding = value; } 822 set { iscolliding = value; }
816 } 823 }
824 public override bool CollidingGround
825 {
826 get { return false; }
827 set { return; }
828 }
829 public override bool CollidingObj
830 {
831 get { return false; }
832 set { return; }
833 }
817 public virtual void SetAcceleration(PhysicsVector accel) 834 public virtual void SetAcceleration(PhysicsVector accel)
818 { 835 {
819 lock (BulletXScene.BulletXLock) 836 lock (BulletXScene.BulletXLock)
@@ -956,7 +973,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
956 parent_scene.ddWorld.AddRigidBody(rigidBody); 973 parent_scene.ddWorld.AddRigidBody(rigidBody);
957 } 974 }
958 } 975 }
959 976 public override int PhysicsActorType
977 {
978 get { return (int)ActorTypes.Agent; }
979 set { return; }
980 }
960 public override PhysicsVector Position 981 public override PhysicsVector Position
961 { 982 {
962 get { return base.Position; } 983 get { return base.Position; }
@@ -1103,7 +1124,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1103 1124
1104 CreateRigidBody(parent_scene, mesh, pos, size); 1125 CreateRigidBody(parent_scene, mesh, pos, size);
1105 } 1126 }
1106 1127 public override int PhysicsActorType
1128 {
1129 get { return (int)ActorTypes.Prim; }
1130 set { return; }
1131 }
1107 public override PhysicsVector Position 1132 public override PhysicsVector Position
1108 { 1133 {
1109 get { return base.Position; } 1134 get { return base.Position; }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 9ce7cf3..49760da 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -27,6 +27,8 @@
27*/ 27*/
28using Axiom.Math; 28using Axiom.Math;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using System;
31using System.Collections.Generic;
30 32
31namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
32{ 34{
@@ -35,20 +37,75 @@ namespace OpenSim.Region.Physics.Manager
35 public delegate void VelocityUpdate(PhysicsVector velocity); 37 public delegate void VelocityUpdate(PhysicsVector velocity);
36 38
37 public delegate void OrientationUpdate(Quaternion orientation); 39 public delegate void OrientationUpdate(Quaternion orientation);
40 public enum ActorTypes : int
41 {
42 Unknown = 0,
43 Agent = 1,
44 Prim = 2,
45 Ground = 3
46 }
47 public class CollisionEventUpdate : EventArgs
48 {
49 // Raising the event on the object, so don't need to provide location.. further up the tree knows that info.
38 50
39 51
52 public int m_colliderType;
53 public bool m_startOrEnd;
54 //public uint m_LocalID;
55 public List<uint> m_objCollisionList;
56 public CollisionEventUpdate(uint localID, int colliderType, bool startOrEnd, List<uint> objCollisionList)
57 {
58 m_colliderType = colliderType;
59 m_startOrEnd = startOrEnd;
60 m_objCollisionList = objCollisionList;
61
62 }
63 public CollisionEventUpdate(bool startOrEnd){
64 m_colliderType = (int)ActorTypes.Unknown;
65 m_startOrEnd = startOrEnd;
66 m_objCollisionList = null;
67 }
68 public CollisionEventUpdate() {
69 m_colliderType = (int)ActorTypes.Unknown;
70 m_startOrEnd = false;
71 m_objCollisionList = null;
72 }
73 public int collidertype{
74 get {
75 return m_colliderType;
76 }
77 set {
78 m_colliderType = value;
79 }
80 }
81 public bool startOrEnd {
82 get {
83 return m_startOrEnd;
84 }
85 set {
86 m_startOrEnd = value;
87 }
88 }
89 public void addCollider(uint localID) {
90 m_objCollisionList.Add(localID);
91 }
92 }
93
94
40 95
41 96
42 97
43 public abstract class PhysicsActor 98 public abstract class PhysicsActor
44 { 99 {
45 public delegate void RequestTerseUpdate(); 100 public delegate void RequestTerseUpdate();
101 public delegate void CollisionUpdate(EventArgs e);
46 102
47#pragma warning disable 67 103#pragma warning disable 67
48 public event PositionUpdate OnPositionUpdate; 104 public event PositionUpdate OnPositionUpdate;
49 public event VelocityUpdate OnVelocityUpdate; 105 public event VelocityUpdate OnVelocityUpdate;
50 public event OrientationUpdate OnOrientationUpdate; 106 public event OrientationUpdate OnOrientationUpdate;
51 public event RequestTerseUpdate OnRequestTerseUpdate; 107 public event RequestTerseUpdate OnRequestTerseUpdate;
108 public event CollisionUpdate OnCollisionUpdate;
52#pragma warning restore 67 109#pragma warning restore 67
53 110
54 public static PhysicsActor Null 111 public static PhysicsActor Null
@@ -74,6 +131,14 @@ namespace OpenSim.Region.Physics.Manager
74 } 131 }
75 132
76 } 133 }
134 public virtual void SendCollisionUpdate(EventArgs e)
135 {
136 CollisionUpdate handler = OnCollisionUpdate;
137 if (handler != null)
138 {
139 OnCollisionUpdate(e);
140 }
141 }
77 142
78 143
79 public abstract PhysicsVector Position { get; set; } 144 public abstract PhysicsVector Position { get; set; }
@@ -83,6 +148,7 @@ namespace OpenSim.Region.Physics.Manager
83 public abstract PhysicsVector Acceleration { get; } 148 public abstract PhysicsVector Acceleration { get; }
84 149
85 public abstract Quaternion Orientation { get; set; } 150 public abstract Quaternion Orientation { get; set; }
151 public abstract int PhysicsActorType { get; set; }
86 152
87 public abstract bool IsPhysical {get; set;} 153 public abstract bool IsPhysical {get; set;}
88 154
@@ -91,6 +157,9 @@ namespace OpenSim.Region.Physics.Manager
91 public abstract bool ThrottleUpdates { get; set; } 157 public abstract bool ThrottleUpdates { get; set; }
92 158
93 public abstract bool IsColliding { get; set; } 159 public abstract bool IsColliding { get; set; }
160 public abstract bool CollidingGround { get; set; }
161 public abstract bool CollidingObj { get; set; }
162
94 public abstract PhysicsVector RotationalVelocity { get; set; } 163 public abstract PhysicsVector RotationalVelocity { get; set; }
95 164
96 public abstract bool Kinematic { get; set; } 165 public abstract bool Kinematic { get; set; }
@@ -107,7 +176,16 @@ namespace OpenSim.Region.Physics.Manager
107 get { return PhysicsVector.Zero; } 176 get { return PhysicsVector.Zero; }
108 set { return; } 177 set { return; }
109 } 178 }
110 179 public override bool CollidingGround
180 {
181 get {return false;}
182 set {return;}
183 }
184 public override bool CollidingObj
185 {
186 get { return false; }
187 set { return; }
188 }
111 public override PhysicsVector Size 189 public override PhysicsVector Size
112 { 190 {
113 get { return PhysicsVector.Zero; } 191 get { return PhysicsVector.Zero; }
@@ -161,6 +239,11 @@ namespace OpenSim.Region.Physics.Manager
161 get { return false; } 239 get { return false; }
162 set { return; } 240 set { return; }
163 } 241 }
242 public override int PhysicsActorType
243 {
244 get { return (int)ActorTypes.Unknown; }
245 set { return; }
246 }
164 247
165 public override bool Kinematic 248 public override bool Kinematic
166 { 249 {
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 98c5995..c93b96f 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -89,6 +89,7 @@ namespace OpenSim.Region.Physics.OdePlugin
89 private d.ContactGeom[] contacts = new d.ContactGeom[30]; 89 private d.ContactGeom[] contacts = new d.ContactGeom[30];
90 private d.Contact contact; 90 private d.Contact contact;
91 private d.Contact TerrainContact; 91 private d.Contact TerrainContact;
92
92 private int m_physicsiterations = 10; 93 private int m_physicsiterations = 10;
93 private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag 94 private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
94 private PhysicsActor PANull = new NullPhysicsActor(); 95 private PhysicsActor PANull = new NullPhysicsActor();
@@ -208,11 +209,16 @@ namespace OpenSim.Region.Physics.OdePlugin
208 } 209 }
209 210
210 211
211 d.JointAttach(joint, b1, b2); 212 d.JointAttach(joint, b1, b2);
212 213
213 214
215 PhysicsActor p1;
214 PhysicsActor p2; 216 PhysicsActor p2;
215 217
218 if (!actor_name_map.TryGetValue(g2, out p1))
219 {
220 p1 = PANull;
221 }
216 if (!actor_name_map.TryGetValue(g2, out p2)) 222 if (!actor_name_map.TryGetValue(g2, out p2))
217 { 223 {
218 p2 = PANull; 224 p2 = PANull;
@@ -220,6 +226,17 @@ namespace OpenSim.Region.Physics.OdePlugin
220 226
221 // We only need to test p2 for 'jump crouch purposes' 227 // We only need to test p2 for 'jump crouch purposes'
222 p2.IsColliding = true; 228 p2.IsColliding = true;
229 switch(p1.PhysicsActorType) {
230 case (int)ActorTypes.Agent:
231 p2.CollidingObj = true;
232 break;
233 case (int)ActorTypes.Prim:
234 p2.CollidingObj = true;
235 break;
236 case (int)ActorTypes.Unknown:
237 p2.CollidingGround = true;
238 break;
239 }
223 if (count > 3) 240 if (count > 3)
224 { 241 {
225 p2.ThrottleUpdates = true; 242 p2.ThrottleUpdates = true;
@@ -237,6 +254,8 @@ namespace OpenSim.Region.Physics.OdePlugin
237 254
238 255
239 chr.IsColliding = false; 256 chr.IsColliding = false;
257 chr.CollidingGround = false;
258 chr.CollidingObj = false;
240 d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback); 259 d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback);
241 foreach (OdeCharacter ch2 in _characters) 260 foreach (OdeCharacter ch2 in _characters)
242 /// should be a separate space -- lots of avatars will be N**2 slow 261 /// should be a separate space -- lots of avatars will be N**2 slow
@@ -308,11 +327,9 @@ namespace OpenSim.Region.Physics.OdePlugin
308 p = (OdePrim) prim; 327 p = (OdePrim) prim;
309 p.disableBody(); 328 p.disableBody();
310 } 329 }
311 if (!((OdePrim)prim).prim_geom.Equals(null)) 330
312 { 331 d.GeomDestroy(((OdePrim)prim).prim_geom);
313 if (((OdePrim)prim).prim_geom != (IntPtr) 0) 332
314 d.GeomDestroy(((OdePrim)prim).prim_geom);
315 }
316 _prims.Remove((OdePrim)prim); 333 _prims.Remove((OdePrim)prim);
317 334
318 } 335 }
@@ -642,8 +659,9 @@ namespace OpenSim.Region.Physics.OdePlugin
642 public static float CAPSULE_LENGTH = 0.79f; 659 public static float CAPSULE_LENGTH = 0.79f;
643 private bool flying = false; 660 private bool flying = false;
644 private bool m_iscolliding = false; 661 private bool m_iscolliding = false;
662 private bool m_wascolliding = false;
645 663
646 private bool[] m_colliderarr = new bool[10]; 664 private bool[] m_colliderarr = new bool[11];
647 665
648 private bool jumping = false; 666 private bool jumping = false;
649 //private float gravityAccel; 667 //private float gravityAccel;
@@ -661,7 +679,7 @@ namespace OpenSim.Region.Physics.OdePlugin
661 _acceleration = new PhysicsVector(); 679 _acceleration = new PhysicsVector();
662 _parent_scene = parent_scene; 680 _parent_scene = parent_scene;
663 681
664 for (int i = 0; i < 10; i++) 682 for (int i = 0; i < 11; i++)
665 { 683 {
666 m_colliderarr[i] = false; 684 m_colliderarr[i] = false;
667 } 685 }
@@ -679,7 +697,11 @@ namespace OpenSim.Region.Physics.OdePlugin
679 parent_scene.geom_name_map[Shell] = avName; 697 parent_scene.geom_name_map[Shell] = avName;
680 parent_scene.actor_name_map[Shell] = (PhysicsActor)this; 698 parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
681 } 699 }
682 700 public override int PhysicsActorType
701 {
702 get { return (int)ActorTypes.Agent; }
703 set { return; }
704 }
683 public override bool IsPhysical 705 public override bool IsPhysical
684 { 706 {
685 get { return false; } 707 get { return false; }
@@ -705,16 +727,16 @@ namespace OpenSim.Region.Physics.OdePlugin
705 int truecount=0; 727 int truecount=0;
706 int falsecount=0; 728 int falsecount=0;
707 729
708 if (m_colliderarr.Length >= 6) 730 if (m_colliderarr.Length >= 10)
709 { 731 {
710 for (i = 0; i < 6; i++) 732 for (i = 0; i < 10; i++)
711 { 733 {
712 m_colliderarr[i] = m_colliderarr[i + 1]; 734 m_colliderarr[i] = m_colliderarr[i + 1];
713 } 735 }
714 } 736 }
715 m_colliderarr[6] = value; 737 m_colliderarr[10] = value;
716 738
717 for (i = 0; i < 7; i++) 739 for (i = 0; i < 11; i++)
718 { 740 {
719 if (m_colliderarr[i]) 741 if (m_colliderarr[i])
720 { 742 {
@@ -728,7 +750,7 @@ namespace OpenSim.Region.Physics.OdePlugin
728 750
729 // Equal truecounts and false counts means we're colliding with something. 751 // Equal truecounts and false counts means we're colliding with something.
730 752
731 if (falsecount > truecount) 753 if (falsecount > 1.2 * truecount)
732 { 754 {
733 m_iscolliding = false; 755 m_iscolliding = false;
734 } 756 }
@@ -736,9 +758,25 @@ namespace OpenSim.Region.Physics.OdePlugin
736 { 758 {
737 m_iscolliding = true; 759 m_iscolliding = true;
738 } 760 }
761 if (m_wascolliding != m_iscolliding)
762 {
763 base.SendCollisionUpdate(new CollisionEventUpdate());
764 }
765 m_wascolliding = m_iscolliding;
739 } 766 }
740 } 767 }
741 public override PhysicsVector Position 768 public override bool CollidingGround
769 {
770 get { return false; }
771 set { return; }
772 }
773 public override bool CollidingObj
774 {
775 get { return false; }
776 set { return; }
777 }
778
779 public override PhysicsVector Position
742 { 780 {
743 get { return _position; } 781 get { return _position; }
744 set 782 set
@@ -869,8 +907,30 @@ namespace OpenSim.Region.Physics.OdePlugin
869 { 907 {
870 d.Vector3 pos = d.BodyGetPosition(Body); 908 d.Vector3 pos = d.BodyGetPosition(Body);
871 vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; 909 vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P;
910 if (_target_velocity.X > 0)
911 {
912 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
913 }
914 if (_target_velocity.Y > 0)
915 {
916 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
917 }
918 }
919 else if (!m_iscolliding && !flying)
920 {
921 d.Vector3 pos = d.BodyGetPosition(Body);
922 if (_target_velocity.X > 0)
923 {
924 vec.X = ((_target_velocity.X - vel.X)/1.2f) * PID_D;
925 }
926 if (_target_velocity.Y > 0)
927 {
928 vec.Y = ((_target_velocity.Y - vel.Y)/1.2f) * PID_D;
929 }
930
872 } 931 }
873 932
933
874 if (flying) 934 if (flying)
875 { 935 {
876 vec.Z = (_target_velocity.Z - vel.Z)*PID_D; 936 vec.Z = (_target_velocity.Z - vel.Z)*PID_D;
@@ -1012,6 +1072,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1012 // don't do .add() here; old geoms get recycled with the same hash 1072 // don't do .add() here; old geoms get recycled with the same hash
1013 } 1073 }
1014 } 1074 }
1075 public override int PhysicsActorType
1076 {
1077 get { return (int)ActorTypes.Prim; }
1078 set { return; }
1079 }
1015 public void enableBody() 1080 public void enableBody()
1016 { 1081 {
1017 // Sets the geom to a body 1082 // Sets the geom to a body
@@ -1028,6 +1093,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1028 d.GeomSetBody(prim_geom, Body); 1093 d.GeomSetBody(prim_geom, Body);
1029 d.BodySetAutoDisableFlag(Body, true); 1094 d.BodySetAutoDisableFlag(Body, true);
1030 d.BodySetAutoDisableSteps(Body,20); 1095 d.BodySetAutoDisableSteps(Body,20);
1096
1031 _parent_scene.addActivePrim(this); 1097 _parent_scene.addActivePrim(this);
1032 } 1098 }
1033 public void setMass() 1099 public void setMass()
@@ -1122,6 +1188,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1122 get { return iscolliding; } 1188 get { return iscolliding; }
1123 set { iscolliding = value; } 1189 set { iscolliding = value; }
1124 } 1190 }
1191 public override bool CollidingGround
1192 {
1193 get { return false; }
1194 set { return; }
1195 }
1196 public override bool CollidingObj
1197 {
1198 get { return false; }
1199 set { return; }
1200 }
1125 public override bool ThrottleUpdates 1201 public override bool ThrottleUpdates
1126 { 1202 {
1127 get { return m_throttleUpdates; } 1203 get { return m_throttleUpdates; }
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 7652372..1396458 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -204,7 +204,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
204 _acceleration = new PhysicsVector(); 204 _acceleration = new PhysicsVector();
205 _character = character; 205 _character = character;
206 } 206 }
207 207 public override int PhysicsActorType
208 {
209 get { return (int)ActorTypes.Agent; }
210 set { return; }
211 }
208 public override bool IsPhysical 212 public override bool IsPhysical
209 { 213 {
210 get { return false; } 214 get { return false; }
@@ -225,6 +229,16 @@ namespace OpenSim.Region.Physics.PhysXPlugin
225 get { return iscolliding; } 229 get { return iscolliding; }
226 set { iscolliding = value; } 230 set { iscolliding = value; }
227 } 231 }
232 public override bool CollidingGround
233 {
234 get { return false; }
235 set { return; }
236 }
237 public override bool CollidingObj
238 {
239 get { return false; }
240 set { return; }
241 }
228 public override PhysicsVector RotationalVelocity 242 public override PhysicsVector RotationalVelocity
229 { 243 {
230 get { return m_rotationalVelocity; } 244 get { return m_rotationalVelocity; }
@@ -339,7 +353,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
339 _acceleration = new PhysicsVector(); 353 _acceleration = new PhysicsVector();
340 _prim = prim; 354 _prim = prim;
341 } 355 }
342 356 public override int PhysicsActorType
357 {
358 get { return (int)ActorTypes.Prim; }
359 set { return; }
360 }
343 public override bool IsPhysical 361 public override bool IsPhysical
344 { 362 {
345 get { return false; } 363 get { return false; }
@@ -365,10 +383,20 @@ namespace OpenSim.Region.Physics.PhysXPlugin
365 { 383 {
366 get 384 get
367 { 385 {
368 return false; //no flying prims for you 386 return false;
369 } 387 }
370 set { } 388 set { }
371 } 389 }
390 public override bool CollidingGround
391 {
392 get { return false; }
393 set { return; }
394 }
395 public override bool CollidingObj
396 {
397 get { return false; }
398 set { return; }
399 }
372 public override PhysicsVector Position 400 public override PhysicsVector Position
373 { 401 {
374 get 402 get