From 269febc87e1aba24fff09e9fb0d77eee0a73b185 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 29 May 2013 06:32:26 +0100 Subject: let gravity modifier, friction, restitution and density changes be applied to prim. Only have efect on root prim. Density doesn't get effect imediatly, only on next change of size or shape. density change implies a full body rebuild to be done later, after reducing the number of sets sop does. Other parameters should work. **** mainly untested *** --- OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 52 ++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 7cabddd..e3f88c6 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -115,6 +115,7 @@ namespace OpenSim.Region.Physics.OdePlugin private int body_autodisable_frames; public int bodydisablecontrol; + private float m_gravmod = 1.0f; // Default we're a Geometry @@ -914,6 +915,55 @@ namespace OpenSim.Region.Physics.OdePlugin bounce = _parent_scene.m_materialContactsData[pMaterial].bounce; } + public override float Density + { + get + { + return m_density * 100f; + } + set + { + m_density = value / 100f; + // for not prim mass is not updated since this implies full rebuild of body inertia TODO + } + } + public override float GravModifier + { + get + { + return m_gravmod; + } + set + { + m_gravmod = value; + if (m_vehicle != null) + m_vehicle.GravMod = m_gravmod; + } + } + public override float Friction + { + get + { + return mu; + } + set + { + mu = value; + } + } + + public override float Restitution + { + get + { + return bounce; + } + set + { + bounce = value; + } + } + public void setPrimForRemoval() { AddChange(changes.Remove, null); @@ -3336,7 +3386,7 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - float b = (1.0f - m_buoyancy); + float b = (1.0f - m_buoyancy) * m_gravmod; fx = _parent_scene.gravityx * b; fy = _parent_scene.gravityy * b; fz = _parent_scene.gravityz * b; -- cgit v1.1