aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authordarok2007-11-03 19:33:00 +0000
committerdarok2007-11-03 19:33:00 +0000
commitfbf3c6a768274cfdb1e91e73758f9ee893094153 (patch)
tree6b6bd68b1061fa3ca4df20a044b55a50e0d354e2 /OpenSim/Region/Environment/Scenes
parentFirst part of Scene refactoring: (diff)
downloadopensim-SC_OLD-fbf3c6a768274cfdb1e91e73758f9ee893094153.zip
opensim-SC_OLD-fbf3c6a768274cfdb1e91e73758f9ee893094153.tar.gz
opensim-SC_OLD-fbf3c6a768274cfdb1e91e73758f9ee893094153.tar.bz2
opensim-SC_OLD-fbf3c6a768274cfdb1e91e73758f9ee893094153.tar.xz
Modifications for prim movement. For now only in Mod. BulletX, but i think it can be easy to add to ODE. Enjoy kick the prims and be careful with the falling ones ;D
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs73
2 files changed, 90 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 39f4e5c..b00d465 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -55,6 +55,9 @@ namespace OpenSim.Region.Environment.Scenes
55 55
56 public bool HasChanged = false; 56 public bool HasChanged = false;
57 57
58 private LLVector3 lastPhysGroupPos;
59 private LLQuaternion lastPhysGroupRot;
60
58 #region Properties 61 #region Properties
59 62
60 /// <summary> 63 /// <summary>
@@ -490,6 +493,25 @@ namespace OpenSim.Region.Environment.Scenes
490 /// </summary> 493 /// </summary>
491 public override void Update() 494 public override void Update()
492 { 495 {
496 if (lastPhysGroupPos.GetDistanceTo(AbsolutePosition) > 0.02)
497 {
498 foreach (SceneObjectPart part in m_parts.Values)
499 {
500 if (part.UpdateFlag == 0) part.UpdateFlag = 1;
501 }
502 lastPhysGroupPos = AbsolutePosition;
503 }
504 if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
505 || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
506 || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
507 || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))
508 {
509 foreach (SceneObjectPart part in m_parts.Values)
510 {
511 if (part.UpdateFlag == 0) part.UpdateFlag = 1;
512 }
513 lastPhysGroupRot = GroupRotation;
514 }
493 foreach (SceneObjectPart part in m_parts.Values) 515 foreach (SceneObjectPart part in m_parts.Values)
494 { 516 {
495 part.SendScheduledUpdates(); 517 part.SendScheduledUpdates();
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 637e090..b558bb2 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -148,8 +148,34 @@ namespace OpenSim.Region.Environment.Scenes
148 148
149 public LLVector3 GroupPosition 149 public LLVector3 GroupPosition
150 { 150 {
151 get { return m_groupPosition; } 151 get
152 set { m_groupPosition = value; } 152 {
153 if (PhysActor != null)
154 {
155 m_groupPosition.X = PhysActor.Position.X;
156 m_groupPosition.Y = PhysActor.Position.Y;
157 m_groupPosition.Z = PhysActor.Position.Z;
158 }
159 return m_groupPosition;
160 }
161 set
162 {
163 if (PhysActor != null)
164 {
165 try
166 {
167 //lock (m_scene.SyncRoot)
168 //{
169 PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
170 //}
171 }
172 catch (Exception e)
173 {
174 Console.WriteLine(e.Message);
175 }
176 }
177 m_groupPosition = value;
178 }
153 } 179 }
154 180
155 protected LLVector3 m_offsetPosition; 181 protected LLVector3 m_offsetPosition;
@@ -169,8 +195,35 @@ namespace OpenSim.Region.Environment.Scenes
169 195
170 public LLQuaternion RotationOffset 196 public LLQuaternion RotationOffset
171 { 197 {
172 get { return m_rotationOffset; } 198 get
173 set { m_rotationOffset = value; } 199 {
200 if (PhysActor != null)
201 {
202 m_rotationOffset.X = PhysActor.Orientation.x;
203 m_rotationOffset.Y = PhysActor.Orientation.y;
204 m_rotationOffset.Z = PhysActor.Orientation.z;
205 m_rotationOffset.W = PhysActor.Orientation.w;
206 }
207 return m_rotationOffset;
208 }
209 set
210 {
211 if (PhysActor != null)
212 {
213 try
214 {
215 //lock (m_scene.SyncRoot)
216 //{
217 PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z);
218 //}
219 }
220 catch (Exception ex)
221 {
222 Console.WriteLine(ex.Message);
223 }
224 }
225 m_rotationOffset = value;
226 }
174 } 227 }
175 228
176 protected LLVector3 m_velocity; 229 protected LLVector3 m_velocity;
@@ -260,7 +313,12 @@ namespace OpenSim.Region.Environment.Scenes
260 public SceneObjectGroup ParentGroup 313 public SceneObjectGroup ParentGroup
261 { 314 {
262 get { return m_parentGroup; } 315 get { return m_parentGroup; }
263 316 }
317
318 public byte UpdateFlag
319 {
320 get { return m_updateFlag; }
321 set { m_updateFlag = value; }
264 } 322 }
265 323
266 #region Constructors 324 #region Constructors
@@ -502,6 +560,7 @@ namespace OpenSim.Region.Environment.Scenes
502 { 560 {
503 AddTerseUpdateToAllAvatars(); 561 AddTerseUpdateToAllAvatars();
504 ClearUpdateSchedule(); 562 ClearUpdateSchedule();
563 ScheduleTerseUpdate();
505 } 564 }
506 else 565 else
507 { 566 {
@@ -706,6 +765,10 @@ namespace OpenSim.Region.Environment.Scenes
706 new Quaternion(RotationOffset.W, RotationOffset.X, 765 new Quaternion(RotationOffset.W, RotationOffset.X,
707 RotationOffset.Y, RotationOffset.Z), UsePhysics); 766 RotationOffset.Y, RotationOffset.Z), UsePhysics);
708 } 767 }
768 else
769 {
770 PhysActor.IsPhysical = UsePhysics;
771 }
709 } 772 }
710 773
711 if (IsTemporary) 774 if (IsTemporary)