diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index bfb9b1a..54edbdc 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -43,54 +43,54 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
43 | 43 | ||
44 | public class OdePrim : PhysicsActor | 44 | public class OdePrim : PhysicsActor |
45 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private PhysicsVector _position; | 48 | protected PhysicsVector _position; |
49 | private PhysicsVector _velocity; | 49 | protected PhysicsVector _velocity; |
50 | private PhysicsVector _torque = new PhysicsVector(0,0,0); | 50 | protected PhysicsVector _torque = new PhysicsVector(0,0,0); |
51 | private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); | 51 | protected PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); |
52 | private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); | 52 | protected PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); |
53 | private Quaternion m_lastorientation = new Quaternion(); | 53 | protected Quaternion m_lastorientation = new Quaternion(); |
54 | private PhysicsVector m_rotationalVelocity; | 54 | protected PhysicsVector m_rotationalVelocity; |
55 | private PhysicsVector _size; | 55 | protected PhysicsVector _size; |
56 | private PhysicsVector _acceleration; | 56 | protected PhysicsVector _acceleration; |
57 | // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); | 57 | // protected d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); |
58 | private Quaternion _orientation; | 58 | protected Quaternion _orientation; |
59 | private PhysicsVector m_taintposition; | 59 | protected PhysicsVector m_taintposition; |
60 | private PhysicsVector m_taintsize; | 60 | protected PhysicsVector m_taintsize; |
61 | private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); | 61 | protected PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); |
62 | private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); | 62 | protected PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); |
63 | private Quaternion m_taintrot; | 63 | protected Quaternion m_taintrot; |
64 | private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); | 64 | protected PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); |
65 | private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); | 65 | protected PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); |
66 | private IntPtr Amotor = IntPtr.Zero; | 66 | protected IntPtr Amotor = IntPtr.Zero; |
67 | 67 | ||
68 | private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); | 68 | protected PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); |
69 | private float m_PIDTau = 0f; | 69 | protected float m_PIDTau = 0f; |
70 | private float PID_D = 35f; | 70 | protected float PID_D = 35f; |
71 | private float PID_G = 25f; | 71 | protected float PID_G = 25f; |
72 | private float m_tensor = 5f; | 72 | protected float m_tensor = 5f; |
73 | private int body_autodisable_frames = 20; | 73 | protected int body_autodisable_frames = 20; |
74 | private IMesh primMesh = null; | 74 | protected IMesh primMesh = null; |
75 | 75 | ||
76 | private bool m_usePID = false; | 76 | protected bool m_usePID = false; |
77 | 77 | ||
78 | private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom | 78 | protected const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom |
79 | | CollisionCategories.Space | 79 | | CollisionCategories.Space |
80 | | CollisionCategories.Body | 80 | | CollisionCategories.Body |
81 | | CollisionCategories.Character | 81 | | CollisionCategories.Character |
82 | ); | 82 | ); |
83 | private bool m_taintshape = false; | 83 | protected bool m_taintshape = false; |
84 | private bool m_taintPhysics = false; | 84 | protected bool m_taintPhysics = false; |
85 | private bool m_collidesLand = true; | 85 | protected bool m_collidesLand = true; |
86 | private bool m_collidesWater = false; | 86 | protected bool m_collidesWater = false; |
87 | public bool m_returnCollisions = false; | 87 | public bool m_returnCollisions = false; |
88 | 88 | ||
89 | // Default we're a Geometry | 89 | // Default we're a Geometry |
90 | private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); | 90 | protected CollisionCategories m_collisionCategories = (CollisionCategories.Geom); |
91 | 91 | ||
92 | // Default, Collide with Other Geometries, spaces and Bodies | 92 | // Default, Collide with Other Geometries, spaces and Bodies |
93 | private CollisionCategories m_collisionFlags = m_default_collisionFlags; | 93 | protected CollisionCategories m_collisionFlags = m_default_collisionFlags; |
94 | 94 | ||
95 | public bool m_taintremove = false; | 95 | public bool m_taintremove = false; |
96 | public bool m_taintdisable = false; | 96 | public bool m_taintdisable = false; |
@@ -102,58 +102,58 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
102 | public uint m_localID = 0; | 102 | public uint m_localID = 0; |
103 | 103 | ||
104 | //public GCHandle gc; | 104 | //public GCHandle gc; |
105 | private CollisionLocker ode; | 105 | protected CollisionLocker ode; |
106 | 106 | ||
107 | private bool m_taintforce = false; | 107 | protected bool m_taintforce = false; |
108 | private bool m_taintaddangularforce = false; | 108 | protected bool m_taintaddangularforce = false; |
109 | private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); | 109 | protected PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); |
110 | private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); | 110 | protected List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); |
111 | private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>(); | 111 | protected List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>(); |
112 | 112 | ||
113 | private IMesh _mesh; | 113 | protected IMesh _mesh; |
114 | private PrimitiveBaseShape _pbs; | 114 | protected PrimitiveBaseShape _pbs; |
115 | private OdeScene _parent_scene; | 115 | protected OdeScene _parent_scene; |
116 | public IntPtr m_targetSpace = (IntPtr) 0; | 116 | public IntPtr m_targetSpace = (IntPtr) 0; |
117 | public IntPtr prim_geom; | 117 | public IntPtr prim_geom; |
118 | public IntPtr prev_geom; | 118 | public IntPtr prev_geom; |
119 | public IntPtr _triMeshData; | 119 | public IntPtr _triMeshData; |
120 | 120 | ||
121 | private IntPtr _linkJointGroup = (IntPtr)0; | 121 | protected IntPtr _linkJointGroup = (IntPtr)0; |
122 | private PhysicsActor _parent = null; | 122 | protected PhysicsActor _parent = null; |
123 | private PhysicsActor m_taintparent = null; | 123 | protected PhysicsActor m_taintparent = null; |
124 | 124 | ||
125 | private List<OdePrim> childrenPrim = new List<OdePrim>(); | 125 | protected List<OdePrim> childrenPrim = new List<OdePrim>(); |
126 | 126 | ||
127 | private bool iscolliding = false; | 127 | protected bool iscolliding = false; |
128 | private bool m_isphysical = false; | 128 | protected bool m_isphysical = false; |
129 | private bool m_isSelected = false; | 129 | protected bool m_isSelected = false; |
130 | 130 | ||
131 | internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively | 131 | public bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively |
132 | 132 | ||
133 | private bool m_throttleUpdates = false; | 133 | protected bool m_throttleUpdates = false; |
134 | private int throttleCounter = 0; | 134 | protected int throttleCounter = 0; |
135 | public int m_interpenetrationcount = 0; | 135 | public int m_interpenetrationcount = 0; |
136 | public float m_collisionscore = 0; | 136 | public float m_collisionscore = 0; |
137 | public int m_roundsUnderMotionThreshold = 0; | 137 | public int m_roundsUnderMotionThreshold = 0; |
138 | private int m_crossingfailures = 0; | 138 | protected int m_crossingfailures = 0; |
139 | 139 | ||
140 | public float m_buoyancy = 0f; | 140 | public float m_buoyancy = 0f; |
141 | 141 | ||
142 | public bool outofBounds = false; | 142 | public bool outofBounds = false; |
143 | private float m_density = 10.000006836f; // Aluminum g/cm3; | 143 | protected float m_density = 10.000006836f; // Aluminum g/cm3; |
144 | 144 | ||
145 | public bool _zeroFlag = false; | 145 | public bool _zeroFlag = false; |
146 | private bool m_lastUpdateSent = false; | 146 | protected bool m_lastUpdateSent = false; |
147 | 147 | ||
148 | public IntPtr Body = (IntPtr) 0; | 148 | public IntPtr Body = (IntPtr) 0; |
149 | private String m_primName; | 149 | protected String m_primName; |
150 | private PhysicsVector _target_velocity; | 150 | protected PhysicsVector _target_velocity; |
151 | public d.Mass pMass; | 151 | public d.Mass pMass; |
152 | 152 | ||
153 | public int m_eventsubscription = 0; | 153 | public int m_eventsubscription = 0; |
154 | private CollisionEventUpdate CollisionEventsThisFrame = null; | 154 | protected CollisionEventUpdate CollisionEventsThisFrame = null; |
155 | 155 | ||
156 | private IntPtr m_linkJoint = (IntPtr)0; | 156 | protected IntPtr m_linkJoint = (IntPtr)0; |
157 | 157 | ||
158 | public volatile bool childPrim = false; | 158 | public volatile bool childPrim = false; |
159 | 159 | ||
@@ -338,7 +338,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
338 | 338 | ||
339 | #region Mass Calculation | 339 | #region Mass Calculation |
340 | 340 | ||
341 | private float CalculateMass() | 341 | protected float CalculateMass() |
342 | { | 342 | { |
343 | float volume = 0; | 343 | float volume = 0; |
344 | 344 | ||
@@ -815,7 +815,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
815 | // } | 815 | // } |
816 | } | 816 | } |
817 | 817 | ||
818 | public void ProcessTaints(float timestep) | 818 | public virtual void ProcessTaints(float timestep) |
819 | { | 819 | { |
820 | if (m_taintadd) | 820 | if (m_taintadd) |
821 | { | 821 | { |
@@ -875,7 +875,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
875 | } | 875 | } |
876 | } | 876 | } |
877 | 877 | ||
878 | private void changeAngularLock(float timestep) | 878 | protected void changeAngularLock(float timestep) |
879 | { | 879 | { |
880 | // do we have a Physical object? | 880 | // do we have a Physical object? |
881 | if (Body != IntPtr.Zero) | 881 | if (Body != IntPtr.Zero) |
@@ -904,7 +904,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
904 | m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z); | 904 | m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z); |
905 | } | 905 | } |
906 | 906 | ||
907 | private void changelink(float timestep) | 907 | protected void changelink(float timestep) |
908 | { | 908 | { |
909 | // If the newly set parent is not null | 909 | // If the newly set parent is not null |
910 | // create link | 910 | // create link |
@@ -1095,7 +1095,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1095 | 1095 | ||
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | private void ChildSetGeom(OdePrim odePrim) | 1098 | public void ChildSetGeom(OdePrim odePrim) |
1099 | { | 1099 | { |
1100 | //if (m_isphysical && Body != IntPtr.Zero) | 1100 | //if (m_isphysical && Body != IntPtr.Zero) |
1101 | lock (childrenPrim) | 1101 | lock (childrenPrim) |
@@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1129 | 1129 | ||
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | private void ChildDelink(OdePrim odePrim) | 1132 | protected void ChildDelink(OdePrim odePrim) |
1133 | { | 1133 | { |
1134 | // Okay, we have a delinked child.. need to rebuild the body. | 1134 | // Okay, we have a delinked child.. need to rebuild the body. |
1135 | lock (childrenPrim) | 1135 | lock (childrenPrim) |
@@ -1173,7 +1173,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1173 | 1173 | ||
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | private void changeSelectedStatus(float timestep) | 1176 | protected void changeSelectedStatus(float timestep) |
1177 | { | 1177 | { |
1178 | if (m_taintselected) | 1178 | if (m_taintselected) |
1179 | { | 1179 | { |
@@ -1603,7 +1603,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1603 | m_taintrot = _orientation; | 1603 | m_taintrot = _orientation; |
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | private void resetCollisionAccounting() | 1606 | protected void resetCollisionAccounting() |
1607 | { | 1607 | { |
1608 | m_collisionscore = 0; | 1608 | m_collisionscore = 0; |
1609 | m_interpenetrationcount = 0; | 1609 | m_interpenetrationcount = 0; |
@@ -2132,7 +2132,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2132 | m_taintaddangularforce = false; | 2132 | m_taintaddangularforce = false; |
2133 | } | 2133 | } |
2134 | 2134 | ||
2135 | private void changevelocity(float timestep) | 2135 | protected void changevelocity(float timestep) |
2136 | { | 2136 | { |
2137 | if (!m_isSelected) | 2137 | if (!m_isSelected) |
2138 | { | 2138 | { |
@@ -2622,7 +2622,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2622 | public override bool PIDActive { set { m_usePID = value; } } | 2622 | public override bool PIDActive { set { m_usePID = value; } } |
2623 | public override float PIDTau { set { m_PIDTau = value; } } | 2623 | public override float PIDTau { set { m_PIDTau = value; } } |
2624 | 2624 | ||
2625 | private void createAMotor(PhysicsVector axis) | 2625 | protected void createAMotor(PhysicsVector axis) |
2626 | { | 2626 | { |
2627 | if (Body == IntPtr.Zero) | 2627 | if (Body == IntPtr.Zero) |
2628 | return; | 2628 | return; |