aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorMelanie2012-03-04 16:23:46 +0000
committerMelanie2012-03-04 16:23:46 +0000
commit182f5efbe94881c22af82bc71566c49dd02ed8f8 (patch)
tree2b26c2657cfb91464008d8e305566500bc3cdd9e /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentMerge branch 'master' into careminster (diff)
parentZero velocity when drag-copying (diff)
downloadopensim-SC-182f5efbe94881c22af82bc71566c49dd02ed8f8.zip
opensim-SC-182f5efbe94881c22af82bc71566c49dd02ed8f8.tar.gz
opensim-SC-182f5efbe94881c22af82bc71566c49dd02ed8f8.tar.bz2
opensim-SC-182f5efbe94881c22af82bc71566c49dd02ed8f8.tar.xz
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs115
1 files changed, 100 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index dd9431b..1c72b10 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -294,6 +294,8 @@ namespace OpenSim.Region.Framework.Scenes
294 protected Vector3 m_lastAngularVelocity; 294 protected Vector3 m_lastAngularVelocity;
295 protected int m_lastTerseSent; 295 protected int m_lastTerseSent;
296 protected float m_buoyancy = 0.0f; 296 protected float m_buoyancy = 0.0f;
297 protected Vector3 m_force;
298 protected Vector3 m_torque;
297 299
298 /// <summary> 300 /// <summary>
299 /// Stores media texture data 301 /// Stores media texture data
@@ -313,6 +315,14 @@ namespace OpenSim.Region.Framework.Scenes
313 315
314 private SOPVehicle m_vehicle = null; 316 private SOPVehicle m_vehicle = null;
315 317
318 private KeyframeMotion m_keyframeMotion = null;
319
320 public KeyframeMotion KeyframeMotion
321 {
322 get; set;
323 }
324
325
316 #endregion Fields 326 #endregion Fields
317 327
318// ~SceneObjectPart() 328// ~SceneObjectPart()
@@ -906,7 +916,7 @@ namespace OpenSim.Region.Framework.Scenes
906 get 916 get
907 { 917 {
908 PhysicsActor actor = PhysActor; 918 PhysicsActor actor = PhysActor;
909 if ((actor != null) && actor.IsPhysical) 919 if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this)
910 { 920 {
911 m_angularVelocity = actor.RotationalVelocity; 921 m_angularVelocity = actor.RotationalVelocity;
912 } 922 }
@@ -1302,14 +1312,69 @@ namespace OpenSim.Region.Framework.Scenes
1302 1312
1303 public float Buoyancy 1313 public float Buoyancy
1304 { 1314 {
1305 get { return m_buoyancy; } 1315 get
1316 {
1317 if (ParentGroup.RootPart == this)
1318 return m_buoyancy;
1319
1320 return ParentGroup.RootPart.Buoyancy;
1321 }
1306 set 1322 set
1307 { 1323 {
1324 if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this)
1325 {
1326 ParentGroup.RootPart.Buoyancy = value;
1327 return;
1328 }
1308 m_buoyancy = value; 1329 m_buoyancy = value;
1309 if (PhysActor != null) 1330 if (PhysActor != null)
1310 {
1311 PhysActor.Buoyancy = value; 1331 PhysActor.Buoyancy = value;
1332 }
1333 }
1334
1335 public Vector3 Force
1336 {
1337 get
1338 {
1339 if (ParentGroup.RootPart == this)
1340 return m_force;
1341
1342 return ParentGroup.RootPart.Force;
1343 }
1344
1345 set
1346 {
1347 if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this)
1348 {
1349 ParentGroup.RootPart.Force = value;
1350 return;
1351 }
1352 m_force = value;
1353 if (PhysActor != null)
1354 PhysActor.Force = value;
1355 }
1356 }
1357
1358 public Vector3 Torque
1359 {
1360 get
1361 {
1362 if (ParentGroup.RootPart == this)
1363 return m_torque;
1364
1365 return ParentGroup.RootPart.Torque;
1366 }
1367
1368 set
1369 {
1370 if (ParentGroup != null && ParentGroup.RootPart != null && ParentGroup.RootPart != this)
1371 {
1372 ParentGroup.RootPart.Torque = value;
1373 return;
1312 } 1374 }
1375 m_torque = value;
1376 if (PhysActor != null)
1377 PhysActor.Torque = value;
1313 } 1378 }
1314 } 1379 }
1315 1380
@@ -1488,20 +1553,24 @@ namespace OpenSim.Region.Framework.Scenes
1488 /// </summary> 1553 /// </summary>
1489 /// <param name="impulsei">Vector force</param> 1554 /// <param name="impulsei">Vector force</param>
1490 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> 1555 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
1491 public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF) 1556
1557 // this is actualy Set Torque.. keeping naming so not to edit lslapi also
1558 public void SetAngularImpulse(Vector3 torquei, bool localGlobalTF)
1492 { 1559 {
1493 Vector3 impulse = impulsei; 1560 Vector3 torque = torquei;
1494 1561
1495 if (localGlobalTF) 1562 if (localGlobalTF)
1496 { 1563 {
1564/*
1497 Quaternion grot = GetWorldRotation(); 1565 Quaternion grot = GetWorldRotation();
1498 Quaternion AXgrot = grot; 1566 Quaternion AXgrot = grot;
1499 Vector3 AXimpulsei = impulsei; 1567 Vector3 AXimpulsei = impulsei;
1500 Vector3 newimpulse = AXimpulsei * AXgrot; 1568 Vector3 newimpulse = AXimpulsei * AXgrot;
1501 impulse = newimpulse; 1569 */
1570 torque *= GetWorldRotation();
1502 } 1571 }
1503 1572
1504 ParentGroup.setAngularImpulse(impulse); 1573 Torque = torque;
1505 } 1574 }
1506 1575
1507 /// <summary> 1576 /// <summary>
@@ -1571,14 +1640,22 @@ namespace OpenSim.Region.Framework.Scenes
1571 1640
1572 DoPhysicsPropertyUpdate(RigidBody, true); 1641 DoPhysicsPropertyUpdate(RigidBody, true);
1573 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1642 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1643
1644 if (!building)
1645 PhysActor.Building = false;
1574 1646
1575 Velocity = velocity; 1647 Velocity = velocity;
1576 AngularVelocity = rotationalVelocity; 1648 AngularVelocity = rotationalVelocity;
1577 PhysActor.Velocity = velocity; 1649 PhysActor.Velocity = velocity;
1578 PhysActor.RotationalVelocity = rotationalVelocity; 1650 PhysActor.RotationalVelocity = rotationalVelocity;
1579 1651
1580 if (!building) 1652 // if not vehicle and root part apply force and torque
1581 PhysActor.Building = false; 1653 if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE)
1654 && LocalId == ParentGroup.RootPart.LocalId)
1655 {
1656 PhysActor.Force = Force;
1657 PhysActor.Torque = Torque;
1658 }
1582 } 1659 }
1583 } 1660 }
1584 } 1661 }
@@ -1816,7 +1893,8 @@ namespace OpenSim.Region.Framework.Scenes
1816 1893
1817 Velocity = new Vector3(0, 0, 0); 1894 Velocity = new Vector3(0, 0, 0);
1818 Acceleration = new Vector3(0, 0, 0); 1895 Acceleration = new Vector3(0, 0, 0);
1819 AngularVelocity = new Vector3(0, 0, 0); 1896 if (ParentGroup.RootPart == this)
1897 AngularVelocity = new Vector3(0, 0, 0);
1820 1898
1821 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; 1899 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
1822 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; 1900 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
@@ -1840,7 +1918,8 @@ namespace OpenSim.Region.Framework.Scenes
1840 // velocity-vector. 1918 // velocity-vector.
1841 Velocity = new Vector3(0, 0, 0); 1919 Velocity = new Vector3(0, 0, 0);
1842 Acceleration = new Vector3(0, 0, 0); 1920 Acceleration = new Vector3(0, 0, 0);
1843 AngularVelocity = new Vector3(0, 0, 0); 1921 if (ParentGroup.RootPart == this)
1922 AngularVelocity = new Vector3(0, 0, 0);
1844 //RotationalVelocity = new Vector3(0, 0, 0); 1923 //RotationalVelocity = new Vector3(0, 0, 0);
1845 } 1924 }
1846 1925
@@ -1855,6 +1934,9 @@ namespace OpenSim.Region.Framework.Scenes
1855 { 1934 {
1856 if (UsePhysics) 1935 if (UsePhysics)
1857 { 1936 {
1937 if (ParentGroup.RootPart.KeyframeMotion != null)
1938 ParentGroup.RootPart.KeyframeMotion.Stop();
1939 ParentGroup.RootPart.KeyframeMotion = null;
1858 ParentGroup.Scene.AddPhysicalPrim(1); 1940 ParentGroup.Scene.AddPhysicalPrim(1);
1859 1941
1860 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 1942 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
@@ -2002,10 +2084,7 @@ namespace OpenSim.Region.Framework.Scenes
2002 2084
2003 public Vector3 GetForce() 2085 public Vector3 GetForce()
2004 { 2086 {
2005 if (PhysActor != null) 2087 return Force;
2006 return PhysActor.Force;
2007 else
2008 return Vector3.Zero;
2009 } 2088 }
2010 2089
2011 /// <summary> 2090 /// <summary>
@@ -3150,10 +3229,13 @@ namespace OpenSim.Region.Framework.Scenes
3150 3229
3151 public void SetBuoyancy(float fvalue) 3230 public void SetBuoyancy(float fvalue)
3152 { 3231 {
3232 Buoyancy = fvalue;
3233/*
3153 if (PhysActor != null) 3234 if (PhysActor != null)
3154 { 3235 {
3155 PhysActor.Buoyancy = fvalue; 3236 PhysActor.Buoyancy = fvalue;
3156 } 3237 }
3238 */
3157 } 3239 }
3158 3240
3159 public void SetDieAtEdge(bool p) 3241 public void SetDieAtEdge(bool p)
@@ -3181,10 +3263,13 @@ namespace OpenSim.Region.Framework.Scenes
3181 3263
3182 public void SetForce(Vector3 force) 3264 public void SetForce(Vector3 force)
3183 { 3265 {
3266 Force = force;
3267/*
3184 if (PhysActor != null) 3268 if (PhysActor != null)
3185 { 3269 {
3186 PhysActor.Force = force; 3270 PhysActor.Force = force;
3187 } 3271 }
3272 */
3188 } 3273 }
3189 3274
3190 public SOPVehicle sopVehicle 3275 public SOPVehicle sopVehicle