aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-29 15:10:18 +0000
committerTeravus Ovares2008-01-29 15:10:18 +0000
commitc4687116adfdeb5de056000ef3d2dd47b8695339 (patch)
tree420ad4a29cd3f20ddf2f7b7922f17c547bd7aea9 /OpenSim/Region
parent* Patch from Ansi (IBM) (diff)
downloadopensim-SC-c4687116adfdeb5de056000ef3d2dd47b8695339.zip
opensim-SC-c4687116adfdeb5de056000ef3d2dd47b8695339.tar.gz
opensim-SC-c4687116adfdeb5de056000ef3d2dd47b8695339.tar.bz2
opensim-SC-c4687116adfdeb5de056000ef3d2dd47b8695339.tar.xz
* Implemented grab and throw in ODE. It's a little strong still so toss gently at first to test the waters or you'll lose prim to the pit at the edge of the sim. Make sure the object is physical before trying to toss it or it'll just move to the new location.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs44
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs10
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs10
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs17
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs11
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs11
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPlugin.cs21
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs20
8 files changed, 138 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 785ebf7..10395b6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -207,7 +207,14 @@ namespace OpenSim.Region.Environment.Scenes
207 public bool IsSelected 207 public bool IsSelected
208 { 208 {
209 get { return m_isSelected; } 209 get { return m_isSelected; }
210 set { m_isSelected = value; } 210 set {
211 m_isSelected = value;
212 // Tell physics engine that group is selected
213 if (m_rootPart.PhysActor != null)
214 {
215 m_rootPart.PhysActor.Selected = value;
216 }
217 }
211 } 218 }
212 219
213 // The UUID for the Region this Object is in. 220 // The UUID for the Region this Object is in.
@@ -1039,20 +1046,45 @@ namespace OpenSim.Region.Environment.Scenes
1039 } 1046 }
1040 1047
1041 /// <summary> 1048 /// <summary>
1042 /// 1049 /// If object is physical, apply force to move it around
1050 /// If object is not physical, just put it at the resulting location
1043 /// </summary> 1051 /// </summary>
1044 /// <param name="offset"></param> 1052 /// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
1045 /// <param name="pos"></param> 1053 /// <param name="pos">New position. We do the math here to turn it into a force</param>
1046 /// <param name="remoteClient"></param> 1054 /// <param name="remoteClient"></param>
1047 public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 1055 public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
1048 { 1056 {
1057
1049 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 1058 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
1050 { 1059 {
1051 AbsolutePosition = pos; 1060
1052 m_rootPart.SendTerseUpdateToAllClients(); 1061 if (m_rootPart.PhysActor != null)
1062 {
1063 if (m_rootPart.PhysActor.IsPhysical)
1064 {
1065 LLVector3 llmoveforce = pos - AbsolutePosition;
1066 PhysicsVector grabforce = new PhysicsVector(llmoveforce.X, llmoveforce.Y, llmoveforce.Z);
1067 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
1068 m_rootPart.PhysActor.AddForce(grabforce);
1069 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
1070 }
1071 else
1072 {
1073 NonPhysicalGrabMovement(pos);
1074 }
1075 }
1076 else
1077 {
1078 NonPhysicalGrabMovement(pos);
1079 }
1053 } 1080 }
1054 } 1081 }
1082 public void NonPhysicalGrabMovement(LLVector3 pos)
1083 {
1084 AbsolutePosition = pos;
1085 m_rootPart.SendTerseUpdateToAllClients();
1055 1086
1087 }
1056 /// <summary> 1088 /// <summary>
1057 /// 1089 ///
1058 /// </summary> 1090 /// </summary>
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 636cf1a..ff157d7 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -224,6 +224,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
224 set { return; } 224 set { return; }
225 } 225 }
226 226
227 public override bool Grabbed
228 {
229 set { return; }
230 }
231
232 public override bool Selected
233 {
234 set { return; }
235 }
236
227 public override bool IsPhysical 237 public override bool IsPhysical
228 { 238 {
229 get { return false; } 239 get { return false; }
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index deba5f6..f42fdf6 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -883,6 +883,16 @@ namespace OpenSim.Region.Physics.BulletXPlugin
883 set { return; } 883 set { return; }
884 } 884 }
885 885
886 public override bool Grabbed
887 {
888 set { return; }
889 }
890
891 public override bool Selected
892 {
893 set { return; }
894 }
895
886 public virtual void SetAcceleration(PhysicsVector accel) 896 public virtual void SetAcceleration(PhysicsVector accel)
887 { 897 {
888 lock (BulletXScene.BulletXLock) 898 lock (BulletXScene.BulletXLock)
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index d393b62..f97b279 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -122,6 +122,10 @@ namespace OpenSim.Region.Physics.Manager
122 122
123 public abstract PrimitiveBaseShape Shape { set; } 123 public abstract PrimitiveBaseShape Shape { set; }
124 124
125 public abstract bool Grabbed { set; }
126
127 public abstract bool Selected { set; }
128
125 public virtual void RequestPhysicsterseUpdate() 129 public virtual void RequestPhysicsterseUpdate()
126 { 130 {
127 // Make a temporary copy of the event to avoid possibility of 131 // Make a temporary copy of the event to avoid possibility of
@@ -190,6 +194,8 @@ namespace OpenSim.Region.Physics.Manager
190 public abstract void AddForce(PhysicsVector force); 194 public abstract void AddForce(PhysicsVector force);
191 195
192 public abstract void SetMomentum(PhysicsVector momentum); 196 public abstract void SetMomentum(PhysicsVector momentum);
197
198
193 } 199 }
194 200
195 public class NullPhysicsActor : PhysicsActor 201 public class NullPhysicsActor : PhysicsActor
@@ -206,6 +212,17 @@ namespace OpenSim.Region.Physics.Manager
206 set { return; } 212 set { return; }
207 } 213 }
208 214
215 public override bool Grabbed
216 {
217 set { return; }
218 }
219
220 public override bool Selected
221 {
222 set { return; }
223 }
224
225
209 public override bool CollidingGround 226 public override bool CollidingGround
210 { 227 {
211 get { return false; } 228 get { return false; }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index f9010e6..3f63477 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -152,6 +152,17 @@ namespace OpenSim.Region.Physics.OdePlugin
152 set { m_alwaysRun = value; } 152 set { m_alwaysRun = value; }
153 } 153 }
154 154
155 public override bool Grabbed
156 {
157 set { return; }
158 }
159
160 public override bool Selected
161 {
162 set { return; }
163 }
164
165
155 public override bool IsPhysical 166 public override bool IsPhysical
156 { 167 {
157 get { return false; } 168 get { return false; }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index dcff558..d70819e 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -202,6 +202,17 @@ namespace OpenSim.Region.Physics.OdePlugin
202 set { return; } 202 set { return; }
203 } 203 }
204 204
205 public override bool Grabbed
206 {
207 set { return; }
208 }
209
210 public override bool Selected
211 {
212 set { return; }
213 }
214
215
205 public void enableBody() 216 public void enableBody()
206 { 217 {
207 // Sets the geom to a body 218 // Sets the geom to a body
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
index 74b319a..2b07553 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
@@ -354,6 +354,16 @@ namespace OpenSim.Region.Physics.POSPlugin
354 set { return; } 354 set { return; }
355 } 355 }
356 356
357 public override bool Grabbed
358 {
359 set { return; }
360 }
361
362 public override bool Selected
363 {
364 set { return; }
365 }
366
357 public override bool IsPhysical 367 public override bool IsPhysical
358 { 368 {
359 get { return false; } 369 get { return false; }
@@ -607,5 +617,16 @@ namespace OpenSim.Region.Physics.POSPlugin
607 get { return false; } 617 get { return false; }
608 set { return; } 618 set { return; }
609 } 619 }
620
621 public override bool Grabbed
622 {
623 set { return; }
624 }
625
626 public override bool Selected
627 {
628 set { return; }
629 }
630
610 } 631 }
611} \ No newline at end of file 632} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 20bf358..71bd94e 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -224,6 +224,16 @@ namespace OpenSim.Region.Physics.PhysXPlugin
224 set { return; } 224 set { return; }
225 } 225 }
226 226
227 public override bool Grabbed
228 {
229 set { return; }
230 }
231
232 public override bool Selected
233 {
234 set { return; }
235 }
236
227 public override bool IsPhysical 237 public override bool IsPhysical
228 { 238 {
229 get { return false; } 239 get { return false; }
@@ -410,6 +420,16 @@ namespace OpenSim.Region.Physics.PhysXPlugin
410 set { return; } 420 set { return; }
411 } 421 }
412 422
423 public override bool Grabbed
424 {
425 set { return; }
426 }
427
428 public override bool Selected
429 {
430 set { return; }
431 }
432
413 public override bool ThrottleUpdates 433 public override bool ThrottleUpdates
414 { 434 {
415 get { return false; } 435 get { return false; }