aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-23 11:42:55 +0000
committerTeravus Ovares2008-02-23 11:42:55 +0000
commit27508c1ad87786935dbf28aa217bcbe55a9aa645 (patch)
tree0ae701c00cb8e92ab6416fb6688afeb536960b6e /OpenSim/Region
parent* Reduced size of 'startup complete message' by several thousand lines. (diff)
downloadopensim-SC_OLD-27508c1ad87786935dbf28aa217bcbe55a9aa645.zip
opensim-SC_OLD-27508c1ad87786935dbf28aa217bcbe55a9aa645.tar.gz
opensim-SC_OLD-27508c1ad87786935dbf28aa217bcbe55a9aa645.tar.bz2
opensim-SC_OLD-27508c1ad87786935dbf28aa217bcbe55a9aa645.tar.xz
* Added Support within the ODEPlugin for Selected. Which means that;
* When you select a physical prim, it stops while you've got it selected. * When you move or alter a prim in some manner, it doesn't become collidable until you de-select it * When you select a prim, it doesn't become temporarily 'phantom' until you make some change to it while it's selected. (this prevents accidental selections in prim floor from causing it to go phantom on you(but don't move it or you'll fall)) * There's one major difference, and that's a physical object won't stop if you don't have permission to edit it. This prevents people who don't have edit permissions on a prim from stopping it while it's moving.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs8
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs5
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs5
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs7
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs20
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs243
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs22
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPlugin.cs10
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs10
10 files changed, 310 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 7c0cd77..c393479 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -104,11 +104,16 @@ namespace OpenSim.Region.Environment.Scenes
104 { 104 {
105 if (ent is SceneObjectGroup) 105 if (ent is SceneObjectGroup)
106 { 106 {
107
107 if (((SceneObjectGroup) ent).LocalId == primLocalID) 108 if (((SceneObjectGroup) ent).LocalId == primLocalID)
108 { 109 {
109 ((SceneObjectGroup) ent).GetProperties(remoteClient); 110 // A prim is only tainted if it's allowed to be edited by the person clicking it.
110 ((SceneObjectGroup) ent).IsSelected = true; 111 if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
111 LandManager.setPrimsTainted(); 112 {
113 ((SceneObjectGroup) ent).GetProperties(remoteClient);
114 ((SceneObjectGroup) ent).IsSelected = true;
115 LandManager.setPrimsTainted();
116 }
112 break; 117 break;
113 } 118 }
114 } 119 }
@@ -130,9 +135,12 @@ namespace OpenSim.Region.Environment.Scenes
130 { 135 {
131 if (((SceneObjectGroup) ent).LocalId == primLocalID) 136 if (((SceneObjectGroup) ent).LocalId == primLocalID)
132 { 137 {
133 ((SceneObjectGroup) ent).IsSelected = false; 138 if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
134 LandManager.setPrimsTainted(); 139 {
135 break; 140 ((SceneObjectGroup) ent).IsSelected = false;
141 LandManager.setPrimsTainted();
142 break;
143 }
136 } 144 }
137 } 145 }
138 } 146 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 8fd9edb..801e614 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -203,6 +203,14 @@ namespace OpenSim.Region.Environment.Scenes
203 if (m_rootPart.PhysActor != null) 203 if (m_rootPart.PhysActor != null)
204 { 204 {
205 m_rootPart.PhysActor.Selected = value; 205 m_rootPart.PhysActor.Selected = value;
206 // Pass it on to the children.
207 foreach (SceneObjectPart child in Children.Values)
208 {
209 if (child.PhysActor != null)
210 {
211 child.PhysActor.Selected = value;
212 }
213 }
206 } 214 }
207 } 215 }
208 } 216 }
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 4e96ce0..e3b9ef3 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -228,6 +228,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
228 set { return; } 228 set { return; }
229 } 229 }
230 230
231 public override uint LocalID
232 {
233 set { return; }
234 }
235
231 public override bool Grabbed 236 public override bool Grabbed
232 { 237 {
233 set { return; } 238 set { return; }
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 180e14c..8a4e4f4 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -895,6 +895,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
895 set { return; } 895 set { return; }
896 } 896 }
897 897
898 public override uint LocalID
899 {
900 set { return; }
901 }
902
898 public override bool Grabbed 903 public override bool Grabbed
899 { 904 {
900 set { return; } 905 set { return; }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 7e88479..aa6cf43 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -124,6 +124,8 @@ namespace OpenSim.Region.Physics.Manager
124 124
125 public abstract PrimitiveBaseShape Shape { set; } 125 public abstract PrimitiveBaseShape Shape { set; }
126 126
127 public abstract uint LocalID { set; }
128
127 public abstract bool Grabbed { set; } 129 public abstract bool Grabbed { set; }
128 130
129 public abstract bool Selected { set; } 131 public abstract bool Selected { set; }
@@ -228,6 +230,11 @@ namespace OpenSim.Region.Physics.Manager
228 set { return; } 230 set { return; }
229 } 231 }
230 232
233 public override uint LocalID
234 {
235 set { return; }
236 }
237
231 public override bool Grabbed 238 public override bool Grabbed
232 { 239 {
233 set { return; } 240 set { return; }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 499422f..2efca3b 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -87,6 +87,8 @@ namespace OpenSim.Region.Physics.OdePlugin
87 private bool m_hackSentFall = false; 87 private bool m_hackSentFall = false;
88 private bool m_hackSentFly = false; 88 private bool m_hackSentFly = false;
89 private bool m_foundDebian = false; 89 private bool m_foundDebian = false;
90 public uint m_localID = 0;
91
90 private CollisionLocker ode; 92 private CollisionLocker ode;
91 93
92 private string m_name = String.Empty; 94 private string m_name = String.Empty;
@@ -94,6 +96,15 @@ namespace OpenSim.Region.Physics.OdePlugin
94 private bool[] m_colliderarr = new bool[11]; 96 private bool[] m_colliderarr = new bool[11];
95 private bool[] m_colliderGroundarr = new bool[11]; 97 private bool[] m_colliderGroundarr = new bool[11];
96 98
99 // Default we're a Character
100 private CollisionCategories m_collisionCategories = (CollisionCategories.Character);
101
102 // Default, Collide with Other Geometries, spaces, bodies and characters.
103 private CollisionCategories m_collisionFlags = (CollisionCategories.Geom
104 | CollisionCategories.Space
105 | CollisionCategories.Body
106 | CollisionCategories.Character
107 | CollisionCategories.Land);
97 108
98 private bool jumping = false; 109 private bool jumping = false;
99 //private float gravityAccel; 110 //private float gravityAccel;
@@ -157,6 +168,11 @@ namespace OpenSim.Region.Physics.OdePlugin
157 set { m_alwaysRun = value; } 168 set { m_alwaysRun = value; }
158 } 169 }
159 170
171 public override uint LocalID
172 {
173 set { m_localID = value; }
174 }
175
160 public override bool Grabbed 176 public override bool Grabbed
161 { 177 {
162 set { return; } 178 set { return; }
@@ -404,6 +420,10 @@ namespace OpenSim.Region.Physics.OdePlugin
404 int dAMotorEuler = 1; 420 int dAMotorEuler = 1;
405 _parent_scene.waitForSpaceUnlock(_parent_scene.space); 421 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
406 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); 422 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
423
424 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
425 d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
426
407 d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); 427 d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
408 Body = d.BodyCreate(_parent_scene.world); 428 Body = d.BodyCreate(_parent_scene.world);
409 d.BodySetPosition(Body, npositionX, npositionY, npositionZ); 429 d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 50087a5..6da2296 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -52,12 +52,30 @@ namespace OpenSim.Region.Physics.OdePlugin
52 private PhysicsVector m_taintsize; 52 private PhysicsVector m_taintsize;
53 private PhysicsVector m_taintVelocity = PhysicsVector.Zero; 53 private PhysicsVector m_taintVelocity = PhysicsVector.Zero;
54 private Quaternion m_taintrot; 54 private Quaternion m_taintrot;
55 private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom
56 | CollisionCategories.Space
57 | CollisionCategories.Body
58 | CollisionCategories.Character);
55 private bool m_taintshape = false; 59 private bool m_taintshape = false;
56 private bool m_taintPhysics = false; 60 private bool m_taintPhysics = false;
61 private bool m_collidesLand = true;
62 private bool m_collidesWater = false;
63
64 // Default we're a Geometry
65 private CollisionCategories m_collisionCategories = (CollisionCategories.Geom );
66
67 // Default, Collide with Other Geometries, spaces and Bodies
68 private CollisionCategories m_collisionFlags = m_default_collisionFlags;
69
57 public bool m_taintremove = false; 70 public bool m_taintremove = false;
58 public bool m_taintdisable = false; 71 public bool m_taintdisable = false;
59 public bool m_disabled = false; 72 public bool m_disabled = false;
60 public bool m_taintadd = false; 73 public bool m_taintadd = false;
74 public bool m_taintselected = false;
75
76
77 public uint m_localID = 0;
78
61 public GCHandle gc; 79 public GCHandle gc;
62 private CollisionLocker ode; 80 private CollisionLocker ode;
63 81
@@ -74,6 +92,8 @@ namespace OpenSim.Region.Physics.OdePlugin
74 92
75 private bool iscolliding = false; 93 private bool iscolliding = false;
76 private bool m_isphysical = false; 94 private bool m_isphysical = false;
95 private bool m_isSelected = false;
96
77 private bool m_throttleUpdates = false; 97 private bool m_throttleUpdates = false;
78 private int throttleCounter = 0; 98 private int throttleCounter = 0;
79 public int m_interpenetrationcount = 0; 99 public int m_interpenetrationcount = 0;
@@ -172,6 +192,11 @@ namespace OpenSim.Region.Physics.OdePlugin
172 set { return; } 192 set { return; }
173 } 193 }
174 194
195 public override uint LocalID
196 {
197 set { m_localID = value; }
198 }
199
175 public override bool Grabbed 200 public override bool Grabbed
176 { 201 {
177 set { return; } 202 set { return; }
@@ -179,17 +204,59 @@ namespace OpenSim.Region.Physics.OdePlugin
179 204
180 public override bool Selected 205 public override bool Selected
181 { 206 {
182 set { return; } 207 set {
208 // This only makes the object not collidable if the object
209 // is physical or the object is modified somehow *IN THE FUTURE*
210 // without this, if an avatar selects prim, they can walk right
211 // through it while it's selected
212
213 if (m_isphysical || !value)
214 {
215 m_taintselected = value;
216 _parent_scene.AddPhysicsActorTaint(this);
217 }
218 else
219 {
220
221 m_taintselected = value;
222 m_isSelected = value;
223 }
224
225 }
183 } 226 }
184 227
185 public void SetGeom(IntPtr geom) 228 public void SetGeom(IntPtr geom)
186 { 229 {
187 prev_geom = prim_geom; 230 prev_geom = prim_geom;
188 prim_geom = geom; 231 prim_geom = geom;
232 if (prim_geom != (IntPtr)0)
233 {
234 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
235 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
236 }
189 //m_log.Warn("Setting Geom to: " + prim_geom); 237 //m_log.Warn("Setting Geom to: " + prim_geom);
190 238
191 } 239 }
192 240
241 public void enableBodySoft()
242 {
243 if (m_isphysical)
244 if (Body != (IntPtr)0)
245 d.BodyEnable(Body);
246
247 m_disabled = false;
248 }
249
250 public void disableBodySoft()
251 {
252 m_disabled = true;
253
254 if (m_isphysical)
255 if (Body != (IntPtr)0)
256 d.BodyDisable(Body);
257 }
258
259
193 public void enableBody() 260 public void enableBody()
194 { 261 {
195 // Sets the geom to a body 262 // Sets the geom to a body
@@ -204,6 +271,13 @@ namespace OpenSim.Region.Physics.OdePlugin
204 myrot.Z = _orientation.z; 271 myrot.Z = _orientation.z;
205 d.BodySetQuaternion(Body, ref myrot); 272 d.BodySetQuaternion(Body, ref myrot);
206 d.GeomSetBody(prim_geom, Body); 273 d.GeomSetBody(prim_geom, Body);
274 m_collisionCategories |= CollisionCategories.Body;
275 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
276
277 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
278 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
279
280
207 d.BodySetAutoDisableFlag(Body, true); 281 d.BodySetAutoDisableFlag(Body, true);
208 d.BodySetAutoDisableSteps(Body, 20); 282 d.BodySetAutoDisableSteps(Body, 20);
209 283
@@ -332,6 +406,15 @@ namespace OpenSim.Region.Physics.OdePlugin
332 //this kills the body so things like 'mesh' can re-create it. 406 //this kills the body so things like 'mesh' can re-create it.
333 if (Body != (IntPtr) 0) 407 if (Body != (IntPtr) 0)
334 { 408 {
409 m_collisionCategories &= ~CollisionCategories.Body;
410 m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
411
412 if (prim_geom != (IntPtr)0)
413 {
414 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
415 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
416 }
417
335 _parent_scene.remActivePrim(this); 418 _parent_scene.remActivePrim(this);
336 d.BodyDestroy(Body); 419 d.BodyDestroy(Body);
337 Body = (IntPtr) 0; 420 Body = (IntPtr) 0;
@@ -425,10 +508,81 @@ namespace OpenSim.Region.Physics.OdePlugin
425 if (m_taintdisable) 508 if (m_taintdisable)
426 changedisable(timestep); 509 changedisable(timestep);
427 510
511 if (m_taintselected != m_isSelected)
512 changeSelectedStatus(timestep);
513
428 if (m_taintVelocity != PhysicsVector.Zero) 514 if (m_taintVelocity != PhysicsVector.Zero)
429 changevelocity(timestep); 515 changevelocity(timestep);
430 } 516 }
431 517
518 private void changeSelectedStatus(float timestep)
519 {
520 while (ode.lockquery())
521 {
522 }
523 ode.dlock(_parent_scene.world);
524
525 if (m_taintselected)
526 {
527
528
529 m_collisionCategories = CollisionCategories.Selected;
530 m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space);
531
532 // We do the body disable soft twice because 'in theory' a collision could have happened
533 // in between the disabling and the collision properties setting
534 // which would wake the physical body up from a soft disabling and potentially cause it to fall
535 // through the ground.
536
537 if (m_isphysical)
538 {
539 disableBodySoft();
540 }
541
542 if (prim_geom != (IntPtr)0)
543 {
544 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
545 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
546 }
547
548 if (m_isphysical)
549 {
550 disableBodySoft();
551 }
552
553 }
554 else
555 {
556
557 m_collisionCategories = CollisionCategories.Geom;
558
559 if (m_isphysical)
560 m_collisionCategories |= CollisionCategories.Body;
561
562
563 m_collisionFlags = m_default_collisionFlags;
564
565 if (m_collidesLand)
566 m_collisionFlags |= CollisionCategories.Land;
567 if (m_collidesWater)
568 m_collisionFlags |= CollisionCategories.Water;
569
570 if (prim_geom != (IntPtr)0)
571 {
572 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
573 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
574 }
575 if (m_isphysical)
576 enableBodySoft();
577
578
579 }
580
581 ode.dunlock(_parent_scene.world);
582 resetCollisionAccounting();
583 m_isSelected = m_taintselected;
584 }
585
432 public void ResetTaints() 586 public void ResetTaints()
433 { 587 {
434 588
@@ -438,6 +592,8 @@ namespace OpenSim.Region.Physics.OdePlugin
438 592
439 m_taintPhysics = m_isphysical; 593 m_taintPhysics = m_isphysical;
440 594
595 m_taintselected = m_isSelected;
596
441 m_taintsize = _size; 597 m_taintsize = _size;
442 598
443 599
@@ -586,6 +742,9 @@ namespace OpenSim.Region.Physics.OdePlugin
586 ode.dunlock(_parent_scene.world); 742 ode.dunlock(_parent_scene.world);
587 _parent_scene.geom_name_map[prim_geom] = this.m_primName; 743 _parent_scene.geom_name_map[prim_geom] = this.m_primName;
588 _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this; 744 _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this;
745
746 changeSelectedStatus(timestep);
747
589 m_taintadd = false; 748 m_taintadd = false;
590 749
591 750
@@ -630,6 +789,8 @@ namespace OpenSim.Region.Physics.OdePlugin
630 } 789 }
631 ode.dunlock(_parent_scene.world); 790 ode.dunlock(_parent_scene.world);
632 791
792 changeSelectedStatus(timestep);
793
633 resetCollisionAccounting(); 794 resetCollisionAccounting();
634 m_taintposition = _position; 795 m_taintposition = _position;
635 } 796 }
@@ -682,7 +843,7 @@ namespace OpenSim.Region.Physics.OdePlugin
682 m_taintdisable = false; 843 m_taintdisable = false;
683 } 844 }
684 845
685 public void changePhysicsStatus(float timestap) 846 public void changePhysicsStatus(float timestep)
686 { 847 {
687 lock (ode) 848 lock (ode)
688 { 849 {
@@ -709,6 +870,8 @@ namespace OpenSim.Region.Physics.OdePlugin
709 ode.dunlock(_parent_scene.world); 870 ode.dunlock(_parent_scene.world);
710 } 871 }
711 872
873 changeSelectedStatus(timestep);
874
712 resetCollisionAccounting(); 875 resetCollisionAccounting();
713 m_taintPhysics = m_isphysical; 876 m_taintPhysics = m_isphysical;
714 } 877 }
@@ -880,6 +1043,8 @@ namespace OpenSim.Region.Physics.OdePlugin
880 1043
881 ode.dunlock(_parent_scene.world); 1044 ode.dunlock(_parent_scene.world);
882 1045
1046 changeSelectedStatus(timestamp);
1047
883 resetCollisionAccounting(); 1048 resetCollisionAccounting();
884 m_taintsize = _size; 1049 m_taintsize = _size;
885 } 1050 }
@@ -927,7 +1092,7 @@ namespace OpenSim.Region.Physics.OdePlugin
927 // Re creates body on size. 1092 // Re creates body on size.
928 // EnableBody also does setMass() 1093 // EnableBody also does setMass()
929 enableBody(); 1094 enableBody();
930 d.BodyEnable(Body); 1095
931 } 1096 }
932 } 1097 }
933 else 1098 else
@@ -1032,66 +1197,76 @@ namespace OpenSim.Region.Physics.OdePlugin
1032 d.BodyEnable(Body); 1197 d.BodyEnable(Body);
1033 } 1198 }
1034 } 1199 }
1200
1201
1035 _parent_scene.geom_name_map[prim_geom] = oldname; 1202 _parent_scene.geom_name_map[prim_geom] = oldname;
1036 1203
1037 ode.dunlock(_parent_scene.world); 1204 ode.dunlock(_parent_scene.world);
1038 1205
1206 changeSelectedStatus(timestamp);
1207
1039 resetCollisionAccounting(); 1208 resetCollisionAccounting();
1040 m_taintshape = false; 1209 m_taintshape = false;
1041 } 1210 }
1042 1211
1043 public void changeAddForce(float timestamp) 1212 public void changeAddForce(float timestamp)
1044 { 1213 {
1045 while (ode.lockquery()) 1214 if (!m_isSelected)
1046 { 1215 {
1047 } 1216 while (ode.lockquery())
1048 ode.dlock(_parent_scene.world); 1217 {
1218 }
1219 ode.dlock(_parent_scene.world);
1049 1220
1050 1221
1051 lock (m_forcelist) 1222 lock (m_forcelist)
1052 {
1053 //m_log.Info("[PHYSICS]: dequeing forcelist");
1054 if (IsPhysical)
1055 { 1223 {
1056 PhysicsVector iforce = new PhysicsVector(); 1224 //m_log.Info("[PHYSICS]: dequeing forcelist");
1057 for (int i = 0; i < m_forcelist.Count; i++) 1225 if (IsPhysical)
1058 { 1226 {
1059 iforce = iforce + (m_forcelist[i]*100); 1227 PhysicsVector iforce = new PhysicsVector();
1060 } 1228 for (int i = 0; i < m_forcelist.Count; i++)
1061 d.BodyEnable(Body); 1229 {
1062 d.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z); 1230 iforce = iforce + (m_forcelist[i] * 100);
1231 }
1232 d.BodyEnable(Body);
1233 d.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z);
1234 }
1235 m_forcelist.Clear();
1063 } 1236 }
1064 m_forcelist.Clear();
1065 }
1066 1237
1067 ode.dunlock(_parent_scene.world); 1238 ode.dunlock(_parent_scene.world);
1068 1239
1069 m_collisionscore = 0; 1240 m_collisionscore = 0;
1070 m_interpenetrationcount = 0; 1241 m_interpenetrationcount = 0;
1242 }
1071 m_taintforce = false; 1243 m_taintforce = false;
1072 1244
1073 } 1245 }
1074 private void changevelocity(float timestep) 1246 private void changevelocity(float timestep)
1075 { 1247 {
1076 lock (ode) 1248 if (!m_isSelected)
1077 { 1249 {
1078 while (ode.lockquery()) 1250 lock (ode)
1079 { 1251 {
1080 } 1252 while (ode.lockquery())
1081 ode.dlock(_parent_scene.world); 1253 {
1254 }
1255 ode.dlock(_parent_scene.world);
1082 1256
1083 System.Threading.Thread.Sleep(20); 1257 System.Threading.Thread.Sleep(20);
1084 if (IsPhysical) 1258 if (IsPhysical)
1085 {
1086 if (Body != (IntPtr)0)
1087 { 1259 {
1088 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); 1260 if (Body != (IntPtr)0)
1261 {
1262 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z);
1263 }
1089 } 1264 }
1090 }
1091 1265
1092 ode.dunlock(_parent_scene.world); 1266 ode.dunlock(_parent_scene.world);
1267 }
1268 //resetCollisionAccounting();
1093 } 1269 }
1094 //resetCollisionAccounting();
1095 m_taintVelocity = PhysicsVector.Zero; 1270 m_taintVelocity = PhysicsVector.Zero;
1096 } 1271 }
1097 public override bool IsPhysical 1272 public override bool IsPhysical
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index b3780fd..76bd3f2 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -78,6 +78,21 @@ namespace OpenSim.Region.Physics.OdePlugin
78 } 78 }
79 } 79 }
80 80
81 [Flags]
82 public enum CollisionCategories : int
83 {
84 Disabled = 0,
85 Geom = 0x00000001,
86 Body = 0x00000002,
87 Space = 0x00000004,
88 Character = 0x00000008,
89 Land = 0x00000010,
90 Water = 0x00000020,
91 Wind = 0x00000040,
92 Sensor = 0x00000080,
93 Selected = 0x00000100
94 }
95
81 public class OdeScene : PhysicsScene 96 public class OdeScene : PhysicsScene
82 { 97 {
83 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 98 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -997,6 +1012,7 @@ namespace OpenSim.Region.Physics.OdePlugin
997 { 1012 {
998 // creating a new space for prim and inserting it into main space. 1013 // creating a new space for prim and inserting it into main space.
999 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero); 1014 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero);
1015 d.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space);
1000 waitForSpaceUnlock(space); 1016 waitForSpaceUnlock(space);
1001 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); 1017 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
1002 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; 1018 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
@@ -1656,6 +1672,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1656 offset, thickness, wrap); 1672 offset, thickness, wrap);
1657 d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); 1673 d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight);
1658 LandGeom = d.CreateHeightfield(space, HeightmapData, 1); 1674 LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
1675 if (LandGeom != (IntPtr)0)
1676 {
1677 d.GeomSetCategoryBits(LandGeom, (int)(CollisionCategories.Land));
1678 d.GeomSetCollideBits(LandGeom, (int)(CollisionCategories.Space));
1679
1680 }
1659 geom_name_map[LandGeom] = "Terrain"; 1681 geom_name_map[LandGeom] = "Terrain";
1660 1682
1661 d.Matrix3 R = new d.Matrix3(); 1683 d.Matrix3 R = new d.Matrix3();
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
index 6d1bec7..9d70ac8 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
@@ -357,6 +357,11 @@ namespace OpenSim.Region.Physics.POSPlugin
357 set { return; } 357 set { return; }
358 } 358 }
359 359
360 public override uint LocalID
361 {
362 set { return; }
363 }
364
360 public override bool Grabbed 365 public override bool Grabbed
361 { 366 {
362 set { return; } 367 set { return; }
@@ -645,6 +650,11 @@ namespace OpenSim.Region.Physics.POSPlugin
645 set { return; } 650 set { return; }
646 } 651 }
647 652
653 public override uint LocalID
654 {
655 set { return; }
656 }
657
648 public override bool Grabbed 658 public override bool Grabbed
649 { 659 {
650 set { return; } 660 set { return; }
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 970f6fb..83930c3 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -227,6 +227,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
227 set { return; } 227 set { return; }
228 } 228 }
229 229
230 public override uint LocalID
231 {
232 set { return; }
233 }
234
230 public override bool Grabbed 235 public override bool Grabbed
231 { 236 {
232 set { return; } 237 set { return; }
@@ -437,6 +442,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
437 set { return; } 442 set { return; }
438 } 443 }
439 444
445 public override uint LocalID
446 {
447 set { return; }
448 }
449
440 public override bool Grabbed 450 public override bool Grabbed
441 { 451 {
442 set { return; } 452 set { return; }