aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorMelanie2012-02-19 20:08:01 +0100
committerMelanie2012-02-19 20:08:01 +0100
commit96409cc2eeb4555609f72c8bc61fbdf4ac3e9933 (patch)
tree394a7a07ff913c8efa390399c190d5c65bf8f95b /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentMerge branch 'master' of ssh://3dhosting.de/var/git/careminster (diff)
parent moved vehicle from SOG to SOP (diff)
downloadopensim-SC-96409cc2eeb4555609f72c8bc61fbdf4ac3e9933.zip
opensim-SC-96409cc2eeb4555609f72c8bc61fbdf4ac3e9933.tar.gz
opensim-SC-96409cc2eeb4555609f72c8bc61fbdf4ac3e9933.tar.bz2
opensim-SC-96409cc2eeb4555609f72c8bc61fbdf4ac3e9933.tar.xz
Merge branch 'ubitwork'
Conflicts: OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs109
1 files changed, 93 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index d6d04b2..de1dd8c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -310,6 +310,9 @@ namespace OpenSim.Region.Framework.Scenes
310 private UUID m_collisionSound; 310 private UUID m_collisionSound;
311 private float m_collisionSoundVolume; 311 private float m_collisionSoundVolume;
312 312
313
314 private SOPVehicle m_vehicle = null;
315
313 #endregion Fields 316 #endregion Fields
314 317
315// ~SceneObjectPart() 318// ~SceneObjectPart()
@@ -1506,7 +1509,8 @@ namespace OpenSim.Region.Framework.Scenes
1506 /// </summary> 1509 /// </summary>
1507 /// <param name="rootObjectFlags"></param> 1510 /// <param name="rootObjectFlags"></param>
1508 /// <param name="VolumeDetectActive"></param> 1511 /// <param name="VolumeDetectActive"></param>
1509 public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) 1512// public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive)
1513 public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive, bool building)
1510 { 1514 {
1511 if (!ParentGroup.Scene.CollidablePrims) 1515 if (!ParentGroup.Scene.CollidablePrims)
1512 return; 1516 return;
@@ -1542,7 +1546,8 @@ namespace OpenSim.Region.Framework.Scenes
1542 Shape, 1546 Shape,
1543 AbsolutePosition, 1547 AbsolutePosition,
1544 Scale, 1548 Scale,
1545 RotationOffset, 1549// RotationOffset,
1550 GetWorldRotation(), // physics wants world rotation
1546 RigidBody, 1551 RigidBody,
1547 m_localId); 1552 m_localId);
1548 } 1553 }
@@ -1557,8 +1562,16 @@ namespace OpenSim.Region.Framework.Scenes
1557 { 1562 {
1558 PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info 1563 PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
1559 PhysActor.SetMaterial(Material); 1564 PhysActor.SetMaterial(Material);
1565
1566 // if root part apply vehicle
1567 if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId)
1568 m_vehicle.SetVehicle(PhysActor);
1569
1560 DoPhysicsPropertyUpdate(RigidBody, true); 1570 DoPhysicsPropertyUpdate(RigidBody, true);
1561 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1571 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1572
1573 if (!building)
1574 PhysActor.Building = false;
1562 } 1575 }
1563 } 1576 }
1564 } 1577 }
@@ -1794,6 +1807,10 @@ namespace OpenSim.Region.Framework.Scenes
1794 if (!isNew) 1807 if (!isNew)
1795 ParentGroup.Scene.RemovePhysicalPrim(1); 1808 ParentGroup.Scene.RemovePhysicalPrim(1);
1796 1809
1810 Velocity = new Vector3(0, 0, 0);
1811 Acceleration = new Vector3(0, 0, 0);
1812 AngularVelocity = new Vector3(0, 0, 0);
1813
1797 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; 1814 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
1798 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; 1815 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
1799 PhysActor.delink(); 1816 PhysActor.delink();
@@ -3163,17 +3180,61 @@ namespace OpenSim.Region.Framework.Scenes
3163 } 3180 }
3164 } 3181 }
3165 3182
3183
3184 public int VehicleType
3185 {
3186 get
3187 {
3188 if (m_vehicle == null)
3189 return (int)Vehicle.TYPE_NONE;
3190 else
3191 return (int)m_vehicle.Type;
3192 }
3193 set
3194 {
3195 SetVehicleType(value);
3196 }
3197 }
3198
3166 public void SetVehicleType(int type) 3199 public void SetVehicleType(int type)
3167 { 3200 {
3168 if (PhysActor != null) 3201 m_vehicle = null;
3202 if (type == (int)Vehicle.TYPE_NONE)
3203 {
3204 if (_parentID ==0 && PhysActor != null)
3205 PhysActor.VehicleType = (int)Vehicle.TYPE_NONE;
3206 return;
3207 }
3208 m_vehicle = new SOPVehicle();
3209 m_vehicle.ProcessTypeChange((Vehicle)type);
3210 {
3211 if (_parentID ==0 && PhysActor != null)
3212 PhysActor.VehicleType = type;
3213 return;
3214 }
3215 }
3216
3217 public void SetVehicleFlags(int param, bool remove)
3218 {
3219 if (m_vehicle == null)
3220 return;
3221
3222 m_vehicle.ProcessVehicleFlags(param, remove);
3223
3224 if (_parentID ==0 && PhysActor != null)
3169 { 3225 {
3170 PhysActor.VehicleType = type; 3226 PhysActor.VehicleFlags(param, remove);
3171 } 3227 }
3172 } 3228 }
3173 3229
3174 public void SetVehicleFloatParam(int param, float value) 3230 public void SetVehicleFloatParam(int param, float value)
3175 { 3231 {
3176 if (PhysActor != null) 3232 if (m_vehicle == null)
3233 return;
3234
3235 m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value);
3236
3237 if (_parentID == 0 && PhysActor != null)
3177 { 3238 {
3178 PhysActor.VehicleFloatParam(param, value); 3239 PhysActor.VehicleFloatParam(param, value);
3179 } 3240 }
@@ -3181,7 +3242,12 @@ namespace OpenSim.Region.Framework.Scenes
3181 3242
3182 public void SetVehicleVectorParam(int param, Vector3 value) 3243 public void SetVehicleVectorParam(int param, Vector3 value)
3183 { 3244 {
3184 if (PhysActor != null) 3245 if (m_vehicle == null)
3246 return;
3247
3248 m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value);
3249
3250 if (_parentID == 0 && PhysActor != null)
3185 { 3251 {
3186 PhysActor.VehicleVectorParam(param, value); 3252 PhysActor.VehicleVectorParam(param, value);
3187 } 3253 }
@@ -3189,7 +3255,12 @@ namespace OpenSim.Region.Framework.Scenes
3189 3255
3190 public void SetVehicleRotationParam(int param, Quaternion rotation) 3256 public void SetVehicleRotationParam(int param, Quaternion rotation)
3191 { 3257 {
3192 if (PhysActor != null) 3258 if (m_vehicle == null)
3259 return;
3260
3261 m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation);
3262
3263 if (_parentID == 0 && PhysActor != null)
3193 { 3264 {
3194 PhysActor.VehicleRotationParam(param, rotation); 3265 PhysActor.VehicleRotationParam(param, rotation);
3195 } 3266 }
@@ -3376,13 +3447,6 @@ namespace OpenSim.Region.Framework.Scenes
3376 hasProfileCut = hasDimple; // is it the same thing? 3447 hasProfileCut = hasDimple; // is it the same thing?
3377 } 3448 }
3378 3449
3379 public void SetVehicleFlags(int param, bool remove)
3380 {
3381 if (PhysActor != null)
3382 {
3383 PhysActor.VehicleFlags(param, remove);
3384 }
3385 }
3386 3450
3387 public void SetGroup(UUID groupID, IClientAPI client) 3451 public void SetGroup(UUID groupID, IClientAPI client)
3388 { 3452 {
@@ -4270,7 +4334,8 @@ namespace OpenSim.Region.Framework.Scenes
4270 /// <param name="SetTemporary"></param> 4334 /// <param name="SetTemporary"></param>
4271 /// <param name="SetPhantom"></param> 4335 /// <param name="SetPhantom"></param>
4272 /// <param name="SetVD"></param> 4336 /// <param name="SetVD"></param>
4273 public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) 4337// public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD)
4338 public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD, bool building)
4274 { 4339 {
4275 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); 4340 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0);
4276 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); 4341 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0);
@@ -4288,6 +4353,9 @@ namespace OpenSim.Region.Framework.Scenes
4288 // that... 4353 // that...
4289 // ... if VD is changed, all others are not. 4354 // ... if VD is changed, all others are not.
4290 // ... if one of the others is changed, VD is not. 4355 // ... if one of the others is changed, VD is not.
4356 // do this first
4357 if (building && PhysActor != null && PhysActor.Building != building)
4358 PhysActor.Building = building;
4291 if (SetVD) // VD is active, special logic applies 4359 if (SetVD) // VD is active, special logic applies
4292 { 4360 {
4293 // State machine logic for VolumeDetect 4361 // State machine logic for VolumeDetect
@@ -4369,11 +4437,17 @@ namespace OpenSim.Region.Framework.Scenes
4369 Shape, 4437 Shape,
4370 AbsolutePosition, 4438 AbsolutePosition,
4371 Scale, 4439 Scale,
4372 RotationOffset, 4440// RotationOffset,
4441 GetWorldRotation(), //physics wants world rotation like all other functions send
4373 UsePhysics, 4442 UsePhysics,
4374 m_localId); 4443 m_localId);
4375 4444
4376 PhysActor.SetMaterial(Material); 4445 PhysActor.SetMaterial(Material);
4446
4447 // if root part apply vehicle
4448 if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId)
4449 m_vehicle.SetVehicle(PhysActor);
4450
4377 DoPhysicsPropertyUpdate(UsePhysics, true); 4451 DoPhysicsPropertyUpdate(UsePhysics, true);
4378 4452
4379 if (!ParentGroup.IsDeleted) 4453 if (!ParentGroup.IsDeleted)
@@ -4449,6 +4523,9 @@ namespace OpenSim.Region.Framework.Scenes
4449 } 4523 }
4450 // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); 4524 // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
4451 4525
4526 // and last in case we have a new actor and not building
4527 if (PhysActor != null && PhysActor.Building != building)
4528 PhysActor.Building = building;
4452 if (ParentGroup != null) 4529 if (ParentGroup != null)
4453 { 4530 {
4454 ParentGroup.HasGroupChanged = true; 4531 ParentGroup.HasGroupChanged = true;