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.cs152
1 files changed, 133 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f647544..a68b3eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -295,7 +295,13 @@ namespace OpenSim.Region.Framework.Scenes
295 protected float m_buoyancy = 0.0f; 295 protected float m_buoyancy = 0.0f;
296 protected Vector3 m_force; 296 protected Vector3 m_force;
297 protected Vector3 m_torque; 297 protected Vector3 m_torque;
298 298
299 protected byte m_physicsShapeType = (byte)PhysShapeType.prim;
300 protected float m_density = 1000.0f; // in kg/m^3
301 protected float m_gravitymod = 1.0f;
302 protected float m_friction = 0.6f; // wood
303 protected float m_bounce = 0.5f; // wood
304
299 /// <summary> 305 /// <summary>
300 /// Stores media texture data 306 /// Stores media texture data
301 /// </summary> 307 /// </summary>
@@ -556,19 +562,6 @@ namespace OpenSim.Region.Framework.Scenes
556 } 562 }
557 } 563 }
558 564
559 public byte Material
560 {
561 get { return (byte) m_material; }
562 set
563 {
564 m_material = (Material)value;
565 if (PhysActor != null)
566 {
567 PhysActor.SetMaterial((int)value);
568 }
569 }
570 }
571
572 public bool PassTouches 565 public bool PassTouches
573 { 566 {
574 get { return m_passTouches; } 567 get { return m_passTouches; }
@@ -1377,6 +1370,87 @@ namespace OpenSim.Region.Framework.Scenes
1377 } 1370 }
1378 } 1371 }
1379 1372
1373 public byte Material
1374 {
1375 get { return (byte)m_material; }
1376 set
1377 {
1378 if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial)
1379 {
1380 m_material = (Material)value;
1381 m_friction = SOPMaterialData.friction(m_material);
1382 m_bounce = SOPMaterialData.bounce(m_material);
1383 if (PhysActor != null)
1384 {
1385 PhysActor.SetMaterial((int)value);
1386 }
1387 }
1388 }
1389 }
1390
1391 public byte PhysicsShapeType
1392 {
1393 get { return m_physicsShapeType; }
1394 set
1395 {
1396 if (value < 0 || value >= (byte)PhysShapeType.convex)
1397 value = (byte)PhysShapeType.prim; //convex not supported ?
1398
1399 else if (value == (byte)PhysShapeType.none)
1400 {
1401 if (ParentGroup == null || ParentGroup.RootPart == this)
1402 value = (byte)PhysShapeType.prim;
1403 }
1404 m_physicsShapeType = value;
1405 }
1406 }
1407
1408 public float Density // in kg/m^3
1409 {
1410 get { return m_density; }
1411 set
1412 {
1413 if (value >=1 && value <= 22587.0)
1414 {
1415 m_density = value;
1416 }
1417 }
1418 }
1419
1420 public float GravityModifier
1421 {
1422 get { return m_gravitymod; }
1423 set
1424 { if( value >= -1 && value <=28.0f)
1425 m_gravitymod = value;
1426 }
1427 }
1428
1429 public float Friction
1430 {
1431 get { return m_friction; }
1432 set
1433 {
1434 if (value >= 0 && value <= 255.0f)
1435 {
1436 m_friction = value;
1437 }
1438 }
1439 }
1440
1441 public float Bounciness
1442 {
1443 get { return m_bounce; }
1444 set
1445 {
1446 if (value >= 0 && value <= 1.0f)
1447 {
1448 m_bounce = value;
1449 }
1450 }
1451 }
1452
1453
1380 #endregion Public Properties with only Get 1454 #endregion Public Properties with only Get
1381 1455
1382 private uint ApplyMask(uint val, bool set, uint mask) 1456 private uint ApplyMask(uint val, bool set, uint mask)
@@ -1583,9 +1657,13 @@ namespace OpenSim.Region.Framework.Scenes
1583 if (!ParentGroup.Scene.CollidablePrims) 1657 if (!ParentGroup.Scene.CollidablePrims)
1584 return; 1658 return;
1585 1659
1660 if (PhysicsShapeType == (byte)PhysShapeType.none)
1661 return;
1662
1586 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; 1663 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0;
1587 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; 1664 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0;
1588 1665
1666
1589 if (IsJoint()) 1667 if (IsJoint())
1590 { 1668 {
1591 DoPhysicsPropertyUpdate(isPhysical, true); 1669 DoPhysicsPropertyUpdate(isPhysical, true);
@@ -1942,6 +2020,7 @@ namespace OpenSim.Region.Framework.Scenes
1942 if (PhysActor.Phantom != phan) 2020 if (PhysActor.Phantom != phan)
1943 PhysActor.Phantom = phan; 2021 PhysActor.Phantom = phan;
1944 2022
2023
1945 // If this part is a sculpt then delay the physics update until we've asynchronously loaded the 2024 // If this part is a sculpt then delay the physics update until we've asynchronously loaded the
1946 // mesh data. 2025 // mesh data.
1947 if (Shape.SculptEntry) 2026 if (Shape.SculptEntry)
@@ -4334,6 +4413,41 @@ namespace OpenSim.Region.Framework.Scenes
4334 } 4413 }
4335 } 4414 }
4336 4415
4416
4417 public void UpdateExtraPhysics(ExtraPhysicsData physdata)
4418 {
4419 if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null)
4420 return;
4421
4422 if (PhysicsShapeType != (byte)physdata.PhysShapeType)
4423 {
4424 PhysicsShapeType = (byte)physdata.PhysShapeType;
4425
4426 if (PhysicsShapeType == (byte)PhysShapeType.none)
4427 {
4428 if (PhysActor != null)
4429 {
4430 Velocity = new Vector3(0, 0, 0);
4431 Acceleration = new Vector3(0, 0, 0);
4432 if (ParentGroup.RootPart == this)
4433 AngularVelocity = new Vector3(0, 0, 0);
4434 ParentGroup.Scene.RemovePhysicalPrim(1);
4435 RemoveFromPhysics();
4436 }
4437 }
4438 else if (PhysActor == null)
4439 ApplyPhysics((uint)Flags, VolumeDetectActive, false);
4440 }
4441
4442 if(Density != physdata.Density)
4443 Density = physdata.Density;
4444 if(GravityModifier != physdata.GravitationModifier)
4445 GravityModifier = physdata.GravitationModifier;
4446 if(Friction != physdata.Friction)
4447 Friction = physdata.Friction;
4448 if(Bounciness != physdata.Bounce)
4449 Bounciness = physdata.Bounce;
4450 }
4337 /// <summary> 4451 /// <summary>
4338 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. 4452 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary.
4339 /// </summary> 4453 /// </summary>
@@ -4362,9 +4476,10 @@ namespace OpenSim.Region.Framework.Scenes
4362 // ... if VD is changed, all others are not. 4476 // ... if VD is changed, all others are not.
4363 // ... if one of the others is changed, VD is not. 4477 // ... if one of the others is changed, VD is not.
4364 4478
4479/*
4365 if (SetVD) // VD is active, special logic applies 4480 if (SetVD) // VD is active, special logic applies
4366 4481
4367 /* volume detection is now independent of phantom in sl 4482 volume detection is now independent of phantom in sl
4368 4483
4369 { 4484 {
4370 // State machine logic for VolumeDetect 4485 // State machine logic for VolumeDetect
@@ -4385,9 +4500,8 @@ namespace OpenSim.Region.Framework.Scenes
4385 // If volumedetect is active we don't want phantom to be applied. 4500 // If volumedetect is active we don't want phantom to be applied.
4386 // If this is a new call to VD out of the state "phantom" 4501 // If this is a new call to VD out of the state "phantom"
4387 // this will also cause the prim to be visible to physics 4502 // this will also cause the prim to be visible to physics
4388 */
4389 SetPhantom = false; 4503 SetPhantom = false;
4390/* } 4504 }
4391 } 4505 }
4392 else if (wasVD) 4506 else if (wasVD)
4393 { 4507 {
@@ -4434,10 +4548,10 @@ namespace OpenSim.Region.Framework.Scenes
4434 else 4548 else
4435 RemFlag(PrimFlags.Phantom); 4549 RemFlag(PrimFlags.Phantom);
4436 4550
4437 if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment 4551 if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none
4438 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints 4552 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
4439 { 4553 {
4440 AddFlag(PrimFlags.Phantom); 4554// AddFlag(PrimFlags.Phantom);
4441 4555
4442 Velocity = new Vector3(0, 0, 0); 4556 Velocity = new Vector3(0, 0, 0);
4443 Acceleration = new Vector3(0, 0, 0); 4557 Acceleration = new Vector3(0, 0, 0);