aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorRobert Adams2013-02-07 11:05:21 -0800
committerRobert Adams2013-02-07 11:10:15 -0800
commitc658fa1c0dd83f23c66ccfedb12e8ab02ff01d0a (patch)
treec85b468e508353c09eacd391f2ac842ec77112d5 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentChange passed PhysicsParameter value from float to the more general string value (diff)
downloadopensim-SC_OLD-c658fa1c0dd83f23c66ccfedb12e8ab02ff01d0a.zip
opensim-SC_OLD-c658fa1c0dd83f23c66ccfedb12e8ab02ff01d0a.tar.gz
opensim-SC_OLD-c658fa1c0dd83f23c66ccfedb12e8ab02ff01d0a.tar.bz2
opensim-SC_OLD-c658fa1c0dd83f23c66ccfedb12e8ab02ff01d0a.tar.xz
Add plumbing for physics properties to get to the physics engine.
Addition of entries to PhysicsActor and setting code in SceneObjectPart.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs56
1 files changed, 50 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b00f388..a3c7ed3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1387,10 +1387,46 @@ namespace OpenSim.Region.Framework.Scenes
1387 } 1387 }
1388 } 1388 }
1389 1389
1390 public float Density { get; set; } 1390 private float m_density = 10f;
1391 public float GravityModifier { get; set; } 1391 public float Density {
1392 public float Friction { get; set; } 1392 get { return m_density; }
1393 public float Restitution { get; set; } 1393 set
1394 {
1395 m_density = value;
1396 if (PhysActor != null)
1397 PhysActor.Density = m_density;
1398 }
1399 }
1400 private float m_gravityModifier = 1f;
1401 public float GravityModifier {
1402 get { return m_gravityModifier; }
1403 set
1404 {
1405 m_gravityModifier = value;
1406 if (PhysActor != null)
1407 PhysActor.GravityModifier = m_gravityModifier;
1408 }
1409 }
1410 private float m_friction = 0.5f;
1411 public float Friction {
1412 get { return m_friction; }
1413 set
1414 {
1415 m_friction = value;
1416 if (PhysActor != null)
1417 PhysActor.Friction = m_friction;
1418 }
1419 }
1420 private float m_restitution = 0f;
1421 public float Restitution {
1422 get { return m_restitution; }
1423 set
1424 {
1425 m_restitution = value;
1426 if (PhysActor != null)
1427 PhysActor.Restitution = m_restitution;
1428 }
1429 }
1394 1430
1395 #endregion Public Properties with only Get 1431 #endregion Public Properties with only Get
1396 1432
@@ -1896,8 +1932,18 @@ namespace OpenSim.Region.Framework.Scenes
1896 { 1932 {
1897 ParentGroup.Scene.AddPhysicalPrim(1); 1933 ParentGroup.Scene.AddPhysicalPrim(1);
1898 1934
1935 // Update initial values for various physical properties
1936 pa.SetMaterial(Material);
1937 pa.Density = Density;
1938 pa.Friction = Friction;
1939 pa.Restitution = Restitution;
1940 pa.GravityModifier = GravityModifier;
1941
1942 // Link up callbacks for property updates from the physics engine
1899 pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 1943 pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
1900 pa.OnOutOfBounds += PhysicsOutOfBounds; 1944 pa.OnOutOfBounds += PhysicsOutOfBounds;
1945
1946 // If this is a child prim, tell the physics engine about the parent
1901 if (ParentID != 0 && ParentID != LocalId) 1947 if (ParentID != 0 && ParentID != LocalId)
1902 { 1948 {
1903 PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; 1949 PhysicsActor parentPa = ParentGroup.RootPart.PhysActor;
@@ -4062,7 +4108,6 @@ namespace OpenSim.Region.Framework.Scenes
4062 4108
4063 if (pa != null) 4109 if (pa != null)
4064 { 4110 {
4065 pa.SetMaterial(Material);
4066 DoPhysicsPropertyUpdate(UsePhysics, true); 4111 DoPhysicsPropertyUpdate(UsePhysics, true);
4067 4112
4068 if ( 4113 if (
@@ -4175,7 +4220,6 @@ namespace OpenSim.Region.Framework.Scenes
4175 if (pa != null) 4220 if (pa != null)
4176 { 4221 {
4177 pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info 4222 pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
4178 pa.SetMaterial(Material);
4179 DoPhysicsPropertyUpdate(rigidBody, true); 4223 DoPhysicsPropertyUpdate(rigidBody, true);
4180 } 4224 }
4181 4225