diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index c5ffe98..5291cbf 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -55,7 +55,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
55 | private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom | 55 | private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom |
56 | | CollisionCategories.Space | 56 | | CollisionCategories.Space |
57 | | CollisionCategories.Body | 57 | | CollisionCategories.Body |
58 | | CollisionCategories.Character); | 58 | | CollisionCategories.Character |
59 | ); | ||
59 | private bool m_taintshape = false; | 60 | private bool m_taintshape = false; |
60 | private bool m_taintPhysics = false; | 61 | private bool m_taintPhysics = false; |
61 | private bool m_collidesLand = true; | 62 | private bool m_collidesLand = true; |
@@ -106,6 +107,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
106 | public int m_roundsUnderMotionThreshold = 0; | 107 | public int m_roundsUnderMotionThreshold = 0; |
107 | private int m_crossingfailures = 0; | 108 | private int m_crossingfailures = 0; |
108 | 109 | ||
110 | public float m_buoyancy = 0f; | ||
111 | |||
109 | public bool outofBounds = false; | 112 | public bool outofBounds = false; |
110 | private float m_density = 10.000006836f; // Aluminum g/cm3; | 113 | private float m_density = 10.000006836f; // Aluminum g/cm3; |
111 | 114 | ||
@@ -704,7 +707,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
704 | if (prim_geom != (IntPtr)0) | 707 | if (prim_geom != (IntPtr)0) |
705 | { | 708 | { |
706 | if (m_taintposition != _position) | 709 | if (m_taintposition != _position) |
707 | Move(timestep); | 710 | changemove(timestep); |
708 | 711 | ||
709 | if (m_taintrot != _orientation) | 712 | if (m_taintrot != _orientation) |
710 | rotate(timestep); | 713 | rotate(timestep); |
@@ -829,7 +832,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
829 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 832 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
830 | } | 833 | } |
831 | if (m_isphysical) | 834 | if (m_isphysical) |
835 | { | ||
836 | d.BodySetLinearVel(Body, 0f, 0f, 0f); | ||
832 | enableBodySoft(); | 837 | enableBodySoft(); |
838 | } | ||
833 | 839 | ||
834 | 840 | ||
835 | } | 841 | } |
@@ -1003,7 +1009,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1003 | 1009 | ||
1004 | 1010 | ||
1005 | } | 1011 | } |
1006 | public void Move(float timestep) | 1012 | public void changemove(float timestep) |
1007 | { | 1013 | { |
1008 | 1014 | ||
1009 | 1015 | ||
@@ -1063,6 +1069,37 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1063 | m_taintposition = _position; | 1069 | m_taintposition = _position; |
1064 | } | 1070 | } |
1065 | 1071 | ||
1072 | public void Move(float timestep) | ||
1073 | { | ||
1074 | |||
1075 | if (IsPhysical && Body != (IntPtr)0 && !m_isSelected) | ||
1076 | { | ||
1077 | float m_mass = CalculateMass(); | ||
1078 | //m_log.Info(m_collisionFlags.ToString()); | ||
1079 | if (m_buoyancy != 0) | ||
1080 | { | ||
1081 | float buoyancy = 0f; | ||
1082 | if (m_buoyancy > 0) | ||
1083 | { | ||
1084 | buoyancy = ((9.8f * m_buoyancy) * m_mass); | ||
1085 | |||
1086 | //d.Vector3 l_velocity = d.BodyGetLinearVel(Body); | ||
1087 | //m_log.Info("Using Buoyancy: " + buoyancy + " G: " + (9.8f * m_buoyancy) + "mass:" + m_mass + " Pos: " + Position.ToString()); | ||
1088 | } | ||
1089 | else | ||
1090 | { | ||
1091 | buoyancy = (-1 * ((9.8f * (-1 * m_buoyancy)) * m_mass)); | ||
1092 | } | ||
1093 | d.BodyAddForce(Body, 0, 0, buoyancy); | ||
1094 | |||
1095 | } | ||
1096 | } | ||
1097 | else | ||
1098 | { | ||
1099 | return; | ||
1100 | } | ||
1101 | } | ||
1102 | |||
1066 | public void rotate(float timestep) | 1103 | public void rotate(float timestep) |
1067 | { | 1104 | { |
1068 | 1105 | ||
@@ -1676,6 +1713,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1676 | } | 1713 | } |
1677 | } | 1714 | } |
1678 | 1715 | ||
1716 | public override float Buoyancy | ||
1717 | { | ||
1718 | get { return m_buoyancy; } | ||
1719 | set { m_buoyancy = value; } | ||
1720 | } | ||
1721 | |||
1679 | public override void link(PhysicsActor obj) | 1722 | public override void link(PhysicsActor obj) |
1680 | { | 1723 | { |
1681 | m_taintparent = obj; | 1724 | m_taintparent = obj; |