aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs93
1 files changed, 81 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b6d5c4b..825f2a3 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
@@ -1302,14 +1304,66 @@ namespace OpenSim.Region.Framework.Scenes
1302 1304
1303 public float Buoyancy 1305 public float Buoyancy
1304 { 1306 {
1305 get { return m_buoyancy; } 1307 get
1308 {
1309 if (ParentID != 0 && ParentGroup != null)
1310 m_buoyancy = ParentGroup.RootPart.Buoyancy;
1311 return m_buoyancy;
1312 }
1306 set 1313 set
1307 { 1314 {
1308 m_buoyancy = value; 1315 m_buoyancy = value;
1309 if (PhysActor != null) 1316 if (ParentID != 0)
1310 { 1317 {
1318 if (ParentGroup != null)
1319 ParentGroup.RootPart.Buoyancy = value;
1320 }
1321 else if (PhysActor != null)
1311 PhysActor.Buoyancy = value; 1322 PhysActor.Buoyancy = value;
1323 }
1324 }
1325
1326 public Vector3 Force
1327 {
1328 get
1329 {
1330 if (ParentID != 0 && ParentGroup != null)
1331 m_force = ParentGroup.RootPart.Force;
1332 return m_force;
1333 }
1334
1335 set
1336 {
1337 m_force = value;
1338 if (ParentID != 0)
1339 {
1340 if (ParentGroup != null)
1341 ParentGroup.RootPart.Force = value;
1312 } 1342 }
1343 else if (PhysActor != null)
1344 PhysActor.Force = value;
1345 }
1346 }
1347
1348 public Vector3 Torque
1349 {
1350 get
1351 {
1352 if (ParentID != 0 && ParentGroup != null)
1353 m_torque = ParentGroup.RootPart.Torque;
1354 return m_torque;
1355 }
1356
1357 set
1358 {
1359 m_torque = value;
1360 if (ParentID != 0)
1361 {
1362 if (ParentGroup != null)
1363 ParentGroup.RootPart.Torque = value;
1364 }
1365 else if (PhysActor != null)
1366 PhysActor.Torque = value;
1313 } 1367 }
1314 } 1368 }
1315 1369
@@ -1488,20 +1542,24 @@ namespace OpenSim.Region.Framework.Scenes
1488 /// </summary> 1542 /// </summary>
1489 /// <param name="impulsei">Vector force</param> 1543 /// <param name="impulsei">Vector force</param>
1490 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> 1544 /// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
1491 public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF) 1545
1546 // this is actualy Set Torque.. keeping naming so not to edit lslapi also
1547 public void SetAngularImpulse(Vector3 torquei, bool localGlobalTF)
1492 { 1548 {
1493 Vector3 impulse = impulsei; 1549 Vector3 torque = torquei;
1494 1550
1495 if (localGlobalTF) 1551 if (localGlobalTF)
1496 { 1552 {
1553/*
1497 Quaternion grot = GetWorldRotation(); 1554 Quaternion grot = GetWorldRotation();
1498 Quaternion AXgrot = grot; 1555 Quaternion AXgrot = grot;
1499 Vector3 AXimpulsei = impulsei; 1556 Vector3 AXimpulsei = impulsei;
1500 Vector3 newimpulse = AXimpulsei * AXgrot; 1557 Vector3 newimpulse = AXimpulsei * AXgrot;
1501 impulse = newimpulse; 1558 */
1559 torque *= GetWorldRotation();
1502 } 1560 }
1503 1561
1504 ParentGroup.setAngularImpulse(impulse); 1562 Torque = torque;
1505 } 1563 }
1506 1564
1507 /// <summary> 1565 /// <summary>
@@ -1571,14 +1629,22 @@ namespace OpenSim.Region.Framework.Scenes
1571 1629
1572 DoPhysicsPropertyUpdate(RigidBody, true); 1630 DoPhysicsPropertyUpdate(RigidBody, true);
1573 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1631 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1632
1633 if (!building)
1634 PhysActor.Building = false;
1574 1635
1575 Velocity = velocity; 1636 Velocity = velocity;
1576 AngularVelocity = rotationalVelocity; 1637 AngularVelocity = rotationalVelocity;
1577 PhysActor.Velocity = velocity; 1638 PhysActor.Velocity = velocity;
1578 PhysActor.RotationalVelocity = rotationalVelocity; 1639 PhysActor.RotationalVelocity = rotationalVelocity;
1579 1640
1580 if (!building) 1641 // if not vehicle and root part apply force and torque
1581 PhysActor.Building = false; 1642 if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE)
1643 && LocalId == ParentGroup.RootPart.LocalId)
1644 {
1645 PhysActor.Force = Force;
1646 PhysActor.Torque = Torque;
1647 }
1582 } 1648 }
1583 } 1649 }
1584 } 1650 }
@@ -2005,10 +2071,7 @@ namespace OpenSim.Region.Framework.Scenes
2005 2071
2006 public Vector3 GetForce() 2072 public Vector3 GetForce()
2007 { 2073 {
2008 if (PhysActor != null) 2074 return Force;
2009 return PhysActor.Force;
2010 else
2011 return Vector3.Zero;
2012 } 2075 }
2013 2076
2014 /// <summary> 2077 /// <summary>
@@ -3153,10 +3216,13 @@ namespace OpenSim.Region.Framework.Scenes
3153 3216
3154 public void SetBuoyancy(float fvalue) 3217 public void SetBuoyancy(float fvalue)
3155 { 3218 {
3219 Buoyancy = fvalue;
3220/*
3156 if (PhysActor != null) 3221 if (PhysActor != null)
3157 { 3222 {
3158 PhysActor.Buoyancy = fvalue; 3223 PhysActor.Buoyancy = fvalue;
3159 } 3224 }
3225 */
3160 } 3226 }
3161 3227
3162 public void SetDieAtEdge(bool p) 3228 public void SetDieAtEdge(bool p)
@@ -3184,10 +3250,13 @@ namespace OpenSim.Region.Framework.Scenes
3184 3250
3185 public void SetForce(Vector3 force) 3251 public void SetForce(Vector3 force)
3186 { 3252 {
3253 Force = force;
3254/*
3187 if (PhysActor != null) 3255 if (PhysActor != null)
3188 { 3256 {
3189 PhysActor.Force = force; 3257 PhysActor.Force = force;
3190 } 3258 }
3259 */
3191 } 3260 }
3192 3261
3193 public SOPVehicle sopVehicle 3262 public SOPVehicle sopVehicle