diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 56 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 5 |
2 files changed, 55 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 | ||
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index d119791..4820ca4 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -235,6 +235,11 @@ namespace OpenSim.Region.Physics.Manager | |||
235 | public abstract float Mass { get; } | 235 | public abstract float Mass { get; } |
236 | public abstract Vector3 Force { get; set; } | 236 | public abstract Vector3 Force { get; set; } |
237 | 237 | ||
238 | public virtual float Density { get; set; } | ||
239 | public virtual float Friction { get; set; } | ||
240 | public virtual float Restitution { get; set; } | ||
241 | public virtual float GravityModifier { get; set; } | ||
242 | |||
238 | public abstract int VehicleType { get; set; } | 243 | public abstract int VehicleType { get; set; } |
239 | public abstract void VehicleFloatParam(int param, float value); | 244 | public abstract void VehicleFloatParam(int param, float value); |
240 | public abstract void VehicleVectorParam(int param, Vector3 value); | 245 | public abstract void VehicleVectorParam(int param, Vector3 value); |