aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs79
1 files changed, 57 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 1f1caca..2410970 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -353,7 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
353 private int LastColSoundSentTime; 353 private int LastColSoundSentTime;
354 354
355 355
356 private SOPVehicle m_vehicle = null; 356 private SOPVehicle m_vehicleParams = null;
357 357
358 private KeyframeMotion m_keyframeMotion = null; 358 private KeyframeMotion m_keyframeMotion = null;
359 359
@@ -973,7 +973,15 @@ namespace OpenSim.Region.Framework.Scenes
973 } 973 }
974 return m_angularVelocity; 974 return m_angularVelocity;
975 } 975 }
976 set { m_angularVelocity = value; } 976 set
977 {
978 m_angularVelocity = value;
979 PhysicsActor actor = PhysActor;
980 if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE)
981 {
982 actor.RotationalVelocity = m_angularVelocity;
983 }
984 }
977 } 985 }
978 986
979 /// <summary></summary> 987 /// <summary></summary>
@@ -1877,7 +1885,7 @@ namespace OpenSim.Region.Framework.Scenes
1877 } 1885 }
1878 } 1886 }
1879 1887
1880// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future 1888 // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future
1881 public void SetVelocity(Vector3 pVel, bool localGlobalTF) 1889 public void SetVelocity(Vector3 pVel, bool localGlobalTF)
1882 { 1890 {
1883 if (ParentGroup == null || ParentGroup.IsDeleted) 1891 if (ParentGroup == null || ParentGroup.IsDeleted)
@@ -1903,6 +1911,33 @@ namespace OpenSim.Region.Framework.Scenes
1903 1911
1904 ParentGroup.Velocity = pVel; 1912 ParentGroup.Velocity = pVel;
1905 } 1913 }
1914
1915 // SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future
1916 public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF)
1917 {
1918 if (ParentGroup == null || ParentGroup.IsDeleted)
1919 return;
1920
1921 if (ParentGroup.IsAttachment)
1922 return; // don't work on attachments (for now ??)
1923
1924 SceneObjectPart root = ParentGroup.RootPart;
1925
1926 if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles
1927 return;
1928
1929 PhysicsActor pa = root.PhysActor;
1930
1931 if (pa == null || !pa.IsPhysical)
1932 return;
1933
1934 if (localGlobalTF)
1935 {
1936 pAngVel = pAngVel * GetWorldRotation();
1937 }
1938
1939 root.AngularVelocity = pAngVel;
1940 }
1906 1941
1907 1942
1908 /// <summary> 1943 /// <summary>
@@ -3415,15 +3450,15 @@ namespace OpenSim.Region.Framework.Scenes
3415 Force = force; 3450 Force = force;
3416 } 3451 }
3417 3452
3418 public SOPVehicle sopVehicle 3453 public SOPVehicle VehicleParams
3419 { 3454 {
3420 get 3455 get
3421 { 3456 {
3422 return m_vehicle; 3457 return m_vehicleParams;
3423 } 3458 }
3424 set 3459 set
3425 { 3460 {
3426 m_vehicle = value; 3461 m_vehicleParams = value;
3427 } 3462 }
3428 } 3463 }
3429 3464
@@ -3432,10 +3467,10 @@ namespace OpenSim.Region.Framework.Scenes
3432 { 3467 {
3433 get 3468 get
3434 { 3469 {
3435 if (m_vehicle == null) 3470 if (m_vehicleParams == null)
3436 return (int)Vehicle.TYPE_NONE; 3471 return (int)Vehicle.TYPE_NONE;
3437 else 3472 else
3438 return (int)m_vehicle.Type; 3473 return (int)m_vehicleParams.Type;
3439 } 3474 }
3440 set 3475 set
3441 { 3476 {
@@ -3445,7 +3480,7 @@ namespace OpenSim.Region.Framework.Scenes
3445 3480
3446 public void SetVehicleType(int type) 3481 public void SetVehicleType(int type)
3447 { 3482 {
3448 m_vehicle = null; 3483 m_vehicleParams = null;
3449 3484
3450 if (type == (int)Vehicle.TYPE_NONE) 3485 if (type == (int)Vehicle.TYPE_NONE)
3451 { 3486 {
@@ -3453,8 +3488,8 @@ namespace OpenSim.Region.Framework.Scenes
3453 PhysActor.VehicleType = (int)Vehicle.TYPE_NONE; 3488 PhysActor.VehicleType = (int)Vehicle.TYPE_NONE;
3454 return; 3489 return;
3455 } 3490 }
3456 m_vehicle = new SOPVehicle(); 3491 m_vehicleParams = new SOPVehicle();
3457 m_vehicle.ProcessTypeChange((Vehicle)type); 3492 m_vehicleParams.ProcessTypeChange((Vehicle)type);
3458 { 3493 {
3459 if (_parentID ==0 && PhysActor != null) 3494 if (_parentID ==0 && PhysActor != null)
3460 PhysActor.VehicleType = type; 3495 PhysActor.VehicleType = type;
@@ -3464,10 +3499,10 @@ namespace OpenSim.Region.Framework.Scenes
3464 3499
3465 public void SetVehicleFlags(int param, bool remove) 3500 public void SetVehicleFlags(int param, bool remove)
3466 { 3501 {
3467 if (m_vehicle == null) 3502 if (m_vehicleParams == null)
3468 return; 3503 return;
3469 3504
3470 m_vehicle.ProcessVehicleFlags(param, remove); 3505 m_vehicleParams.ProcessVehicleFlags(param, remove);
3471 3506
3472 if (_parentID ==0 && PhysActor != null) 3507 if (_parentID ==0 && PhysActor != null)
3473 { 3508 {
@@ -3477,10 +3512,10 @@ namespace OpenSim.Region.Framework.Scenes
3477 3512
3478 public void SetVehicleFloatParam(int param, float value) 3513 public void SetVehicleFloatParam(int param, float value)
3479 { 3514 {
3480 if (m_vehicle == null) 3515 if (m_vehicleParams == null)
3481 return; 3516 return;
3482 3517
3483 m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value); 3518 m_vehicleParams.ProcessFloatVehicleParam((Vehicle)param, value);
3484 3519
3485 if (_parentID == 0 && PhysActor != null) 3520 if (_parentID == 0 && PhysActor != null)
3486 { 3521 {
@@ -3490,10 +3525,10 @@ namespace OpenSim.Region.Framework.Scenes
3490 3525
3491 public void SetVehicleVectorParam(int param, Vector3 value) 3526 public void SetVehicleVectorParam(int param, Vector3 value)
3492 { 3527 {
3493 if (m_vehicle == null) 3528 if (m_vehicleParams == null)
3494 return; 3529 return;
3495 3530
3496 m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value); 3531 m_vehicleParams.ProcessVectorVehicleParam((Vehicle)param, value);
3497 3532
3498 if (_parentID == 0 && PhysActor != null) 3533 if (_parentID == 0 && PhysActor != null)
3499 { 3534 {
@@ -3503,10 +3538,10 @@ namespace OpenSim.Region.Framework.Scenes
3503 3538
3504 public void SetVehicleRotationParam(int param, Quaternion rotation) 3539 public void SetVehicleRotationParam(int param, Quaternion rotation)
3505 { 3540 {
3506 if (m_vehicle == null) 3541 if (m_vehicleParams == null)
3507 return; 3542 return;
3508 3543
3509 m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); 3544 m_vehicleParams.ProcessRotationVehicleParam((Vehicle)param, rotation);
3510 3545
3511 if (_parentID == 0 && PhysActor != null) 3546 if (_parentID == 0 && PhysActor != null)
3512 { 3547 {
@@ -4673,8 +4708,8 @@ namespace OpenSim.Region.Framework.Scenes
4673 if (VolumeDetectActive) // change if not the default only 4708 if (VolumeDetectActive) // change if not the default only
4674 pa.SetVolumeDetect(1); 4709 pa.SetVolumeDetect(1);
4675 4710
4676 if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) 4711 if (m_vehicleParams != null && LocalId == ParentGroup.RootPart.LocalId)
4677 m_vehicle.SetVehicle(pa); 4712 m_vehicleParams.SetVehicle(pa);
4678 4713
4679 // we are going to tell rest of code about physics so better have this here 4714 // we are going to tell rest of code about physics so better have this here
4680 PhysActor = pa; 4715 PhysActor = pa;
@@ -4712,7 +4747,7 @@ namespace OpenSim.Region.Framework.Scenes
4712 pa.RotationalVelocity = rotationalVelocity; 4747 pa.RotationalVelocity = rotationalVelocity;
4713 4748
4714 // if not vehicle and root part apply force and torque 4749 // if not vehicle and root part apply force and torque
4715 if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE) 4750 if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE)
4716 && LocalId == ParentGroup.RootPart.LocalId) 4751 && LocalId == ParentGroup.RootPart.LocalId)
4717 { 4752 {
4718 pa.Force = Force; 4753 pa.Force = Force;