diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 114 |
1 files changed, 100 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f647544..ace53f6 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) |
@@ -4334,6 +4408,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4334 | } | 4408 | } |
4335 | } | 4409 | } |
4336 | 4410 | ||
4411 | |||
4412 | public void UpdateExtraPhysics(ExtraPhysicsData physdata) | ||
4413 | { | ||
4414 | if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null) | ||
4415 | return; | ||
4416 | |||
4417 | PhysicsShapeType = (byte)physdata.PhysShapeType; | ||
4418 | Density = physdata.Density; | ||
4419 | GravityModifier = physdata.GravitationModifier; | ||
4420 | Friction = physdata.Friction; | ||
4421 | Bounciness = physdata.Bounce; | ||
4422 | } | ||
4337 | /// <summary> | 4423 | /// <summary> |
4338 | /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. | 4424 | /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. |
4339 | /// </summary> | 4425 | /// </summary> |