diff options
author | KittoFlora | 2009-10-27 22:42:55 +0100 |
---|---|---|
committer | KittoFlora | 2009-10-27 22:42:55 +0100 |
commit | 1113b3b6ebba3e358326a7be90b338d8c95af688 (patch) | |
tree | d923340600e5a2699ceaceeb52fd6c45994f334a /OpenSim/Region/Physics | |
parent | llRotLookAt Pt 2 (diff) | |
parent | Merge branch 'master' into vehicles (diff) | |
download | opensim-SC-1113b3b6ebba3e358326a7be90b338d8c95af688.zip opensim-SC-1113b3b6ebba3e358326a7be90b338d8c95af688.tar.gz opensim-SC-1113b3b6ebba3e358326a7be90b338d8c95af688.tar.bz2 opensim-SC-1113b3b6ebba3e358326a7be90b338d8c95af688.tar.xz |
Merge branch 'vehicles' into tests
Conflicts:
OpenSim/Region/Physics/Manager/PhysicsActor.cs
OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
Diffstat (limited to 'OpenSim/Region/Physics')
25 files changed, 857 insertions, 811 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index 2b905b6..f411dd7 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | |||
@@ -36,20 +36,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
36 | { | 36 | { |
37 | public class BasicActor : PhysicsActor | 37 | public class BasicActor : PhysicsActor |
38 | { | 38 | { |
39 | private PhysicsVector _position; | 39 | private Vector3 _position; |
40 | private PhysicsVector _velocity; | 40 | private Vector3 _velocity; |
41 | private PhysicsVector _acceleration; | 41 | private Vector3 _acceleration; |
42 | private PhysicsVector _size; | 42 | private Vector3 _size; |
43 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | 43 | private Vector3 m_rotationalVelocity; |
44 | private bool flying; | 44 | private bool flying; |
45 | private bool iscolliding; | 45 | private bool iscolliding; |
46 | 46 | ||
47 | public BasicActor() | 47 | public BasicActor() |
48 | { | 48 | { |
49 | _velocity = new PhysicsVector(); | ||
50 | _position = new PhysicsVector(); | ||
51 | _acceleration = new PhysicsVector(); | ||
52 | _size = new PhysicsVector(); | ||
53 | } | 49 | } |
54 | 50 | ||
55 | public override int PhysicsActorType | 51 | public override int PhysicsActorType |
@@ -58,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
58 | set { return; } | 54 | set { return; } |
59 | } | 55 | } |
60 | 56 | ||
61 | public override PhysicsVector RotationalVelocity | 57 | public override Vector3 RotationalVelocity |
62 | { | 58 | { |
63 | get { return m_rotationalVelocity; } | 59 | get { return m_rotationalVelocity; } |
64 | set { m_rotationalVelocity = value; } | 60 | set { m_rotationalVelocity = value; } |
@@ -137,13 +133,13 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
137 | get { return false; } | 133 | get { return false; } |
138 | } | 134 | } |
139 | 135 | ||
140 | public override PhysicsVector Position | 136 | public override Vector3 Position |
141 | { | 137 | { |
142 | get { return _position; } | 138 | get { return _position; } |
143 | set { _position = value; } | 139 | set { _position = value; } |
144 | } | 140 | } |
145 | 141 | ||
146 | public override PhysicsVector Size | 142 | public override Vector3 Size |
147 | { | 143 | { |
148 | get { return _size; } | 144 | get { return _size; } |
149 | set { | 145 | set { |
@@ -162,9 +158,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
162 | get { return 0f; } | 158 | get { return 0f; } |
163 | } | 159 | } |
164 | 160 | ||
165 | public override PhysicsVector Force | 161 | public override Vector3 Force |
166 | { | 162 | { |
167 | get { return PhysicsVector.Zero; } | 163 | get { return Vector3.Zero; } |
168 | set { return; } | 164 | set { return; } |
169 | } | 165 | } |
170 | 166 | ||
@@ -179,7 +175,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
179 | 175 | ||
180 | } | 176 | } |
181 | 177 | ||
182 | public override void VehicleVectorParam(int param, PhysicsVector value) | 178 | public override void VehicleVectorParam(int param, Vector3 value) |
183 | { | 179 | { |
184 | 180 | ||
185 | } | 181 | } |
@@ -194,25 +190,25 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
194 | 190 | ||
195 | } | 191 | } |
196 | 192 | ||
197 | public override PhysicsVector CenterOfMass | 193 | public override Vector3 CenterOfMass |
198 | { | 194 | { |
199 | get { return PhysicsVector.Zero; } | 195 | get { return Vector3.Zero; } |
200 | } | 196 | } |
201 | 197 | ||
202 | public override PhysicsVector GeometricCenter | 198 | public override Vector3 GeometricCenter |
203 | { | 199 | { |
204 | get { return PhysicsVector.Zero; } | 200 | get { return Vector3.Zero; } |
205 | } | 201 | } |
206 | 202 | ||
207 | public override PhysicsVector Velocity | 203 | public override Vector3 Velocity |
208 | { | 204 | { |
209 | get { return _velocity; } | 205 | get { return _velocity; } |
210 | set { _velocity = value; } | 206 | set { _velocity = value; } |
211 | } | 207 | } |
212 | 208 | ||
213 | public override PhysicsVector Torque | 209 | public override Vector3 Torque |
214 | { | 210 | { |
215 | get { return PhysicsVector.Zero; } | 211 | get { return Vector3.Zero; } |
216 | set { return; } | 212 | set { return; } |
217 | } | 213 | } |
218 | 214 | ||
@@ -228,7 +224,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
228 | set { } | 224 | set { } |
229 | } | 225 | } |
230 | 226 | ||
231 | public override PhysicsVector Acceleration | 227 | public override Vector3 Acceleration |
232 | { | 228 | { |
233 | get { return _acceleration; } | 229 | get { return _acceleration; } |
234 | } | 230 | } |
@@ -247,24 +243,24 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
247 | { | 243 | { |
248 | } | 244 | } |
249 | 245 | ||
250 | public override void LockAngularMotion(PhysicsVector axis) | 246 | public override void LockAngularMotion(Vector3 axis) |
251 | { | 247 | { |
252 | } | 248 | } |
253 | 249 | ||
254 | public void SetAcceleration(PhysicsVector accel) | 250 | public void SetAcceleration(Vector3 accel) |
255 | { | 251 | { |
256 | _acceleration = accel; | 252 | _acceleration = accel; |
257 | } | 253 | } |
258 | 254 | ||
259 | public override void AddForce(PhysicsVector force, bool pushforce) | 255 | public override void AddForce(Vector3 force, bool pushforce) |
260 | { | 256 | { |
261 | } | 257 | } |
262 | 258 | ||
263 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 259 | public override void AddAngularForce(Vector3 force, bool pushforce) |
264 | { | 260 | { |
265 | } | 261 | } |
266 | 262 | ||
267 | public override void SetMomentum(PhysicsVector momentum) | 263 | public override void SetMomentum(Vector3 momentum) |
268 | { | 264 | { |
269 | } | 265 | } |
270 | 266 | ||
@@ -272,7 +268,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
272 | { | 268 | { |
273 | } | 269 | } |
274 | 270 | ||
275 | public override PhysicsVector PIDTarget | 271 | public override Vector3 PIDTarget |
276 | { | 272 | { |
277 | set { return; } | 273 | set { return; } |
278 | } | 274 | } |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index 66bd099..b6e1cb4 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
54 | { | 54 | { |
55 | 55 | ||
56 | } | 56 | } |
57 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 57 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
58 | { | 58 | { |
59 | BasicActor act = new BasicActor(); | 59 | BasicActor act = new BasicActor(); |
60 | act.Position = position; | 60 | act.Position = position; |
@@ -77,20 +77,20 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
77 | } | 77 | } |
78 | 78 | ||
79 | /* | 79 | /* |
80 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) | 80 | public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) |
81 | { | 81 | { |
82 | return null; | 82 | return null; |
83 | } | 83 | } |
84 | */ | 84 | */ |
85 | 85 | ||
86 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 86 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
87 | PhysicsVector size, Quaternion rotation) | 87 | Vector3 size, Quaternion rotation) |
88 | { | 88 | { |
89 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 89 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
90 | } | 90 | } |
91 | 91 | ||
92 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 92 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
93 | PhysicsVector size, Quaternion rotation, bool isPhysical) | 93 | Vector3 size, Quaternion rotation, bool isPhysical) |
94 | { | 94 | { |
95 | return null; | 95 | return null; |
96 | } | 96 | } |
@@ -105,26 +105,28 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
105 | for (int i = 0; i < _actors.Count; ++i) | 105 | for (int i = 0; i < _actors.Count; ++i) |
106 | { | 106 | { |
107 | BasicActor actor = _actors[i]; | 107 | BasicActor actor = _actors[i]; |
108 | Vector3 actorPosition = actor.Position; | ||
109 | Vector3 actorVelocity = actor.Velocity; | ||
108 | 110 | ||
109 | actor.Position.X += actor.Velocity.X*timeStep; | 111 | actorPosition.X += actor.Velocity.X*timeStep; |
110 | actor.Position.Y += actor.Velocity.Y*timeStep; | 112 | actorPosition.Y += actor.Velocity.Y*timeStep; |
111 | 113 | ||
112 | if (actor.Position.Y < 0) | 114 | if (actor.Position.Y < 0) |
113 | { | 115 | { |
114 | actor.Position.Y = 0.1F; | 116 | actorPosition.Y = 0.1F; |
115 | } | 117 | } |
116 | else if (actor.Position.Y >= Constants.RegionSize) | 118 | else if (actor.Position.Y >= Constants.RegionSize) |
117 | { | 119 | { |
118 | actor.Position.Y = ((int)Constants.RegionSize - 0.1f); | 120 | actorPosition.Y = ((int)Constants.RegionSize - 0.1f); |
119 | } | 121 | } |
120 | 122 | ||
121 | if (actor.Position.X < 0) | 123 | if (actor.Position.X < 0) |
122 | { | 124 | { |
123 | actor.Position.X = 0.1F; | 125 | actorPosition.X = 0.1F; |
124 | } | 126 | } |
125 | else if (actor.Position.X >= Constants.RegionSize) | 127 | else if (actor.Position.X >= Constants.RegionSize) |
126 | { | 128 | { |
127 | actor.Position.X = ((int)Constants.RegionSize - 0.1f); | 129 | actorPosition.X = ((int)Constants.RegionSize - 0.1f); |
128 | } | 130 | } |
129 | 131 | ||
130 | float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; | 132 | float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; |
@@ -133,23 +135,27 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
133 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < | 135 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < |
134 | _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) | 136 | _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) |
135 | { | 137 | { |
136 | actor.Position.Z = height; | 138 | actorPosition.Z = height; |
137 | actor.Velocity.Z = 0; | 139 | actorVelocity.Z = 0; |
138 | actor.IsColliding = true; | 140 | actor.IsColliding = true; |
139 | } | 141 | } |
140 | else | 142 | else |
141 | { | 143 | { |
142 | actor.Position.Z += actor.Velocity.Z*timeStep; | 144 | actorPosition.Z += actor.Velocity.Z*timeStep; |
143 | actor.IsColliding = false; | 145 | actor.IsColliding = false; |
144 | } | 146 | } |
145 | } | 147 | } |
146 | else | 148 | else |
147 | { | 149 | { |
148 | actor.Position.Z = height; | 150 | actorPosition.Z = height; |
149 | actor.Velocity.Z = 0; | 151 | actorVelocity.Z = 0; |
150 | actor.IsColliding = true; | 152 | actor.IsColliding = true; |
151 | } | 153 | } |
154 | |||
155 | actor.Position = actorPosition; | ||
156 | actor.Velocity = actorVelocity; | ||
152 | } | 157 | } |
158 | |||
153 | return fps; | 159 | return fps; |
154 | } | 160 | } |
155 | 161 | ||
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs index d7aed3c..98681d6 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs | |||
@@ -60,15 +60,15 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
60 | private btQuaternion m_bodyOrientation; | 60 | private btQuaternion m_bodyOrientation; |
61 | private btDefaultMotionState m_bodyMotionState; | 61 | private btDefaultMotionState m_bodyMotionState; |
62 | private btGeneric6DofConstraint m_aMotor; | 62 | private btGeneric6DofConstraint m_aMotor; |
63 | // private PhysicsVector m_movementComparision; | 63 | // private Vector3 m_movementComparision; |
64 | private PhysicsVector m_position; | 64 | private Vector3 m_position; |
65 | private PhysicsVector m_zeroPosition; | 65 | private Vector3 m_zeroPosition; |
66 | private bool m_zeroFlag = false; | 66 | private bool m_zeroFlag = false; |
67 | private bool m_lastUpdateSent = false; | 67 | private bool m_lastUpdateSent = false; |
68 | private PhysicsVector m_velocity; | 68 | private Vector3 m_velocity; |
69 | private PhysicsVector m_target_velocity; | 69 | private Vector3 m_target_velocity; |
70 | private PhysicsVector m_acceleration; | 70 | private Vector3 m_acceleration; |
71 | private PhysicsVector m_rotationalVelocity; | 71 | private Vector3 m_rotationalVelocity; |
72 | private bool m_pidControllerActive = true; | 72 | private bool m_pidControllerActive = true; |
73 | public float PID_D = 80.0f; | 73 | public float PID_D = 80.0f; |
74 | public float PID_P = 90.0f; | 74 | public float PID_P = 90.0f; |
@@ -96,8 +96,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
96 | private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. | 96 | private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. |
97 | private bool m_taintRemove = false; | 97 | private bool m_taintRemove = false; |
98 | // private bool m_taintedPosition = false; | 98 | // private bool m_taintedPosition = false; |
99 | // private PhysicsVector m_taintedPosition_value; | 99 | // private Vector3 m_taintedPosition_value; |
100 | private PhysicsVector m_taintedForce; | 100 | private Vector3 m_taintedForce; |
101 | 101 | ||
102 | private float m_buoyancy = 0f; | 102 | private float m_buoyancy = 0f; |
103 | 103 | ||
@@ -115,14 +115,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
115 | public int m_eventsubscription = 0; | 115 | public int m_eventsubscription = 0; |
116 | // private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); | 116 | // private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); |
117 | 117 | ||
118 | public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, PhysicsVector pos, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) | 118 | public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) |
119 | { | 119 | { |
120 | m_taintedForce = new PhysicsVector(); | ||
121 | m_velocity = new PhysicsVector(); | ||
122 | m_target_velocity = new PhysicsVector(); | ||
123 | m_position = pos; | 120 | m_position = pos; |
124 | m_zeroPosition = new PhysicsVector(pos.X, pos.Y, pos.Z); // this is a class, not a struct. Must make new, or m_zeroPosition will == position regardless | 121 | m_zeroPosition = pos; |
125 | m_acceleration = new PhysicsVector(); | ||
126 | m_parent_scene = parent_scene; | 122 | m_parent_scene = parent_scene; |
127 | PID_D = pid_d; | 123 | PID_D = pid_d; |
128 | PID_P = pid_p; | 124 | PID_P = pid_p; |
@@ -161,9 +157,6 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
161 | tempTrans1 = new btTransform(tempQuat1, tempVector1); | 157 | tempTrans1 = new btTransform(tempQuat1, tempVector1); |
162 | // m_movementComparision = new PhysicsVector(0, 0, 0); | 158 | // m_movementComparision = new PhysicsVector(0, 0, 0); |
163 | m_CapsuleOrientationAxis = new btVector3(1, 0, 1); | 159 | m_CapsuleOrientationAxis = new btVector3(1, 0, 1); |
164 | |||
165 | |||
166 | |||
167 | } | 160 | } |
168 | 161 | ||
169 | /// <summary> | 162 | /// <summary> |
@@ -254,18 +247,18 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
254 | get { return m_zeroFlag; } | 247 | get { return m_zeroFlag; } |
255 | } | 248 | } |
256 | 249 | ||
257 | public override PhysicsVector Size | 250 | public override Vector3 Size |
258 | { | 251 | { |
259 | get { return new PhysicsVector(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } | 252 | get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } |
260 | set | 253 | set |
261 | { | 254 | { |
262 | m_pidControllerActive = true; | 255 | m_pidControllerActive = true; |
263 | 256 | ||
264 | PhysicsVector SetSize = value; | 257 | Vector3 SetSize = value; |
265 | m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; | 258 | m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; |
266 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); | 259 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); |
267 | 260 | ||
268 | Velocity = new PhysicsVector(0f, 0f, 0f); | 261 | Velocity = Vector3.Zero; |
269 | 262 | ||
270 | m_parent_scene.AddPhysicsActorTaint(this); | 263 | m_parent_scene.AddPhysicsActorTaint(this); |
271 | } | 264 | } |
@@ -317,12 +310,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
317 | 310 | ||
318 | } | 311 | } |
319 | 312 | ||
320 | public override void LockAngularMotion(PhysicsVector axis) | 313 | public override void LockAngularMotion(Vector3 axis) |
321 | { | 314 | { |
322 | 315 | ||
323 | } | 316 | } |
324 | 317 | ||
325 | public override PhysicsVector Position | 318 | public override Vector3 Position |
326 | { | 319 | { |
327 | get { return m_position; } | 320 | get { return m_position; } |
328 | set | 321 | set |
@@ -342,9 +335,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
342 | } | 335 | } |
343 | } | 336 | } |
344 | 337 | ||
345 | public override PhysicsVector Force | 338 | public override Vector3 Force |
346 | { | 339 | { |
347 | get { return new PhysicsVector(m_target_velocity.X, m_target_velocity.Y, m_target_velocity.Z); } | 340 | get { return m_target_velocity; } |
348 | set { return; } | 341 | set { return; } |
349 | } | 342 | } |
350 | 343 | ||
@@ -359,7 +352,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
359 | 352 | ||
360 | } | 353 | } |
361 | 354 | ||
362 | public override void VehicleVectorParam(int param, PhysicsVector value) | 355 | public override void VehicleVectorParam(int param, Vector3 value) |
363 | { | 356 | { |
364 | 357 | ||
365 | } | 358 | } |
@@ -374,23 +367,22 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
374 | 367 | ||
375 | } | 368 | } |
376 | 369 | ||
377 | public override PhysicsVector GeometricCenter | 370 | public override Vector3 GeometricCenter |
378 | { | 371 | { |
379 | get { return PhysicsVector.Zero; } | 372 | get { return Vector3.Zero; } |
380 | } | 373 | } |
381 | 374 | ||
382 | public override PhysicsVector CenterOfMass | 375 | public override Vector3 CenterOfMass |
383 | { | 376 | { |
384 | get { return PhysicsVector.Zero; } | 377 | get { return Vector3.Zero; } |
385 | } | 378 | } |
386 | 379 | ||
387 | public override PhysicsVector Velocity | 380 | public override Vector3 Velocity |
388 | { | 381 | { |
389 | get | 382 | get |
390 | { | 383 | { |
391 | // There's a problem with PhysicsVector.Zero! Don't Use it Here! | ||
392 | if (m_zeroFlag) | 384 | if (m_zeroFlag) |
393 | return new PhysicsVector(0f, 0f, 0f); | 385 | return Vector3.Zero; |
394 | m_lastUpdateSent = false; | 386 | m_lastUpdateSent = false; |
395 | return m_velocity; | 387 | return m_velocity; |
396 | } | 388 | } |
@@ -401,9 +393,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
401 | } | 393 | } |
402 | } | 394 | } |
403 | 395 | ||
404 | public override PhysicsVector Torque | 396 | public override Vector3 Torque |
405 | { | 397 | { |
406 | get { return PhysicsVector.Zero; } | 398 | get { return Vector3.Zero; } |
407 | set { return; } | 399 | set { return; } |
408 | } | 400 | } |
409 | 401 | ||
@@ -413,7 +405,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
413 | set { } | 405 | set { } |
414 | } | 406 | } |
415 | 407 | ||
416 | public override PhysicsVector Acceleration | 408 | public override Vector3 Acceleration |
417 | { | 409 | { |
418 | get { return m_acceleration; } | 410 | get { return m_acceleration; } |
419 | } | 411 | } |
@@ -586,7 +578,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
586 | set { return; } | 578 | set { return; } |
587 | } | 579 | } |
588 | 580 | ||
589 | public override PhysicsVector RotationalVelocity | 581 | public override Vector3 RotationalVelocity |
590 | { | 582 | { |
591 | get { return m_rotationalVelocity; } | 583 | get { return m_rotationalVelocity; } |
592 | set { m_rotationalVelocity = value; } | 584 | set { m_rotationalVelocity = value; } |
@@ -604,7 +596,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
604 | set { m_buoyancy = value; } | 596 | set { m_buoyancy = value; } |
605 | } | 597 | } |
606 | 598 | ||
607 | public override PhysicsVector PIDTarget { set { return; } } | 599 | public override Vector3 PIDTarget { set { return; } } |
608 | public override bool PIDActive { set { return; } } | 600 | public override bool PIDActive { set { return; } } |
609 | public override float PIDTau { set { return; } } | 601 | public override float PIDTau { set { return; } } |
610 | 602 | ||
@@ -640,7 +632,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
640 | /// </summary> | 632 | /// </summary> |
641 | /// <param name="force"></param> | 633 | /// <param name="force"></param> |
642 | /// <param name="pushforce">Is this a push by a script?</param> | 634 | /// <param name="pushforce">Is this a push by a script?</param> |
643 | public override void AddForce(PhysicsVector force, bool pushforce) | 635 | public override void AddForce(Vector3 force, bool pushforce) |
644 | { | 636 | { |
645 | if (pushforce) | 637 | if (pushforce) |
646 | { | 638 | { |
@@ -662,7 +654,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
662 | //m_lastUpdateSent = false; | 654 | //m_lastUpdateSent = false; |
663 | } | 655 | } |
664 | 656 | ||
665 | public void doForce(PhysicsVector force, bool now) | 657 | public void doForce(Vector3 force, bool now) |
666 | { | 658 | { |
667 | 659 | ||
668 | tempVector3.setValue(force.X, force.Y, force.Z); | 660 | tempVector3.setValue(force.X, force.Y, force.Z); |
@@ -677,7 +669,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
677 | } | 669 | } |
678 | } | 670 | } |
679 | 671 | ||
680 | public void doImpulse(PhysicsVector force, bool now) | 672 | public void doImpulse(Vector3 force, bool now) |
681 | { | 673 | { |
682 | 674 | ||
683 | tempVector3.setValue(force.X, force.Y, force.Z); | 675 | tempVector3.setValue(force.X, force.Y, force.Z); |
@@ -692,12 +684,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
692 | } | 684 | } |
693 | } | 685 | } |
694 | 686 | ||
695 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 687 | public override void AddAngularForce(Vector3 force, bool pushforce) |
696 | { | 688 | { |
697 | 689 | ||
698 | } | 690 | } |
699 | 691 | ||
700 | public override void SetMomentum(PhysicsVector momentum) | 692 | public override void SetMomentum(Vector3 momentum) |
701 | { | 693 | { |
702 | 694 | ||
703 | } | 695 | } |
@@ -814,7 +806,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
814 | 806 | ||
815 | AvatarGeomAndBodyCreation(m_position.X, m_position.Y, | 807 | AvatarGeomAndBodyCreation(m_position.X, m_position.Y, |
816 | m_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2)); | 808 | m_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2)); |
817 | Velocity = new PhysicsVector(0f, 0f, 0f); | 809 | Velocity = Vector3.Zero; |
818 | 810 | ||
819 | } | 811 | } |
820 | else | 812 | else |
@@ -858,9 +850,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
858 | } | 850 | } |
859 | //PidStatus = true; | 851 | //PidStatus = true; |
860 | 852 | ||
861 | PhysicsVector vec = new PhysicsVector(); | 853 | Vector3 vec = Vector3.Zero; |
862 | 854 | ||
863 | PhysicsVector vel = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); | 855 | Vector3 vel = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); |
864 | 856 | ||
865 | float movementdivisor = 1f; | 857 | float movementdivisor = 1f; |
866 | 858 | ||
@@ -891,7 +883,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
891 | // Avatar to Avatar collisions | 883 | // Avatar to Avatar collisions |
892 | // Prim to avatar collisions | 884 | // Prim to avatar collisions |
893 | 885 | ||
894 | PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); | 886 | Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); |
895 | vec.X = (m_target_velocity.X - vel.X) * (PID_D) + (m_zeroPosition.X - pos.X) * (PID_P * 2); | 887 | vec.X = (m_target_velocity.X - vel.X) * (PID_D) + (m_zeroPosition.X - pos.X) * (PID_P * 2); |
896 | vec.Y = (m_target_velocity.Y - vel.Y) * (PID_D) + (m_zeroPosition.Y - pos.Y) * (PID_P * 2); | 888 | vec.Y = (m_target_velocity.Y - vel.Y) * (PID_D) + (m_zeroPosition.Y - pos.Y) * (PID_P * 2); |
897 | if (m_flying) | 889 | if (m_flying) |
@@ -933,7 +925,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
933 | { | 925 | { |
934 | // We're colliding with something and we're not flying but we're moving | 926 | // We're colliding with something and we're not flying but we're moving |
935 | // This means we're walking or running. | 927 | // This means we're walking or running. |
936 | PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); | 928 | Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); |
937 | vec.Z = (m_target_velocity.Z - vel.Z) * PID_D + (m_zeroPosition.Z - pos.Z) * PID_P; | 929 | vec.Z = (m_target_velocity.Z - vel.Z) * PID_D + (m_zeroPosition.Z - pos.Z) * PID_P; |
938 | if (m_target_velocity.X > 0) | 930 | if (m_target_velocity.X > 0) |
939 | { | 931 | { |
@@ -1022,7 +1014,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1022 | tempVector2 = Body.getInterpolationLinearVelocity(); | 1014 | tempVector2 = Body.getInterpolationLinearVelocity(); |
1023 | 1015 | ||
1024 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 1016 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
1025 | PhysicsVector vec = new PhysicsVector(tempVector1.getX(),tempVector1.getY(),tempVector1.getZ()); | 1017 | Vector3 vec = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); |
1026 | 1018 | ||
1027 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 1019 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
1028 | if (vec.X < -10.0f) vec.X = 0.0f; | 1020 | if (vec.X < -10.0f) vec.X = 0.0f; |
@@ -1054,7 +1046,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1054 | else | 1046 | else |
1055 | { | 1047 | { |
1056 | m_lastUpdateSent = false; | 1048 | m_lastUpdateSent = false; |
1057 | vec = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); | 1049 | vec = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); |
1058 | m_velocity.X = (vec.X); | 1050 | m_velocity.X = (vec.X); |
1059 | m_velocity.Y = (vec.Y); | 1051 | m_velocity.Y = (vec.Y); |
1060 | 1052 | ||
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs index 977b463..d931f126 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | |||
@@ -43,44 +43,43 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | private PhysicsVector _position; | 46 | private Vector3 _position; |
47 | private PhysicsVector m_zeroPosition; | 47 | private Vector3 m_zeroPosition; |
48 | private PhysicsVector _velocity; | 48 | private Vector3 _velocity; |
49 | private PhysicsVector _torque = new PhysicsVector(0, 0, 0); | 49 | private Vector3 _torque; |
50 | private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); | 50 | private Vector3 m_lastVelocity; |
51 | private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); | 51 | private Vector3 m_lastposition; |
52 | private Quaternion m_lastorientation = new Quaternion(); | 52 | private Quaternion m_lastorientation = Quaternion.Identity; |
53 | private PhysicsVector m_rotationalVelocity; | 53 | private Vector3 m_rotationalVelocity; |
54 | private PhysicsVector _size; | 54 | private Vector3 _size; |
55 | private PhysicsVector _acceleration; | 55 | private Vector3 _acceleration; |
56 | // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); | 56 | // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); |
57 | private Quaternion _orientation; | 57 | private Quaternion _orientation; |
58 | private PhysicsVector m_taintposition; | 58 | private Vector3 m_taintposition; |
59 | private PhysicsVector m_taintsize; | 59 | private Vector3 m_taintsize; |
60 | private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); | 60 | private Vector3 m_taintVelocity; |
61 | private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); | 61 | private Vector3 m_taintTorque; |
62 | private Quaternion m_taintrot; | 62 | private Quaternion m_taintrot; |
63 | private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); | 63 | private Vector3 m_angularlock = Vector3.One; |
64 | private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); | 64 | private Vector3 m_taintAngularLock = Vector3.One; |
65 | // private btGeneric6DofConstraint Amotor; | 65 | // private btGeneric6DofConstraint Amotor; |
66 | 66 | ||
67 | private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); | 67 | private Vector3 m_PIDTarget; |
68 | private float m_PIDTau = 0f; | 68 | private float m_PIDTau; |
69 | private float m_PIDHoverHeight = 0f; | 69 | private float m_PIDHoverHeight; |
70 | private float m_PIDHoverTau = 0f; | 70 | private float m_PIDHoverTau; |
71 | private bool m_useHoverPID = false; | 71 | private bool m_useHoverPID; |
72 | private PIDHoverType m_PIDHoverType = PIDHoverType.Ground; | 72 | private PIDHoverType m_PIDHoverType = PIDHoverType.Ground; |
73 | private float m_targetHoverHeight = 0f; | 73 | private float m_targetHoverHeight; |
74 | private float m_groundHeight = 0f; | 74 | private float m_groundHeight; |
75 | private float m_waterHeight = 0f; | 75 | private float m_waterHeight; |
76 | private float PID_D = 35f; | 76 | private float PID_D = 35f; |
77 | private float PID_G = 25f; | 77 | private float PID_G = 25f; |
78 | // private float m_tensor = 5f; | 78 | // private float m_tensor = 5f; |
79 | // private int body_autodisable_frames = 20; | 79 | // private int body_autodisable_frames = 20; |
80 | private IMesh primMesh = null; | 80 | private IMesh primMesh; |
81 | |||
82 | private bool m_usePID = false; | ||
83 | 81 | ||
82 | private bool m_usePID; | ||
84 | 83 | ||
85 | private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom | 84 | private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom |
86 | | CollisionCategories.Space | 85 | | CollisionCategories.Space |
@@ -88,11 +87,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
88 | | CollisionCategories.Character | 87 | | CollisionCategories.Character |
89 | ); | 88 | ); |
90 | 89 | ||
91 | private bool m_taintshape = false; | 90 | private bool m_taintshape; |
92 | private bool m_taintPhysics = false; | 91 | private bool m_taintPhysics; |
93 | // private bool m_collidesLand = true; | 92 | // private bool m_collidesLand = true; |
94 | private bool m_collidesWater = false; | 93 | private bool m_collidesWater; |
95 | public bool m_returnCollisions = false; | 94 | public bool m_returnCollisions; |
96 | 95 | ||
97 | // Default we're a Geometry | 96 | // Default we're a Geometry |
98 | // private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); | 97 | // private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); |
@@ -100,23 +99,23 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
100 | // Default, Collide with Other Geometries, spaces and Bodies | 99 | // Default, Collide with Other Geometries, spaces and Bodies |
101 | // private CollisionCategories m_collisionFlags = m_default_collisionFlags; | 100 | // private CollisionCategories m_collisionFlags = m_default_collisionFlags; |
102 | 101 | ||
103 | public bool m_taintremove = false; | 102 | public bool m_taintremove; |
104 | public bool m_taintdisable = false; | 103 | public bool m_taintdisable; |
105 | public bool m_disabled = false; | 104 | public bool m_disabled; |
106 | public bool m_taintadd = false; | 105 | public bool m_taintadd; |
107 | public bool m_taintselected = false; | 106 | public bool m_taintselected; |
108 | public bool m_taintCollidesWater = false; | 107 | public bool m_taintCollidesWater; |
109 | 108 | ||
110 | public uint m_localID = 0; | 109 | public uint m_localID; |
111 | 110 | ||
112 | //public GCHandle gc; | 111 | //public GCHandle gc; |
113 | // private CollisionLocker ode; | 112 | // private CollisionLocker ode; |
114 | 113 | ||
115 | private bool m_taintforce = false; | 114 | private bool m_taintforce; |
116 | private bool m_taintaddangularforce = false; | 115 | private bool m_taintaddangularforce; |
117 | private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); | 116 | private Vector3 m_force; |
118 | private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); | 117 | private List<Vector3> m_forcelist = new List<Vector3>(); |
119 | private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>(); | 118 | private List<Vector3> m_angularforcelist = new List<Vector3>(); |
120 | 119 | ||
121 | private IMesh _mesh; | 120 | private IMesh _mesh; |
122 | private PrimitiveBaseShape _pbs; | 121 | private PrimitiveBaseShape _pbs; |
@@ -124,40 +123,40 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
124 | public btCollisionShape prim_geom; | 123 | public btCollisionShape prim_geom; |
125 | public IntPtr _triMeshData; | 124 | public IntPtr _triMeshData; |
126 | 125 | ||
127 | private PhysicsActor _parent = null; | 126 | private PhysicsActor _parent; |
128 | private PhysicsActor m_taintparent = null; | 127 | private PhysicsActor m_taintparent; |
129 | 128 | ||
130 | private List<BulletDotNETPrim> childrenPrim = new List<BulletDotNETPrim>(); | 129 | private List<BulletDotNETPrim> childrenPrim = new List<BulletDotNETPrim>(); |
131 | 130 | ||
132 | private bool iscolliding = false; | 131 | private bool iscolliding; |
133 | private bool m_isphysical = false; | 132 | private bool m_isphysical; |
134 | private bool m_isSelected = false; | 133 | private bool m_isSelected; |
135 | 134 | ||
136 | internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively | 135 | internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively |
137 | 136 | ||
138 | private bool m_throttleUpdates = false; | 137 | private bool m_throttleUpdates; |
139 | // private int throttleCounter = 0; | 138 | // private int throttleCounter; |
140 | public int m_interpenetrationcount = 0; | 139 | public int m_interpenetrationcount; |
141 | public float m_collisionscore = 0; | 140 | public float m_collisionscore; |
142 | public int m_roundsUnderMotionThreshold = 0; | 141 | public int m_roundsUnderMotionThreshold; |
143 | private int m_crossingfailures = 0; | 142 | private int m_crossingfailures; |
144 | 143 | ||
145 | public float m_buoyancy = 0f; | 144 | public float m_buoyancy; |
146 | 145 | ||
147 | public bool outofBounds = false; | 146 | public bool outofBounds; |
148 | private float m_density = 10.000006836f; // Aluminum g/cm3; | 147 | private float m_density = 10.000006836f; // Aluminum g/cm3; |
149 | 148 | ||
150 | public bool _zeroFlag = false; | 149 | public bool _zeroFlag; |
151 | private bool m_lastUpdateSent = false; | 150 | private bool m_lastUpdateSent; |
152 | 151 | ||
153 | 152 | ||
154 | private String m_primName; | 153 | private String m_primName; |
155 | private PhysicsVector _target_velocity; | 154 | private Vector3 _target_velocity; |
156 | 155 | ||
157 | public int m_eventsubscription = 0; | 156 | public int m_eventsubscription; |
158 | // private CollisionEventUpdate CollisionEventsThisFrame = null; | 157 | // private CollisionEventUpdate CollisionEventsThisFrame = null; |
159 | 158 | ||
160 | public volatile bool childPrim = false; | 159 | public volatile bool childPrim; |
161 | 160 | ||
162 | private btVector3 tempPosition1; | 161 | private btVector3 tempPosition1; |
163 | private btVector3 tempPosition2; | 162 | private btVector3 tempPosition2; |
@@ -190,7 +189,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
190 | 189 | ||
191 | public btRigidBody Body; | 190 | public btRigidBody Body; |
192 | 191 | ||
193 | public BulletDotNETPrim(String primName, BulletDotNETScene parent_scene, PhysicsVector pos, PhysicsVector size, | 192 | public BulletDotNETPrim(String primName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size, |
194 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical) | 193 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical) |
195 | { | 194 | { |
196 | tempPosition1 = new btVector3(0, 0, 0); | 195 | tempPosition1 = new btVector3(0, 0, 0); |
@@ -225,8 +224,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
225 | 224 | ||
226 | AxisLockLinearHigh = new btVector3((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionSize); | 225 | AxisLockLinearHigh = new btVector3((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionSize); |
227 | 226 | ||
228 | _target_velocity = new PhysicsVector(0, 0, 0); | 227 | _target_velocity = Vector3.Zero; |
229 | _velocity = new PhysicsVector(); | 228 | _velocity = Vector3.Zero; |
230 | _position = pos; | 229 | _position = pos; |
231 | m_taintposition = pos; | 230 | m_taintposition = pos; |
232 | PID_D = parent_scene.bodyPIDD; | 231 | PID_D = parent_scene.bodyPIDD; |
@@ -244,8 +243,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
244 | 243 | ||
245 | _size = size; | 244 | _size = size; |
246 | m_taintsize = _size; | 245 | m_taintsize = _size; |
247 | _acceleration = new PhysicsVector(); | 246 | _acceleration = Vector3.Zero; |
248 | m_rotationalVelocity = PhysicsVector.Zero; | 247 | m_rotationalVelocity = Vector3.Zero; |
249 | _orientation = rotation; | 248 | _orientation = rotation; |
250 | m_taintrot = _orientation; | 249 | m_taintrot = _orientation; |
251 | _mesh = mesh; | 250 | _mesh = mesh; |
@@ -274,7 +273,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
274 | get { return _zeroFlag; } | 273 | get { return _zeroFlag; } |
275 | } | 274 | } |
276 | 275 | ||
277 | public override PhysicsVector Size | 276 | public override Vector3 Size |
278 | { | 277 | { |
279 | get { return _size; } | 278 | get { return _size; } |
280 | set { _size = value; } | 279 | set { _size = value; } |
@@ -348,13 +347,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
348 | m_taintparent = null; | 347 | m_taintparent = null; |
349 | } | 348 | } |
350 | 349 | ||
351 | public override void LockAngularMotion(PhysicsVector axis) | 350 | public override void LockAngularMotion(Vector3 axis) |
352 | { | 351 | { |
353 | m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); | 352 | m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); |
354 | m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z); | 353 | m_taintAngularLock = axis; |
355 | } | 354 | } |
356 | 355 | ||
357 | public override PhysicsVector Position | 356 | public override Vector3 Position |
358 | { | 357 | { |
359 | get { return _position; } | 358 | get { return _position; } |
360 | 359 | ||
@@ -370,9 +369,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
370 | get { return CalculateMass(); } | 369 | get { return CalculateMass(); } |
371 | } | 370 | } |
372 | 371 | ||
373 | public override PhysicsVector Force | 372 | public override Vector3 Force |
374 | { | 373 | { |
375 | //get { return PhysicsVector.Zero; } | 374 | //get { return Vector3.Zero; } |
376 | get { return m_force; } | 375 | get { return m_force; } |
377 | set { m_force = value; } | 376 | set { m_force = value; } |
378 | } | 377 | } |
@@ -388,7 +387,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
388 | //TODO: | 387 | //TODO: |
389 | } | 388 | } |
390 | 389 | ||
391 | public override void VehicleVectorParam(int param, PhysicsVector value) | 390 | public override void VehicleVectorParam(int param, Vector3 value) |
392 | { | 391 | { |
393 | //TODO: | 392 | //TODO: |
394 | } | 393 | } |
@@ -405,23 +404,23 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
405 | 404 | ||
406 | } | 405 | } |
407 | 406 | ||
408 | public override PhysicsVector GeometricCenter | 407 | public override Vector3 GeometricCenter |
409 | { | 408 | { |
410 | get { return PhysicsVector.Zero; } | 409 | get { return Vector3.Zero; } |
411 | } | 410 | } |
412 | 411 | ||
413 | public override PhysicsVector CenterOfMass | 412 | public override Vector3 CenterOfMass |
414 | { | 413 | { |
415 | get { return PhysicsVector.Zero; } | 414 | get { return Vector3.Zero; } |
416 | } | 415 | } |
417 | 416 | ||
418 | public override PhysicsVector Velocity | 417 | public override Vector3 Velocity |
419 | { | 418 | { |
420 | get | 419 | get |
421 | { | 420 | { |
422 | // Averate previous velocity with the new one so | 421 | // Averate previous velocity with the new one so |
423 | // client object interpolation works a 'little' better | 422 | // client object interpolation works a 'little' better |
424 | PhysicsVector returnVelocity = new PhysicsVector(); | 423 | Vector3 returnVelocity; |
425 | returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2; | 424 | returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2; |
426 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2; | 425 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2; |
427 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2; | 426 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2; |
@@ -436,12 +435,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
436 | } | 435 | } |
437 | } | 436 | } |
438 | 437 | ||
439 | public override PhysicsVector Torque | 438 | public override Vector3 Torque |
440 | { | 439 | { |
441 | get | 440 | get |
442 | { | 441 | { |
443 | if (!m_isphysical || Body.Handle == IntPtr.Zero) | 442 | if (!m_isphysical || Body.Handle == IntPtr.Zero) |
444 | return new PhysicsVector(0, 0, 0); | 443 | return Vector3.Zero; |
445 | 444 | ||
446 | return _torque; | 445 | return _torque; |
447 | } | 446 | } |
@@ -459,7 +458,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
459 | set { m_collisionscore = value; } | 458 | set { m_collisionscore = value; } |
460 | } | 459 | } |
461 | 460 | ||
462 | public override PhysicsVector Acceleration | 461 | public override Vector3 Acceleration |
463 | { | 462 | { |
464 | get { return _acceleration; } | 463 | get { return _acceleration; } |
465 | } | 464 | } |
@@ -528,16 +527,16 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
528 | } | 527 | } |
529 | } | 528 | } |
530 | 529 | ||
531 | public override PhysicsVector RotationalVelocity | 530 | public override Vector3 RotationalVelocity |
532 | { | 531 | { |
533 | get | 532 | get |
534 | { | 533 | { |
535 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | 534 | Vector3 pv = Vector3.Zero; |
536 | if (_zeroFlag) | 535 | if (_zeroFlag) |
537 | return pv; | 536 | return pv; |
538 | m_lastUpdateSent = false; | 537 | m_lastUpdateSent = false; |
539 | 538 | ||
540 | if (m_rotationalVelocity.IsIdentical(pv, 0.2f)) | 539 | if (m_rotationalVelocity.ApproxEquals(pv, 0.2f)) |
541 | return pv; | 540 | return pv; |
542 | 541 | ||
543 | return m_rotationalVelocity; | 542 | return m_rotationalVelocity; |
@@ -557,7 +556,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
557 | set { m_buoyancy = value; } | 556 | set { m_buoyancy = value; } |
558 | } | 557 | } |
559 | 558 | ||
560 | public override PhysicsVector PIDTarget { set { m_PIDTarget = value; ; } } | 559 | public override Vector3 PIDTarget { set { m_PIDTarget = value; ; } } |
561 | public override bool PIDActive { set { m_usePID = value; } } | 560 | public override bool PIDActive { set { m_usePID = value; } } |
562 | public override float PIDTau { set { m_PIDTau = value; } } | 561 | public override float PIDTau { set { m_PIDTau = value; } } |
563 | 562 | ||
@@ -572,20 +571,20 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
572 | public override float APIDDamping { set { return; } } | 571 | public override float APIDDamping { set { return; } } |
573 | 572 | ||
574 | 573 | ||
575 | public override void AddForce(PhysicsVector force, bool pushforce) | 574 | public override void AddForce(Vector3 force, bool pushforce) |
576 | { | 575 | { |
577 | m_forcelist.Add(force); | 576 | m_forcelist.Add(force); |
578 | m_taintforce = true; | 577 | m_taintforce = true; |
579 | //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); | 578 | //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); |
580 | } | 579 | } |
581 | 580 | ||
582 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 581 | public override void AddAngularForce(Vector3 force, bool pushforce) |
583 | { | 582 | { |
584 | m_angularforcelist.Add(force); | 583 | m_angularforcelist.Add(force); |
585 | m_taintaddangularforce = true; | 584 | m_taintaddangularforce = true; |
586 | } | 585 | } |
587 | 586 | ||
588 | public override void SetMomentum(PhysicsVector momentum) | 587 | public override void SetMomentum(Vector3 momentum) |
589 | { | 588 | { |
590 | } | 589 | } |
591 | 590 | ||
@@ -783,7 +782,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
783 | 782 | ||
784 | } | 783 | } |
785 | 784 | ||
786 | if (!_position.IsIdentical(m_taintposition, 0f)) | 785 | if (!_position.ApproxEquals(m_taintposition, 0f)) |
787 | { | 786 | { |
788 | m_log.Debug("[PHYSICS]: TaintMove"); | 787 | m_log.Debug("[PHYSICS]: TaintMove"); |
789 | changemove(timestep); | 788 | changemove(timestep); |
@@ -801,7 +800,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
801 | } | 800 | } |
802 | // | 801 | // |
803 | 802 | ||
804 | if (!_size.IsIdentical(m_taintsize, 0)) | 803 | if (!_size.ApproxEquals(m_taintsize, 0f)) |
805 | { | 804 | { |
806 | m_log.Debug("[PHYSICS]: TaintSize"); | 805 | m_log.Debug("[PHYSICS]: TaintSize"); |
807 | changesize(timestep); | 806 | changesize(timestep); |
@@ -825,7 +824,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
825 | m_log.Debug("[PHYSICS]: TaintAngularForce"); | 824 | m_log.Debug("[PHYSICS]: TaintAngularForce"); |
826 | changeAddAngularForce(timestep); | 825 | changeAddAngularForce(timestep); |
827 | } | 826 | } |
828 | if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f)) | 827 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) |
829 | { | 828 | { |
830 | m_log.Debug("[PHYSICS]: TaintTorque"); | 829 | m_log.Debug("[PHYSICS]: TaintTorque"); |
831 | changeSetTorque(timestep); | 830 | changeSetTorque(timestep); |
@@ -840,7 +839,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
840 | m_log.Debug("[PHYSICS]: TaintSelected"); | 839 | m_log.Debug("[PHYSICS]: TaintSelected"); |
841 | changeSelectedStatus(timestep); | 840 | changeSelectedStatus(timestep); |
842 | } | 841 | } |
843 | if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f)) | 842 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) |
844 | { | 843 | { |
845 | m_log.Debug("[PHYSICS]: TaintVelocity"); | 844 | m_log.Debug("[PHYSICS]: TaintVelocity"); |
846 | changevelocity(timestep); | 845 | changevelocity(timestep); |
@@ -854,7 +853,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
854 | { | 853 | { |
855 | changefloatonwater(timestep); | 854 | changefloatonwater(timestep); |
856 | } | 855 | } |
857 | if (!m_angularlock.IsIdentical(m_taintAngularLock, 0)) | 856 | if (!m_angularlock.ApproxEquals(m_taintAngularLock, 0)) |
858 | { | 857 | { |
859 | m_log.Debug("[PHYSICS]: TaintAngularLock"); | 858 | m_log.Debug("[PHYSICS]: TaintAngularLock"); |
860 | changeAngularLock(timestep); | 859 | changeAngularLock(timestep); |
@@ -1017,7 +1016,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1017 | { | 1016 | { |
1018 | if (_parent_scene.needsMeshing(_pbs)) | 1017 | if (_parent_scene.needsMeshing(_pbs)) |
1019 | { | 1018 | { |
1020 | ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity); | 1019 | ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity); |
1021 | // createmesh returns null when it doesn't mesh. | 1020 | // createmesh returns null when it doesn't mesh. |
1022 | CreateGeom(IntPtr.Zero, _mesh); | 1021 | CreateGeom(IntPtr.Zero, _mesh); |
1023 | } | 1022 | } |
@@ -1034,7 +1033,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1034 | return _parent_scene.needsMeshing(_pbs); | 1033 | return _parent_scene.needsMeshing(_pbs); |
1035 | } | 1034 | } |
1036 | 1035 | ||
1037 | internal void ProcessGeomCreationAsTriMesh(PhysicsVector positionOffset, Quaternion orientation) | 1036 | internal void ProcessGeomCreationAsTriMesh(Vector3 positionOffset, Quaternion orientation) |
1038 | { | 1037 | { |
1039 | // Don't need to re-enable body.. it's done in SetMesh | 1038 | // Don't need to re-enable body.. it's done in SetMesh |
1040 | float meshlod = _parent_scene.meshSculptLOD; | 1039 | float meshlod = _parent_scene.meshSculptLOD; |
@@ -1043,7 +1042,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1043 | meshlod = _parent_scene.MeshSculptphysicalLOD; | 1042 | meshlod = _parent_scene.MeshSculptphysicalLOD; |
1044 | 1043 | ||
1045 | IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical); | 1044 | IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical); |
1046 | if (!positionOffset.IsIdentical(PhysicsVector.Zero, 0.001f) || orientation != Quaternion.Identity) | 1045 | if (!positionOffset.ApproxEquals(Vector3.Zero, 0.001f) || orientation != Quaternion.Identity) |
1047 | { | 1046 | { |
1048 | 1047 | ||
1049 | float[] xyz = new float[3]; | 1048 | float[] xyz = new float[3]; |
@@ -1207,7 +1206,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1207 | //m_log.Info("[PHYSICS]: dequeing forcelist"); | 1206 | //m_log.Info("[PHYSICS]: dequeing forcelist"); |
1208 | if (IsPhysical) | 1207 | if (IsPhysical) |
1209 | { | 1208 | { |
1210 | PhysicsVector iforce = new PhysicsVector(); | 1209 | Vector3 iforce = Vector3.Zero; |
1211 | for (int i = 0; i < m_forcelist.Count; i++) | 1210 | for (int i = 0; i < m_forcelist.Count; i++) |
1212 | { | 1211 | { |
1213 | iforce = iforce + m_forcelist[i]; | 1212 | iforce = iforce + m_forcelist[i]; |
@@ -1242,7 +1241,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1242 | //m_log.Info("[PHYSICS]: dequeing forcelist"); | 1241 | //m_log.Info("[PHYSICS]: dequeing forcelist"); |
1243 | if (IsPhysical) | 1242 | if (IsPhysical) |
1244 | { | 1243 | { |
1245 | PhysicsVector iforce = new PhysicsVector(); | 1244 | Vector3 iforce = Vector3.Zero; |
1246 | for (int i = 0; i < m_angularforcelist.Count; i++) | 1245 | for (int i = 0; i < m_angularforcelist.Count; i++) |
1247 | { | 1246 | { |
1248 | iforce = iforce + m_angularforcelist[i]; | 1247 | iforce = iforce + m_angularforcelist[i]; |
@@ -1281,7 +1280,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1281 | } | 1280 | } |
1282 | } | 1281 | } |
1283 | } | 1282 | } |
1284 | m_taintTorque = new PhysicsVector(0, 0, 0); | 1283 | m_taintTorque = Vector3.Zero; |
1285 | } | 1284 | } |
1286 | 1285 | ||
1287 | private void changedisable(float timestep) | 1286 | private void changedisable(float timestep) |
@@ -1322,7 +1321,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1322 | 1321 | ||
1323 | //resetCollisionAccounting(); | 1322 | //resetCollisionAccounting(); |
1324 | } | 1323 | } |
1325 | m_taintVelocity = PhysicsVector.Zero; | 1324 | m_taintVelocity = Vector3.Zero; |
1326 | } | 1325 | } |
1327 | 1326 | ||
1328 | private void changelink(float timestep) | 1327 | private void changelink(float timestep) |
@@ -1366,7 +1365,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1366 | 1365 | ||
1367 | if (m_taintparent != null) | 1366 | if (m_taintparent != null) |
1368 | { | 1367 | { |
1369 | m_taintparent.Position.Z = m_taintparent.Position.Z + 0.02f; | 1368 | Vector3 taintparentPosition = m_taintparent.Position; |
1369 | taintparentPosition.Z = m_taintparent.Position.Z + 0.02f; | ||
1370 | m_taintparent.Position = taintparentPosition; | ||
1370 | _parent_scene.AddPhysicsActorTaint(m_taintparent); | 1371 | _parent_scene.AddPhysicsActorTaint(m_taintparent); |
1371 | } | 1372 | } |
1372 | } | 1373 | } |
@@ -1387,7 +1388,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1387 | { | 1388 | { |
1388 | if (_parent == null) | 1389 | if (_parent == null) |
1389 | { | 1390 | { |
1390 | if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f, 1f, 1f), 0)) | 1391 | if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f)) |
1391 | { | 1392 | { |
1392 | //d.BodySetFiniteRotationMode(Body, 0); | 1393 | //d.BodySetFiniteRotationMode(Body, 0); |
1393 | //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); | 1394 | //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); |
@@ -1400,7 +1401,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1400 | } | 1401 | } |
1401 | 1402 | ||
1402 | } | 1403 | } |
1403 | m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z); | 1404 | m_angularlock = m_taintAngularLock; |
1404 | 1405 | ||
1405 | } | 1406 | } |
1406 | #endregion | 1407 | #endregion |
@@ -1465,17 +1466,17 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1465 | // TODO: NEED btVector3 for Linear Velocity | 1466 | // TODO: NEED btVector3 for Linear Velocity |
1466 | // NEED btVector3 for Position | 1467 | // NEED btVector3 for Position |
1467 | 1468 | ||
1468 | PhysicsVector pos = new PhysicsVector(_position.X, _position.Y, _position.Z); //TODO: Insert values gotten from bullet | 1469 | Vector3 pos = _position; //TODO: Insert values gotten from bullet |
1469 | PhysicsVector vel = new PhysicsVector(_velocity.X, _velocity.Y, _velocity.Z); | 1470 | Vector3 vel = _velocity; |
1470 | 1471 | ||
1471 | _target_velocity = | 1472 | _target_velocity = |
1472 | new PhysicsVector( | 1473 | new Vector3( |
1473 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), | 1474 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), |
1474 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), | 1475 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), |
1475 | (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) | 1476 | (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) |
1476 | ); | 1477 | ); |
1477 | 1478 | ||
1478 | if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f)) | 1479 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) |
1479 | { | 1480 | { |
1480 | 1481 | ||
1481 | /* TODO: Do Bullet equiv | 1482 | /* TODO: Do Bullet equiv |
@@ -1517,8 +1518,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1517 | { | 1518 | { |
1518 | PID_G = m_PIDTau + 1; | 1519 | PID_G = m_PIDTau + 1; |
1519 | } | 1520 | } |
1520 | PhysicsVector pos = new PhysicsVector(0, 0, 0); //TODO: Insert values gotten from bullet | 1521 | Vector3 pos = Vector3.Zero; //TODO: Insert values gotten from bullet |
1521 | PhysicsVector vel = new PhysicsVector(0, 0, 0); | 1522 | Vector3 vel = Vector3.Zero; |
1522 | 1523 | ||
1523 | // determine what our target height really is based on HoverType | 1524 | // determine what our target height really is based on HoverType |
1524 | switch (m_PIDHoverType) | 1525 | switch (m_PIDHoverType) |
@@ -1550,13 +1551,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1550 | 1551 | ||
1551 | 1552 | ||
1552 | _target_velocity = | 1553 | _target_velocity = |
1553 | new PhysicsVector(0.0f, 0.0f, | 1554 | new Vector3(0.0f, 0.0f, |
1554 | (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) | 1555 | (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) |
1555 | ); | 1556 | ); |
1556 | 1557 | ||
1557 | // if velocity is zero, use position control; otherwise, velocity control | 1558 | // if velocity is zero, use position control; otherwise, velocity control |
1558 | 1559 | ||
1559 | if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f)) | 1560 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) |
1560 | { | 1561 | { |
1561 | 1562 | ||
1562 | /* TODO: Do Bullet Equiv | 1563 | /* TODO: Do Bullet Equiv |
@@ -1631,8 +1632,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1631 | else | 1632 | else |
1632 | { | 1633 | { |
1633 | if (m_zeroPosition == null) | 1634 | if (m_zeroPosition == null) |
1634 | m_zeroPosition = new PhysicsVector(0, 0, 0); | 1635 | m_zeroPosition = Vector3.Zero; |
1635 | m_zeroPosition.setValues(_position.X, _position.Y, _position.Z); | 1636 | m_zeroPosition = _position; |
1636 | return; | 1637 | return; |
1637 | } | 1638 | } |
1638 | } | 1639 | } |
@@ -2182,7 +2183,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2182 | 2183 | ||
2183 | //if (hasTrimesh) | 2184 | //if (hasTrimesh) |
2184 | //{ | 2185 | //{ |
2185 | ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity); | 2186 | ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity); |
2186 | // createmesh returns null when it doesn't mesh. | 2187 | // createmesh returns null when it doesn't mesh. |
2187 | 2188 | ||
2188 | /* | 2189 | /* |
@@ -2202,11 +2203,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2202 | { | 2203 | { |
2203 | if (chld == null) | 2204 | if (chld == null) |
2204 | continue; | 2205 | continue; |
2205 | PhysicsVector offset = chld.Position - Position; | 2206 | Vector3 offset = chld.Position - Position; |
2206 | Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z); | 2207 | Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z); |
2207 | pos *= Quaternion.Inverse(Orientation); | 2208 | pos *= Quaternion.Inverse(Orientation); |
2208 | //pos *= Orientation; | 2209 | //pos *= Orientation; |
2209 | offset.setValues(pos.X, pos.Y, pos.Z); | 2210 | offset = pos; |
2210 | chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation); | 2211 | chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation); |
2211 | 2212 | ||
2212 | _mesh.Append(chld._mesh); | 2213 | _mesh.Append(chld._mesh); |
@@ -2438,7 +2439,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2438 | m_collisionscore = 0; | 2439 | m_collisionscore = 0; |
2439 | m_disabled = false; | 2440 | m_disabled = false; |
2440 | // The body doesn't already have a finite rotation mode set here | 2441 | // The body doesn't already have a finite rotation mode set here |
2441 | if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) | 2442 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) |
2442 | { | 2443 | { |
2443 | // TODO: Create Angular Motor on Axis Lock! | 2444 | // TODO: Create Angular Motor on Axis Lock! |
2444 | } | 2445 | } |
@@ -2452,7 +2453,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2452 | { | 2453 | { |
2453 | if (_parent == null) | 2454 | if (_parent == null) |
2454 | { | 2455 | { |
2455 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | 2456 | Vector3 pv = Vector3.Zero; |
2456 | bool lastZeroFlag = _zeroFlag; | 2457 | bool lastZeroFlag = _zeroFlag; |
2457 | if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero) | 2458 | if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero) |
2458 | tempPosition3.Dispose(); | 2459 | tempPosition3.Dispose(); |
@@ -2476,10 +2477,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2476 | tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel | 2477 | tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel |
2477 | tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel | 2478 | tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel |
2478 | 2479 | ||
2479 | _torque.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(), | 2480 | _torque = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(), |
2480 | tempAngularVelocity1.getZ()); | 2481 | tempAngularVelocity1.getZ()); |
2481 | PhysicsVector l_position = new PhysicsVector(); | 2482 | Vector3 l_position = Vector3.Zero; |
2482 | Quaternion l_orientation = new Quaternion(); | 2483 | Quaternion l_orientation = Quaternion.Identity; |
2483 | m_lastposition = _position; | 2484 | m_lastposition = _position; |
2484 | m_lastorientation = _orientation; | 2485 | m_lastorientation = _orientation; |
2485 | 2486 | ||
@@ -2603,20 +2604,18 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2603 | _velocity.Z = tempLinearVelocity1.getZ(); | 2604 | _velocity.Z = tempLinearVelocity1.getZ(); |
2604 | 2605 | ||
2605 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); | 2606 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); |
2606 | _acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, | 2607 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, |
2607 | _velocity.Y - m_lastVelocity.Y / 0.1f, | 2608 | _velocity.Y - m_lastVelocity.Y / 0.1f, |
2608 | _velocity.Z - m_lastVelocity.Z / 0.1f); | 2609 | _velocity.Z - m_lastVelocity.Z / 0.1f); |
2609 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); | 2610 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); |
2610 | 2611 | ||
2611 | if (_velocity.IsIdentical(pv, 0.5f)) | 2612 | if (_velocity.ApproxEquals(pv, 0.5f)) |
2612 | { | 2613 | { |
2613 | m_rotationalVelocity = pv; | 2614 | m_rotationalVelocity = pv; |
2614 | } | 2615 | } |
2615 | else | 2616 | else |
2616 | { | 2617 | { |
2617 | 2618 | m_rotationalVelocity = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(), tempAngularVelocity1.getZ()); | |
2618 | m_rotationalVelocity.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(), | ||
2619 | tempAngularVelocity1.getZ()); | ||
2620 | } | 2619 | } |
2621 | 2620 | ||
2622 | //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); | 2621 | //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); |
@@ -2670,7 +2669,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2670 | m_taintremove = true; | 2669 | m_taintremove = true; |
2671 | } | 2670 | } |
2672 | 2671 | ||
2673 | internal void EnableAxisMotor(PhysicsVector axislock) | 2672 | internal void EnableAxisMotor(Vector3 axislock) |
2674 | { | 2673 | { |
2675 | if (m_aMotor != null) | 2674 | if (m_aMotor != null) |
2676 | DisableAxisMotor(); | 2675 | DisableAxisMotor(); |
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs index 18d4bab..9e048ab 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs | |||
@@ -139,7 +139,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
139 | 139 | ||
140 | } | 140 | } |
141 | 141 | ||
142 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 142 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
143 | { | 143 | { |
144 | BulletDotNETCharacter chr = new BulletDotNETCharacter(avName, this, position, size, avPIDD, avPIDP, | 144 | BulletDotNETCharacter chr = new BulletDotNETCharacter(avName, this, position, size, avPIDD, avPIDP, |
145 | avCapRadius, avStandupTensor, avDensity, | 145 | avCapRadius, avStandupTensor, avDensity, |
@@ -177,14 +177,14 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, | 180 | private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, |
181 | IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) | 181 | IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) |
182 | { | 182 | { |
183 | PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); | 183 | Vector3 pos = position; |
184 | //pos.X = position.X; | 184 | //pos.X = position.X; |
185 | //pos.Y = position.Y; | 185 | //pos.Y = position.Y; |
186 | //pos.Z = position.Z; | 186 | //pos.Z = position.Z; |
187 | PhysicsVector siz = new PhysicsVector(); | 187 | Vector3 siz = Vector3.Zero; |
188 | siz.X = size.X; | 188 | siz.X = size.X; |
189 | siz.Y = size.Y; | 189 | siz.Y = size.Y; |
190 | siz.Z = size.Z; | 190 | siz.Z = size.Z; |
@@ -201,12 +201,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
201 | return newPrim; | 201 | return newPrim; |
202 | } | 202 | } |
203 | 203 | ||
204 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) | 204 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation) |
205 | { | 205 | { |
206 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 206 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
207 | } | 207 | } |
208 | 208 | ||
209 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation, bool isPhysical) | 209 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical) |
210 | { | 210 | { |
211 | PhysicsActor result; | 211 | PhysicsActor result; |
212 | IMesh mesh = null; | 212 | IMesh mesh = null; |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 14b8f39..0b3cee7 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -52,14 +52,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
52 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 52 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
53 | 53 | ||
54 | //Vector3 | 54 | //Vector3 |
55 | public static Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) | 55 | public static Vector3 PhysicsVectorToXnaVector3(OpenMetaverse.Vector3 physicsVector) |
56 | { | 56 | { |
57 | return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); | 57 | return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); |
58 | } | 58 | } |
59 | 59 | ||
60 | public static PhysicsVector XnaVector3ToPhysicsVector(Vector3 xnaVector3) | 60 | public static OpenMetaverse.Vector3 XnaVector3ToPhysicsVector(Vector3 xnaVector3) |
61 | { | 61 | { |
62 | return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); | 62 | return new OpenMetaverse.Vector3(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); |
63 | } | 63 | } |
64 | 64 | ||
65 | //Quaternion | 65 | //Quaternion |
@@ -349,7 +349,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
349 | vertexBase = new Vector3[iVertexCount]; | 349 | vertexBase = new Vector3[iVertexCount]; |
350 | for (int i = 0; i < iVertexCount; i++) | 350 | for (int i = 0; i < iVertexCount; i++) |
351 | { | 351 | { |
352 | PhysicsVector v = mesh.getVertexList()[i]; | 352 | OpenMetaverse.Vector3 v = mesh.getVertexList()[i]; |
353 | if (v != null) // Note, null has special meaning. See meshing code for details | 353 | if (v != null) // Note, null has special meaning. See meshing code for details |
354 | vertexBase[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); | 354 | vertexBase[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); |
355 | else | 355 | else |
@@ -392,7 +392,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
392 | private int preCheckCollision(BulletXActor actA, Vector3 vNormal, float fDist) | 392 | private int preCheckCollision(BulletXActor actA, Vector3 vNormal, float fDist) |
393 | { | 393 | { |
394 | float fstartSide; | 394 | float fstartSide; |
395 | PhysicsVector v = actA.Position; | 395 | OpenMetaverse.Vector3 v = actA.Position; |
396 | Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); | 396 | Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); |
397 | 397 | ||
398 | fstartSide = Vector3.Dot(vNormal, v3) - fDist; | 398 | fstartSide = Vector3.Dot(vNormal, v3) - fDist; |
@@ -404,7 +404,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
404 | { | 404 | { |
405 | Vector3 perPlaneNormal; | 405 | Vector3 perPlaneNormal; |
406 | float fPerPlaneDist; | 406 | float fPerPlaneDist; |
407 | PhysicsVector v = actA.Position; | 407 | OpenMetaverse.Vector3 v = actA.Position; |
408 | Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); | 408 | Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v); |
409 | //check AB | 409 | //check AB |
410 | Vector3 v1; | 410 | Vector3 v1; |
@@ -573,9 +573,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
573 | 573 | ||
574 | } | 574 | } |
575 | 575 | ||
576 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 576 | public override PhysicsActor AddAvatar(string avName, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, bool isFlying) |
577 | { | 577 | { |
578 | PhysicsVector pos = new PhysicsVector(); | 578 | OpenMetaverse.Vector3 pos = OpenMetaverse.Vector3.Zero; |
579 | pos.X = position.X; | 579 | pos.X = position.X; |
580 | pos.Y = position.Y; | 580 | pos.Y = position.Y; |
581 | pos.Z = position.Z + 20; | 581 | pos.Z = position.Z + 20; |
@@ -611,14 +611,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
611 | } | 611 | } |
612 | } | 612 | } |
613 | 613 | ||
614 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 614 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, |
615 | PhysicsVector size, OpenMetaverse.Quaternion rotation) | 615 | OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation) |
616 | { | 616 | { |
617 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 617 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
618 | } | 618 | } |
619 | 619 | ||
620 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 620 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position, |
621 | PhysicsVector size, OpenMetaverse.Quaternion rotation, bool isPhysical) | 621 | OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical) |
622 | { | 622 | { |
623 | PhysicsActor result; | 623 | PhysicsActor result; |
624 | 624 | ||
@@ -645,7 +645,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
645 | return result; | 645 | return result; |
646 | } | 646 | } |
647 | 647 | ||
648 | public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, OpenMetaverse.Quaternion rotation, | 648 | public PhysicsActor AddPrim(String name, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, |
649 | IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) | 649 | IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) |
650 | { | 650 | { |
651 | BulletXPrim newPrim = null; | 651 | BulletXPrim newPrim = null; |
@@ -879,12 +879,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
879 | { | 879 | { |
880 | protected bool flying = false; | 880 | protected bool flying = false; |
881 | protected bool _physical = false; | 881 | protected bool _physical = false; |
882 | protected PhysicsVector _position; | 882 | protected OpenMetaverse.Vector3 _position; |
883 | protected PhysicsVector _velocity; | 883 | protected OpenMetaverse.Vector3 _velocity; |
884 | protected PhysicsVector _size; | 884 | protected OpenMetaverse.Vector3 _size; |
885 | protected PhysicsVector _acceleration; | 885 | protected OpenMetaverse.Vector3 _acceleration; |
886 | protected OpenMetaverse.Quaternion _orientation; | 886 | protected OpenMetaverse.Quaternion _orientation; |
887 | protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | 887 | protected OpenMetaverse.Vector3 m_rotationalVelocity; |
888 | protected RigidBody rigidBody; | 888 | protected RigidBody rigidBody; |
889 | protected int m_PhysicsActorType; | 889 | protected int m_PhysicsActorType; |
890 | private Boolean iscolliding = false; | 890 | private Boolean iscolliding = false; |
@@ -900,7 +900,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
900 | get { return false; } | 900 | get { return false; } |
901 | } | 901 | } |
902 | 902 | ||
903 | public override PhysicsVector Position | 903 | public override OpenMetaverse.Vector3 Position |
904 | { | 904 | { |
905 | get { return _position; } | 905 | get { return _position; } |
906 | set | 906 | set |
@@ -913,13 +913,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
913 | } | 913 | } |
914 | } | 914 | } |
915 | 915 | ||
916 | public override PhysicsVector RotationalVelocity | 916 | public override OpenMetaverse.Vector3 RotationalVelocity |
917 | { | 917 | { |
918 | get { return m_rotationalVelocity; } | 918 | get { return m_rotationalVelocity; } |
919 | set { m_rotationalVelocity = value; } | 919 | set { m_rotationalVelocity = value; } |
920 | } | 920 | } |
921 | 921 | ||
922 | public override PhysicsVector Velocity | 922 | public override OpenMetaverse.Vector3 Velocity |
923 | { | 923 | { |
924 | get { return _velocity; } | 924 | get { return _velocity; } |
925 | set | 925 | set |
@@ -934,7 +934,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
934 | } | 934 | } |
935 | else | 935 | else |
936 | { | 936 | { |
937 | _velocity = new PhysicsVector(); | 937 | _velocity = OpenMetaverse.Vector3.Zero; |
938 | } | 938 | } |
939 | } | 939 | } |
940 | } | 940 | } |
@@ -944,7 +944,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
944 | get { return 0f; } | 944 | get { return 0f; } |
945 | set { } | 945 | set { } |
946 | } | 946 | } |
947 | public override PhysicsVector Size | 947 | public override OpenMetaverse.Vector3 Size |
948 | { | 948 | { |
949 | get { return _size; } | 949 | get { return _size; } |
950 | set | 950 | set |
@@ -956,9 +956,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
956 | } | 956 | } |
957 | } | 957 | } |
958 | 958 | ||
959 | public override PhysicsVector Force | 959 | public override OpenMetaverse.Vector3 Force |
960 | { | 960 | { |
961 | get { return PhysicsVector.Zero; } | 961 | get { return OpenMetaverse.Vector3.Zero; } |
962 | set { return; } | 962 | set { return; } |
963 | } | 963 | } |
964 | 964 | ||
@@ -973,7 +973,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
973 | 973 | ||
974 | } | 974 | } |
975 | 975 | ||
976 | public override void VehicleVectorParam(int param, PhysicsVector value) | 976 | public override void VehicleVectorParam(int param, OpenMetaverse.Vector3 value) |
977 | { | 977 | { |
978 | 978 | ||
979 | } | 979 | } |
@@ -988,14 +988,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
988 | 988 | ||
989 | } | 989 | } |
990 | 990 | ||
991 | public override PhysicsVector CenterOfMass | 991 | public override OpenMetaverse.Vector3 CenterOfMass |
992 | { | 992 | { |
993 | get { return PhysicsVector.Zero; } | 993 | get { return OpenMetaverse.Vector3.Zero; } |
994 | } | 994 | } |
995 | 995 | ||
996 | public override PhysicsVector GeometricCenter | 996 | public override OpenMetaverse.Vector3 GeometricCenter |
997 | { | 997 | { |
998 | get { return PhysicsVector.Zero; } | 998 | get { return OpenMetaverse.Vector3.Zero; } |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | public override PrimitiveBaseShape Shape | 1001 | public override PrimitiveBaseShape Shape |
@@ -1009,7 +1009,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1009 | set { return; } | 1009 | set { return; } |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | public override PhysicsVector Acceleration | 1012 | public override OpenMetaverse.Vector3 Acceleration |
1013 | { | 1013 | { |
1014 | get { return _acceleration; } | 1014 | get { return _acceleration; } |
1015 | } | 1015 | } |
@@ -1036,7 +1036,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1036 | 1036 | ||
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | public override void LockAngularMotion(PhysicsVector axis) | 1039 | public override void LockAngularMotion(OpenMetaverse.Vector3 axis) |
1040 | { | 1040 | { |
1041 | 1041 | ||
1042 | } | 1042 | } |
@@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1129 | set { return; } | 1129 | set { return; } |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | public virtual void SetAcceleration(PhysicsVector accel) | 1132 | public virtual void SetAcceleration(OpenMetaverse.Vector3 accel) |
1133 | { | 1133 | { |
1134 | lock (BulletXScene.BulletXLock) | 1134 | lock (BulletXScene.BulletXLock) |
1135 | { | 1135 | { |
@@ -1143,19 +1143,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1143 | set { } | 1143 | set { } |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | public override void AddForce(PhysicsVector force, bool pushforce) | 1146 | public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce) |
1147 | { | 1147 | { |
1148 | } | 1148 | } |
1149 | public override PhysicsVector Torque | 1149 | public override OpenMetaverse.Vector3 Torque |
1150 | { | 1150 | { |
1151 | get { return PhysicsVector.Zero; } | 1151 | get { return OpenMetaverse.Vector3.Zero; } |
1152 | set { return; } | 1152 | set { return; } |
1153 | } | 1153 | } |
1154 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 1154 | public override void AddAngularForce(OpenMetaverse.Vector3 force, bool pushforce) |
1155 | { | 1155 | { |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | public override void SetMomentum(PhysicsVector momentum) | 1158 | public override void SetMomentum(OpenMetaverse.Vector3 momentum) |
1159 | { | 1159 | { |
1160 | } | 1160 | } |
1161 | 1161 | ||
@@ -1174,7 +1174,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1174 | Translate(_position); | 1174 | Translate(_position); |
1175 | } | 1175 | } |
1176 | 1176 | ||
1177 | protected internal void Translate(PhysicsVector _newPos) | 1177 | protected internal void Translate(OpenMetaverse.Vector3 _newPos) |
1178 | { | 1178 | { |
1179 | Vector3 _translation; | 1179 | Vector3 _translation; |
1180 | _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; | 1180 | _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; |
@@ -1186,7 +1186,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1186 | Speed(_velocity); | 1186 | Speed(_velocity); |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | protected internal void Speed(PhysicsVector _newSpeed) | 1189 | protected internal void Speed(OpenMetaverse.Vector3 _newSpeed) |
1190 | { | 1190 | { |
1191 | Vector3 _speed; | 1191 | Vector3 _speed; |
1192 | _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); | 1192 | _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); |
@@ -1212,7 +1212,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1212 | ReSize(_size); | 1212 | ReSize(_size); |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | protected internal virtual void ReSize(PhysicsVector _newSize) | 1215 | protected internal virtual void ReSize(OpenMetaverse.Vector3 _newSize) |
1216 | { | 1216 | { |
1217 | } | 1217 | } |
1218 | 1218 | ||
@@ -1227,7 +1227,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1227 | { | 1227 | { |
1228 | 1228 | ||
1229 | } | 1229 | } |
1230 | public override PhysicsVector PIDTarget { set { return; } } | 1230 | public override OpenMetaverse.Vector3 PIDTarget { set { return; } } |
1231 | public override bool PIDActive { set { return; } } | 1231 | public override bool PIDActive { set { return; } } |
1232 | public override float PIDTau { set { return; } } | 1232 | public override float PIDTau { set { return; } } |
1233 | 1233 | ||
@@ -1276,19 +1276,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1276 | /// </summary> | 1276 | /// </summary> |
1277 | public class BulletXCharacter : BulletXActor | 1277 | public class BulletXCharacter : BulletXActor |
1278 | { | 1278 | { |
1279 | public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos) | 1279 | public BulletXCharacter(BulletXScene parent_scene, OpenMetaverse.Vector3 pos) |
1280 | : this(String.Empty, parent_scene, pos) | 1280 | : this(String.Empty, parent_scene, pos) |
1281 | { | 1281 | { |
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) | 1284 | public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos) |
1285 | : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), | 1285 | : this(avName, parent_scene, pos, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero, |
1286 | OpenMetaverse.Quaternion.Identity) | 1286 | OpenMetaverse.Quaternion.Identity) |
1287 | { | 1287 | { |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, | 1290 | public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity, |
1291 | PhysicsVector size, PhysicsVector acceleration, OpenMetaverse.Quaternion orientation) | 1291 | OpenMetaverse.Vector3 size, OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion orientation) |
1292 | : base(avName) | 1292 | : base(avName) |
1293 | { | 1293 | { |
1294 | //This fields will be removed. They're temporal | 1294 | //This fields will be removed. They're temporal |
@@ -1343,25 +1343,25 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1343 | set { return; } | 1343 | set { return; } |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | public override PhysicsVector Position | 1346 | public override OpenMetaverse.Vector3 Position |
1347 | { | 1347 | { |
1348 | get { return base.Position; } | 1348 | get { return base.Position; } |
1349 | set { base.Position = value; } | 1349 | set { base.Position = value; } |
1350 | } | 1350 | } |
1351 | 1351 | ||
1352 | public override PhysicsVector Velocity | 1352 | public override OpenMetaverse.Vector3 Velocity |
1353 | { | 1353 | { |
1354 | get { return base.Velocity; } | 1354 | get { return base.Velocity; } |
1355 | set { base.Velocity = value; } | 1355 | set { base.Velocity = value; } |
1356 | } | 1356 | } |
1357 | 1357 | ||
1358 | public override PhysicsVector Size | 1358 | public override OpenMetaverse.Vector3 Size |
1359 | { | 1359 | { |
1360 | get { return base.Size; } | 1360 | get { return base.Size; } |
1361 | set { base.Size = value; } | 1361 | set { base.Size = value; } |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | public override PhysicsVector Acceleration | 1364 | public override OpenMetaverse.Vector3 Acceleration |
1365 | { | 1365 | { |
1366 | get { return base.Acceleration; } | 1366 | get { return base.Acceleration; } |
1367 | } | 1367 | } |
@@ -1390,17 +1390,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1390 | set { base.Kinematic = value; } | 1390 | set { base.Kinematic = value; } |
1391 | } | 1391 | } |
1392 | 1392 | ||
1393 | public override void SetAcceleration(PhysicsVector accel) | 1393 | public override void SetAcceleration(OpenMetaverse.Vector3 accel) |
1394 | { | 1394 | { |
1395 | base.SetAcceleration(accel); | 1395 | base.SetAcceleration(accel); |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | public override void AddForce(PhysicsVector force, bool pushforce) | 1398 | public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce) |
1399 | { | 1399 | { |
1400 | base.AddForce(force, pushforce); | 1400 | base.AddForce(force, pushforce); |
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | public override void SetMomentum(PhysicsVector momentum) | 1403 | public override void SetMomentum(OpenMetaverse.Vector3 momentum) |
1404 | { | 1404 | { |
1405 | base.SetMomentum(momentum); | 1405 | base.SetMomentum(momentum); |
1406 | } | 1406 | } |
@@ -1450,7 +1450,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1450 | m.Translation = v3; | 1450 | m.Translation = v3; |
1451 | rigidBody.WorldTransform = m; | 1451 | rigidBody.WorldTransform = m; |
1452 | //When an Avie touch the ground it's vertical velocity it's reduced to ZERO | 1452 | //When an Avie touch the ground it's vertical velocity it's reduced to ZERO |
1453 | Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); | 1453 | Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); |
1454 | } | 1454 | } |
1455 | } | 1455 | } |
1456 | 1456 | ||
@@ -1472,7 +1472,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1472 | //For now all prims have the same density, all prims are made of water. Be water my friend! :D | 1472 | //For now all prims have the same density, all prims are made of water. Be water my friend! :D |
1473 | private const float _density = 1000.0f; | 1473 | private const float _density = 1000.0f; |
1474 | private BulletXScene _parent_scene; | 1474 | private BulletXScene _parent_scene; |
1475 | private PhysicsVector m_prev_position = new PhysicsVector(0, 0, 0); | 1475 | private OpenMetaverse.Vector3 m_prev_position; |
1476 | private bool m_lastUpdateSent = false; | 1476 | private bool m_lastUpdateSent = false; |
1477 | //added by jed zhu | 1477 | //added by jed zhu |
1478 | private IMesh _mesh; | 1478 | private IMesh _mesh; |
@@ -1480,17 +1480,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1480 | 1480 | ||
1481 | 1481 | ||
1482 | 1482 | ||
1483 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, | 1483 | public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 size, |
1484 | OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) | 1484 | OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) |
1485 | : this( | 1485 | : this( |
1486 | primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs, | 1486 | primName, parent_scene, pos, OpenMetaverse.Vector3.Zero, size, OpenMetaverse.Vector3.Zero, rotation, mesh, pbs, |
1487 | isPhysical) | 1487 | isPhysical) |
1488 | { | 1488 | { |
1489 | } | 1489 | } |
1490 | 1490 | ||
1491 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, | 1491 | public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity, |
1492 | PhysicsVector size, | 1492 | OpenMetaverse.Vector3 size, |
1493 | PhysicsVector acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, | 1493 | OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, |
1494 | bool isPhysical) | 1494 | bool isPhysical) |
1495 | : base(primName) | 1495 | : base(primName) |
1496 | { | 1496 | { |
@@ -1501,7 +1501,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1501 | 1501 | ||
1502 | _position = pos; | 1502 | _position = pos; |
1503 | _physical = isPhysical; | 1503 | _physical = isPhysical; |
1504 | _velocity = _physical ? velocity : new PhysicsVector(); | 1504 | _velocity = _physical ? velocity : OpenMetaverse.Vector3.Zero; |
1505 | _size = size; | 1505 | _size = size; |
1506 | _acceleration = acceleration; | 1506 | _acceleration = acceleration; |
1507 | _orientation = rotation; | 1507 | _orientation = rotation; |
@@ -1517,19 +1517,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1517 | set { return; } | 1517 | set { return; } |
1518 | } | 1518 | } |
1519 | 1519 | ||
1520 | public override PhysicsVector Position | 1520 | public override OpenMetaverse.Vector3 Position |
1521 | { | 1521 | { |
1522 | get { return base.Position; } | 1522 | get { return base.Position; } |
1523 | set { base.Position = value; } | 1523 | set { base.Position = value; } |
1524 | } | 1524 | } |
1525 | 1525 | ||
1526 | public override PhysicsVector Velocity | 1526 | public override OpenMetaverse.Vector3 Velocity |
1527 | { | 1527 | { |
1528 | get { return base.Velocity; } | 1528 | get { return base.Velocity; } |
1529 | set { base.Velocity = value; } | 1529 | set { base.Velocity = value; } |
1530 | } | 1530 | } |
1531 | 1531 | ||
1532 | public override PhysicsVector Size | 1532 | public override OpenMetaverse.Vector3 Size |
1533 | { | 1533 | { |
1534 | get { return _size; } | 1534 | get { return _size; } |
1535 | set | 1535 | set |
@@ -1542,7 +1542,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1542 | } | 1542 | } |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | public override PhysicsVector Acceleration | 1545 | public override OpenMetaverse.Vector3 Acceleration |
1546 | { | 1546 | { |
1547 | get { return base.Acceleration; } | 1547 | get { return base.Acceleration; } |
1548 | } | 1548 | } |
@@ -1603,7 +1603,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1603 | set { base.Kinematic = value; } | 1603 | set { base.Kinematic = value; } |
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | public override void SetAcceleration(PhysicsVector accel) | 1606 | public override void SetAcceleration(OpenMetaverse.Vector3 accel) |
1607 | { | 1607 | { |
1608 | lock (BulletXScene.BulletXLock) | 1608 | lock (BulletXScene.BulletXLock) |
1609 | { | 1609 | { |
@@ -1611,12 +1611,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1611 | } | 1611 | } |
1612 | } | 1612 | } |
1613 | 1613 | ||
1614 | public override void AddForce(PhysicsVector force, bool pushforce) | 1614 | public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce) |
1615 | { | 1615 | { |
1616 | base.AddForce(force,pushforce); | 1616 | base.AddForce(force,pushforce); |
1617 | } | 1617 | } |
1618 | 1618 | ||
1619 | public override void SetMomentum(PhysicsVector momentum) | 1619 | public override void SetMomentum(OpenMetaverse.Vector3 momentum) |
1620 | { | 1620 | { |
1621 | base.SetMomentum(momentum); | 1621 | base.SetMomentum(momentum); |
1622 | } | 1622 | } |
@@ -1633,7 +1633,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1633 | //When a Prim touch the ground it's vertical velocity it's reduced to ZERO | 1633 | //When a Prim touch the ground it's vertical velocity it's reduced to ZERO |
1634 | //Static objects don't have linear velocity | 1634 | //Static objects don't have linear velocity |
1635 | if (_physical) | 1635 | if (_physical) |
1636 | Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); | 1636 | Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); |
1637 | } | 1637 | } |
1638 | } | 1638 | } |
1639 | 1639 | ||
@@ -1652,7 +1652,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1652 | { | 1652 | { |
1653 | if (!m_lastUpdateSent) | 1653 | if (!m_lastUpdateSent) |
1654 | { | 1654 | { |
1655 | _velocity = new PhysicsVector(0, 0, 0); | 1655 | _velocity = OpenMetaverse.Vector3.Zero; |
1656 | base.ScheduleTerseUpdate(); | 1656 | base.ScheduleTerseUpdate(); |
1657 | m_lastUpdateSent = true; | 1657 | m_lastUpdateSent = true; |
1658 | } | 1658 | } |
@@ -1674,8 +1674,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1674 | 1674 | ||
1675 | #region Methods for updating values of RigidBody | 1675 | #region Methods for updating values of RigidBody |
1676 | 1676 | ||
1677 | protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, PhysicsVector pos, | 1677 | protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, OpenMetaverse.Vector3 pos, |
1678 | PhysicsVector size) | 1678 | OpenMetaverse.Vector3 size) |
1679 | { | 1679 | { |
1680 | //For RigidBody Constructor. The next values might change | 1680 | //For RigidBody Constructor. The next values might change |
1681 | float _linearDamping = 0.0f; | 1681 | float _linearDamping = 0.0f; |
@@ -1703,7 +1703,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1703 | Vector3[] v3Vertices = new Vector3[iVertexCount]; | 1703 | Vector3[] v3Vertices = new Vector3[iVertexCount]; |
1704 | for (int i = 0; i < iVertexCount; i++) | 1704 | for (int i = 0; i < iVertexCount; i++) |
1705 | { | 1705 | { |
1706 | PhysicsVector v = mesh.getVertexList()[i]; | 1706 | OpenMetaverse.Vector3 v = mesh.getVertexList()[i]; |
1707 | if (v != null) // Note, null has special meaning. See meshing code for details | 1707 | if (v != null) // Note, null has special meaning. See meshing code for details |
1708 | v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); | 1708 | v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); |
1709 | else | 1709 | else |
@@ -1729,7 +1729,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1729 | } | 1729 | } |
1730 | } | 1730 | } |
1731 | 1731 | ||
1732 | protected internal void ReCreateRigidBody(PhysicsVector size) | 1732 | protected internal void ReCreateRigidBody(OpenMetaverse.Vector3 size) |
1733 | { | 1733 | { |
1734 | //There is a bug when trying to remove a rigidBody that is colliding with something.. | 1734 | //There is a bug when trying to remove a rigidBody that is colliding with something.. |
1735 | try | 1735 | try |
@@ -1749,7 +1749,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1749 | GC.Collect(); | 1749 | GC.Collect(); |
1750 | } | 1750 | } |
1751 | 1751 | ||
1752 | protected internal override void ReSize(PhysicsVector _newSize) | 1752 | protected internal override void ReSize(OpenMetaverse.Vector3 _newSize) |
1753 | { | 1753 | { |
1754 | //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't | 1754 | //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't |
1755 | //so i have to do it manually. That's recreating rigidbody | 1755 | //so i have to do it manually. That's recreating rigidbody |
@@ -1764,8 +1764,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1764 | /// </summary> | 1764 | /// </summary> |
1765 | internal class BulletXPlanet | 1765 | internal class BulletXPlanet |
1766 | { | 1766 | { |
1767 | private PhysicsVector _staticPosition; | 1767 | private OpenMetaverse.Vector3 _staticPosition; |
1768 | // private PhysicsVector _staticVelocity; | 1768 | // private Vector3 _staticVelocity; |
1769 | // private OpenMetaverse.Quaternion _staticOrientation; | 1769 | // private OpenMetaverse.Quaternion _staticOrientation; |
1770 | private float _mass; | 1770 | private float _mass; |
1771 | // private BulletXScene _parentscene; | 1771 | // private BulletXScene _parentscene; |
@@ -1779,7 +1779,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1779 | 1779 | ||
1780 | internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) | 1780 | internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) |
1781 | { | 1781 | { |
1782 | _staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0); | 1782 | _staticPosition = new OpenMetaverse.Vector3(BulletXScene.MaxXY / 2, BulletXScene.MaxXY / 2, 0); |
1783 | // _staticVelocity = new PhysicsVector(); | 1783 | // _staticVelocity = new PhysicsVector(); |
1784 | // _staticOrientation = OpenMetaverse.Quaternion.Identity; | 1784 | // _staticOrientation = OpenMetaverse.Quaternion.Identity; |
1785 | _mass = 0; //No active | 1785 | _mass = 0; //No active |
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs index 1a8c948..1181b8d 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/Physics/Manager/IMesher.cs | |||
@@ -28,13 +28,14 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenMetaverse; | ||
31 | 32 | ||
32 | namespace OpenSim.Region.Physics.Manager | 33 | namespace OpenSim.Region.Physics.Manager |
33 | { | 34 | { |
34 | public interface IMesher | 35 | public interface IMesher |
35 | { | 36 | { |
36 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod); | 37 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); |
37 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical); | 38 | IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); |
38 | } | 39 | } |
39 | 40 | ||
40 | public interface IVertex | 41 | public interface IVertex |
@@ -43,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager | |||
43 | 44 | ||
44 | public interface IMesh | 45 | public interface IMesh |
45 | { | 46 | { |
46 | List<PhysicsVector> getVertexList(); | 47 | List<Vector3> getVertexList(); |
47 | int[] getIndexListAsInt(); | 48 | int[] getIndexListAsInt(); |
48 | int[] getIndexListAsIntLocked(); | 49 | int[] getIndexListAsIntLocked(); |
49 | float[] getVertexListAsFloatLocked(); | 50 | float[] getVertexListAsFloatLocked(); |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 566746a..ea4db70 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -32,8 +32,8 @@ using OpenMetaverse; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.Physics.Manager | 33 | namespace OpenSim.Region.Physics.Manager |
34 | { | 34 | { |
35 | public delegate void PositionUpdate(PhysicsVector position); | 35 | public delegate void PositionUpdate(Vector3 position); |
36 | public delegate void VelocityUpdate(PhysicsVector velocity); | 36 | public delegate void VelocityUpdate(Vector3 velocity); |
37 | public delegate void OrientationUpdate(Quaternion orientation); | 37 | public delegate void OrientationUpdate(Quaternion orientation); |
38 | 38 | ||
39 | public enum ActorTypes : int | 39 | public enum ActorTypes : int |
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Physics.Manager | |||
106 | { | 106 | { |
107 | public delegate void RequestTerseUpdate(); | 107 | public delegate void RequestTerseUpdate(); |
108 | public delegate void CollisionUpdate(EventArgs e); | 108 | public delegate void CollisionUpdate(EventArgs e); |
109 | public delegate void OutOfBounds(PhysicsVector pos); | 109 | public delegate void OutOfBounds(Vector3 pos); |
110 | 110 | ||
111 | // disable warning: public events | 111 | // disable warning: public events |
112 | #pragma warning disable 67 | 112 | #pragma warning disable 67 |
@@ -125,7 +125,7 @@ namespace OpenSim.Region.Physics.Manager | |||
125 | 125 | ||
126 | public abstract bool Stopped { get; } | 126 | public abstract bool Stopped { get; } |
127 | 127 | ||
128 | public abstract PhysicsVector Size { get; set; } | 128 | public abstract Vector3 Size { get; set; } |
129 | 129 | ||
130 | public abstract PrimitiveBaseShape Shape { set; } | 130 | public abstract PrimitiveBaseShape Shape { set; } |
131 | 131 | ||
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.Manager | |||
144 | 144 | ||
145 | public abstract void delink(); | 145 | public abstract void delink(); |
146 | 146 | ||
147 | public abstract void LockAngularMotion(PhysicsVector axis); | 147 | public abstract void LockAngularMotion(Vector3 axis); |
148 | 148 | ||
149 | public virtual void RequestPhysicsterseUpdate() | 149 | public virtual void RequestPhysicsterseUpdate() |
150 | { | 150 | { |
@@ -159,7 +159,7 @@ namespace OpenSim.Region.Physics.Manager | |||
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | public virtual void RaiseOutOfBounds(PhysicsVector pos) | 162 | public virtual void RaiseOutOfBounds(Vector3 pos) |
163 | { | 163 | { |
164 | // Make a temporary copy of the event to avoid possibility of | 164 | // Make a temporary copy of the event to avoid possibility of |
165 | // a race condition if the last subscriber unsubscribes | 165 | // a race condition if the last subscriber unsubscribes |
@@ -187,23 +187,23 @@ namespace OpenSim.Region.Physics.Manager | |||
187 | 187 | ||
188 | } | 188 | } |
189 | 189 | ||
190 | public abstract PhysicsVector Position { get; set; } | 190 | public abstract Vector3 Position { get; set; } |
191 | public abstract float Mass { get; } | 191 | public abstract float Mass { get; } |
192 | public abstract PhysicsVector Force { get; set; } | 192 | public abstract Vector3 Force { get; set; } |
193 | 193 | ||
194 | public abstract int VehicleType { get; set; } | 194 | public abstract int VehicleType { get; set; } |
195 | public abstract void VehicleFloatParam(int param, float value); | 195 | public abstract void VehicleFloatParam(int param, float value); |
196 | public abstract void VehicleVectorParam(int param, PhysicsVector value); | 196 | public abstract void VehicleVectorParam(int param, Vector3 value); |
197 | public abstract void VehicleRotationParam(int param, Quaternion rotation); | 197 | public abstract void VehicleRotationParam(int param, Quaternion rotation); |
198 | 198 | ||
199 | public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more | 199 | public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more |
200 | 200 | ||
201 | public abstract PhysicsVector GeometricCenter { get; } | 201 | public abstract Vector3 GeometricCenter { get; } |
202 | public abstract PhysicsVector CenterOfMass { get; } | 202 | public abstract Vector3 CenterOfMass { get; } |
203 | public abstract PhysicsVector Velocity { get; set; } | 203 | public abstract Vector3 Velocity { get; set; } |
204 | public abstract PhysicsVector Torque { get; set; } | 204 | public abstract Vector3 Torque { get; set; } |
205 | public abstract float CollisionScore { get; set;} | 205 | public abstract float CollisionScore { get; set;} |
206 | public abstract PhysicsVector Acceleration { get; } | 206 | public abstract Vector3 Acceleration { get; } |
207 | public abstract Quaternion Orientation { get; set; } | 207 | public abstract Quaternion Orientation { get; set; } |
208 | public abstract int PhysicsActorType { get; set; } | 208 | public abstract int PhysicsActorType { get; set; } |
209 | public abstract bool IsPhysical { get; set; } | 209 | public abstract bool IsPhysical { get; set; } |
@@ -214,12 +214,12 @@ namespace OpenSim.Region.Physics.Manager | |||
214 | public abstract bool CollidingGround { get; set; } | 214 | public abstract bool CollidingGround { get; set; } |
215 | public abstract bool CollidingObj { get; set; } | 215 | public abstract bool CollidingObj { get; set; } |
216 | public abstract bool FloatOnWater { set; } | 216 | public abstract bool FloatOnWater { set; } |
217 | public abstract PhysicsVector RotationalVelocity { get; set; } | 217 | public abstract Vector3 RotationalVelocity { get; set; } |
218 | public abstract bool Kinematic { get; set; } | 218 | public abstract bool Kinematic { get; set; } |
219 | public abstract float Buoyancy { get; set; } | 219 | public abstract float Buoyancy { get; set; } |
220 | 220 | ||
221 | // Used for MoveTo | 221 | // Used for MoveTo |
222 | public abstract PhysicsVector PIDTarget { set;} | 222 | public abstract Vector3 PIDTarget { set; } |
223 | public abstract bool PIDActive { set;} | 223 | public abstract bool PIDActive { set;} |
224 | public abstract float PIDTau { set; } | 224 | public abstract float PIDTau { set; } |
225 | 225 | ||
@@ -251,9 +251,9 @@ namespace OpenSim.Region.Physics.Manager | |||
251 | get{ return false; } | 251 | get{ return false; } |
252 | } | 252 | } |
253 | 253 | ||
254 | public override PhysicsVector Position | 254 | public override Vector3 Position |
255 | { | 255 | { |
256 | get { return PhysicsVector.Zero; } | 256 | get { return Vector3.Zero; } |
257 | set { return; } | 257 | set { return; } |
258 | } | 258 | } |
259 | 259 | ||
@@ -301,9 +301,9 @@ namespace OpenSim.Region.Physics.Manager | |||
301 | set { return; } | 301 | set { return; } |
302 | } | 302 | } |
303 | 303 | ||
304 | public override PhysicsVector Size | 304 | public override Vector3 Size |
305 | { | 305 | { |
306 | get { return PhysicsVector.Zero; } | 306 | get { return Vector3.Zero; } |
307 | set { return; } | 307 | set { return; } |
308 | } | 308 | } |
309 | 309 | ||
@@ -312,9 +312,9 @@ namespace OpenSim.Region.Physics.Manager | |||
312 | get { return 0f; } | 312 | get { return 0f; } |
313 | } | 313 | } |
314 | 314 | ||
315 | public override PhysicsVector Force | 315 | public override Vector3 Force |
316 | { | 316 | { |
317 | get { return PhysicsVector.Zero; } | 317 | get { return Vector3.Zero; } |
318 | set { return; } | 318 | set { return; } |
319 | } | 319 | } |
320 | 320 | ||
@@ -329,7 +329,7 @@ namespace OpenSim.Region.Physics.Manager | |||
329 | 329 | ||
330 | } | 330 | } |
331 | 331 | ||
332 | public override void VehicleVectorParam(int param, PhysicsVector value) | 332 | public override void VehicleVectorParam(int param, Vector3 value) |
333 | { | 333 | { |
334 | 334 | ||
335 | } | 335 | } |
@@ -349,14 +349,14 @@ namespace OpenSim.Region.Physics.Manager | |||
349 | 349 | ||
350 | } | 350 | } |
351 | 351 | ||
352 | public override PhysicsVector CenterOfMass | 352 | public override Vector3 CenterOfMass |
353 | { | 353 | { |
354 | get { return PhysicsVector.Zero; } | 354 | get { return Vector3.Zero; } |
355 | } | 355 | } |
356 | 356 | ||
357 | public override PhysicsVector GeometricCenter | 357 | public override Vector3 GeometricCenter |
358 | { | 358 | { |
359 | get { return PhysicsVector.Zero; } | 359 | get { return Vector3.Zero; } |
360 | } | 360 | } |
361 | 361 | ||
362 | public override PrimitiveBaseShape Shape | 362 | public override PrimitiveBaseShape Shape |
@@ -364,15 +364,15 @@ namespace OpenSim.Region.Physics.Manager | |||
364 | set { return; } | 364 | set { return; } |
365 | } | 365 | } |
366 | 366 | ||
367 | public override PhysicsVector Velocity | 367 | public override Vector3 Velocity |
368 | { | 368 | { |
369 | get { return PhysicsVector.Zero; } | 369 | get { return Vector3.Zero; } |
370 | set { return; } | 370 | set { return; } |
371 | } | 371 | } |
372 | 372 | ||
373 | public override PhysicsVector Torque | 373 | public override Vector3 Torque |
374 | { | 374 | { |
375 | get { return PhysicsVector.Zero; } | 375 | get { return Vector3.Zero; } |
376 | set { return; } | 376 | set { return; } |
377 | } | 377 | } |
378 | 378 | ||
@@ -392,9 +392,9 @@ namespace OpenSim.Region.Physics.Manager | |||
392 | set { } | 392 | set { } |
393 | } | 393 | } |
394 | 394 | ||
395 | public override PhysicsVector Acceleration | 395 | public override Vector3 Acceleration |
396 | { | 396 | { |
397 | get { return PhysicsVector.Zero; } | 397 | get { return Vector3.Zero; } |
398 | } | 398 | } |
399 | 399 | ||
400 | public override bool IsPhysical | 400 | public override bool IsPhysical |
@@ -441,26 +441,26 @@ namespace OpenSim.Region.Physics.Manager | |||
441 | { | 441 | { |
442 | } | 442 | } |
443 | 443 | ||
444 | public override void LockAngularMotion(PhysicsVector axis) | 444 | public override void LockAngularMotion(Vector3 axis) |
445 | { | 445 | { |
446 | } | 446 | } |
447 | 447 | ||
448 | public override void AddForce(PhysicsVector force, bool pushforce) | 448 | public override void AddForce(Vector3 force, bool pushforce) |
449 | { | 449 | { |
450 | } | 450 | } |
451 | 451 | ||
452 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 452 | public override void AddAngularForce(Vector3 force, bool pushforce) |
453 | { | 453 | { |
454 | 454 | ||
455 | } | 455 | } |
456 | 456 | ||
457 | public override PhysicsVector RotationalVelocity | 457 | public override Vector3 RotationalVelocity |
458 | { | 458 | { |
459 | get { return PhysicsVector.Zero; } | 459 | get { return Vector3.Zero; } |
460 | set { return; } | 460 | set { return; } |
461 | } | 461 | } |
462 | 462 | ||
463 | public override PhysicsVector PIDTarget { set { return; } } | 463 | public override Vector3 PIDTarget { set { return; } } |
464 | public override bool PIDActive { set { return; } } | 464 | public override bool PIDActive { set { return; } } |
465 | public override float PIDTau { set { return; } } | 465 | public override float PIDTau { set { return; } } |
466 | 466 | ||
@@ -475,7 +475,7 @@ namespace OpenSim.Region.Physics.Manager | |||
475 | public override float APIDDamping { set { return; } } | 475 | public override float APIDDamping { set { return; } } |
476 | 476 | ||
477 | 477 | ||
478 | public override void SetMomentum(PhysicsVector momentum) | 478 | public override void SetMomentum(Vector3 momentum) |
479 | { | 479 | { |
480 | } | 480 | } |
481 | 481 | ||
diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs index f463597..b685d04 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager | |||
44 | public PhysicsJointType Type; | 44 | public PhysicsJointType Type; |
45 | public string RawParams; | 45 | public string RawParams; |
46 | public List<string> BodyNames = new List<string>(); | 46 | public List<string> BodyNames = new List<string>(); |
47 | public PhysicsVector Position; // global coords | 47 | public Vector3 Position; // global coords |
48 | public Quaternion Rotation; // global coords | 48 | public Quaternion Rotation; // global coords |
49 | public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation | 49 | public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation |
50 | public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) | 50 | public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 6dd26bb..bb0d18e 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -64,23 +64,23 @@ namespace OpenSim.Region.Physics.Manager | |||
64 | 64 | ||
65 | public abstract void Initialise(IMesher meshmerizer, IConfigSource config); | 65 | public abstract void Initialise(IMesher meshmerizer, IConfigSource config); |
66 | 66 | ||
67 | public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying); | 67 | public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); |
68 | 68 | ||
69 | public abstract void RemoveAvatar(PhysicsActor actor); | 69 | public abstract void RemoveAvatar(PhysicsActor actor); |
70 | 70 | ||
71 | public abstract void RemovePrim(PhysicsActor prim); | 71 | public abstract void RemovePrim(PhysicsActor prim); |
72 | 72 | ||
73 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 73 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
74 | PhysicsVector size, Quaternion rotation); //To be removed | 74 | Vector3 size, Quaternion rotation); //To be removed |
75 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 75 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
76 | PhysicsVector size, Quaternion rotation, bool isPhysical); | 76 | Vector3 size, Quaternion rotation, bool isPhysical); |
77 | 77 | ||
78 | public virtual bool SupportsNINJAJoints | 78 | public virtual bool SupportsNINJAJoints |
79 | { | 79 | { |
80 | get { return false; } | 80 | get { return false; } |
81 | } | 81 | } |
82 | 82 | ||
83 | public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position, | 83 | public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position, |
84 | Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation) | 84 | Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation) |
85 | { return null; } | 85 | { return null; } |
86 | 86 | ||
@@ -129,11 +129,11 @@ namespace OpenSim.Region.Physics.Manager | |||
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | public virtual PhysicsVector GetJointAnchor(PhysicsJoint joint) | 132 | public virtual Vector3 GetJointAnchor(PhysicsJoint joint) |
133 | { return null; } | 133 | { return Vector3.Zero; } |
134 | 134 | ||
135 | public virtual PhysicsVector GetJointAxis(PhysicsJoint joint) | 135 | public virtual Vector3 GetJointAxis(PhysicsJoint joint) |
136 | { return null; } | 136 | { return Vector3.Zero; } |
137 | 137 | ||
138 | 138 | ||
139 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); | 139 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); |
@@ -212,7 +212,7 @@ namespace OpenSim.Region.Physics.Manager | |||
212 | // Does nothing right now | 212 | // Does nothing right now |
213 | } | 213 | } |
214 | 214 | ||
215 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 215 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
216 | { | 216 | { |
217 | m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); | 217 | m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); |
218 | return PhysicsActor.Null; | 218 | return PhysicsActor.Null; |
@@ -231,21 +231,21 @@ namespace OpenSim.Region.Physics.Manager | |||
231 | } | 231 | } |
232 | 232 | ||
233 | /* | 233 | /* |
234 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) | 234 | public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) |
235 | { | 235 | { |
236 | m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size); | 236 | m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size); |
237 | return PhysicsActor.Null; | 237 | return PhysicsActor.Null; |
238 | } | 238 | } |
239 | */ | 239 | */ |
240 | 240 | ||
241 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 241 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
242 | PhysicsVector size, Quaternion rotation) //To be removed | 242 | Vector3 size, Quaternion rotation) //To be removed |
243 | { | 243 | { |
244 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 244 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
245 | } | 245 | } |
246 | 246 | ||
247 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 247 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
248 | PhysicsVector size, Quaternion rotation, bool isPhysical) | 248 | Vector3 size, Quaternion rotation, bool isPhysical) |
249 | { | 249 | { |
250 | m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); | 250 | m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size); |
251 | return PhysicsActor.Null; | 251 | return PhysicsActor.Null; |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs b/OpenSim/Region/Physics/Manager/PhysicsSensor.cs index 090ad52..f480d71 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsSensor.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Timers; | 29 | using System.Timers; |
30 | using OpenMetaverse; | ||
30 | 31 | ||
31 | namespace OpenSim.Region.Physics.Manager | 32 | namespace OpenSim.Region.Physics.Manager |
32 | { | 33 | { |
@@ -46,7 +47,7 @@ namespace OpenSim.Region.Physics.Manager | |||
46 | { | 47 | { |
47 | get { return new NullPhysicsSensor(); } | 48 | get { return new NullPhysicsSensor(); } |
48 | } | 49 | } |
49 | public abstract PhysicsVector Position {get; set;} | 50 | public abstract Vector3 Position { get; set; } |
50 | public abstract void TimerCallback (object obj, ElapsedEventArgs eea); | 51 | public abstract void TimerCallback (object obj, ElapsedEventArgs eea); |
51 | public abstract float radianarc {get; set;} | 52 | public abstract float radianarc {get; set;} |
52 | public abstract string targetname {get; set;} | 53 | public abstract string targetname {get; set;} |
@@ -58,9 +59,9 @@ namespace OpenSim.Region.Physics.Manager | |||
58 | 59 | ||
59 | public class NullPhysicsSensor : PhysicsSensor | 60 | public class NullPhysicsSensor : PhysicsSensor |
60 | { | 61 | { |
61 | public override PhysicsVector Position | 62 | public override Vector3 Position |
62 | { | 63 | { |
63 | get { return PhysicsVector.Zero; } | 64 | get { return Vector3.Zero; } |
64 | set { return; } | 65 | set { return; } |
65 | } | 66 | } |
66 | public override void TimerCallback(object obj, ElapsedEventArgs eea) | 67 | public override void TimerCallback(object obj, ElapsedEventArgs eea) |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index d6f4d0d..f60a636 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs | |||
@@ -29,24 +29,24 @@ using System; | |||
29 | 29 | ||
30 | namespace OpenSim.Region.Physics.Manager | 30 | namespace OpenSim.Region.Physics.Manager |
31 | { | 31 | { |
32 | public class PhysicsVector | 32 | /*public class PhysicsVector |
33 | { | 33 | { |
34 | public float X; | 34 | public float X; |
35 | public float Y; | 35 | public float Y; |
36 | public float Z; | 36 | public float Z; |
37 | 37 | ||
38 | public PhysicsVector() | 38 | public Vector3() |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | public PhysicsVector(float x, float y, float z) | 42 | public Vector3(float x, float y, float z) |
43 | { | 43 | { |
44 | X = x; | 44 | X = x; |
45 | Y = y; | 45 | Y = y; |
46 | Z = z; | 46 | Z = z; |
47 | } | 47 | } |
48 | 48 | ||
49 | public PhysicsVector(PhysicsVector pv) : this(pv.X, pv.Y, pv.Z) | 49 | public Vector3(Vector3 pv) : this(pv.X, pv.Y, pv.Z) |
50 | { | 50 | { |
51 | } | 51 | } |
52 | 52 | ||
@@ -115,17 +115,17 @@ namespace OpenSim.Region.Physics.Manager | |||
115 | } | 115 | } |
116 | 116 | ||
117 | // Operations | 117 | // Operations |
118 | public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b) | 118 | public static PhysicsVector operator +(Vector3 a, Vector3 b) |
119 | { | 119 | { |
120 | return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z); | 120 | return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z); |
121 | } | 121 | } |
122 | 122 | ||
123 | public static PhysicsVector operator -(PhysicsVector a, PhysicsVector b) | 123 | public static PhysicsVector operator -(Vector3 a, Vector3 b) |
124 | { | 124 | { |
125 | return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z); | 125 | return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z); |
126 | } | 126 | } |
127 | 127 | ||
128 | public static PhysicsVector cross(PhysicsVector a, PhysicsVector b) | 128 | public static PhysicsVector cross(Vector3 a, Vector3 b) |
129 | { | 129 | { |
130 | return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X); | 130 | return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X); |
131 | } | 131 | } |
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Physics.Manager | |||
135 | return (float) Math.Sqrt(X*X + Y*Y + Z*Z); | 135 | return (float) Math.Sqrt(X*X + Y*Y + Z*Z); |
136 | } | 136 | } |
137 | 137 | ||
138 | public static float GetDistanceTo(PhysicsVector a, PhysicsVector b) | 138 | public static float GetDistanceTo(Vector3 a, Vector3 b) |
139 | { | 139 | { |
140 | float dx = a.X - b.X; | 140 | float dx = a.X - b.X; |
141 | float dy = a.Y - b.Y; | 141 | float dy = a.Y - b.Y; |
@@ -143,22 +143,22 @@ namespace OpenSim.Region.Physics.Manager | |||
143 | return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz); | 143 | return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz); |
144 | } | 144 | } |
145 | 145 | ||
146 | public static PhysicsVector operator /(PhysicsVector v, float f) | 146 | public static PhysicsVector operator /(Vector3 v, float f) |
147 | { | 147 | { |
148 | return new PhysicsVector(v.X/f, v.Y/f, v.Z/f); | 148 | return new PhysicsVector(v.X/f, v.Y/f, v.Z/f); |
149 | } | 149 | } |
150 | 150 | ||
151 | public static PhysicsVector operator *(PhysicsVector v, float f) | 151 | public static PhysicsVector operator *(Vector3 v, float f) |
152 | { | 152 | { |
153 | return new PhysicsVector(v.X*f, v.Y*f, v.Z*f); | 153 | return new PhysicsVector(v.X*f, v.Y*f, v.Z*f); |
154 | } | 154 | } |
155 | 155 | ||
156 | public static PhysicsVector operator *(float f, PhysicsVector v) | 156 | public static PhysicsVector operator *(float f, Vector3 v) |
157 | { | 157 | { |
158 | return v*f; | 158 | return v*f; |
159 | } | 159 | } |
160 | 160 | ||
161 | public static bool isFinite(PhysicsVector v) | 161 | public static bool isFinite(Vector3 v) |
162 | { | 162 | { |
163 | if (v == null) | 163 | if (v == null) |
164 | return false; | 164 | return false; |
@@ -172,7 +172,7 @@ namespace OpenSim.Region.Physics.Manager | |||
172 | return true; | 172 | return true; |
173 | } | 173 | } |
174 | 174 | ||
175 | public virtual bool IsIdentical(PhysicsVector v, float tolerance) | 175 | public virtual bool IsIdentical(Vector3 v, float tolerance) |
176 | { | 176 | { |
177 | PhysicsVector diff = this - v; | 177 | PhysicsVector diff = this - v; |
178 | float d = diff.length(); | 178 | float d = diff.length(); |
@@ -182,5 +182,5 @@ namespace OpenSim.Region.Physics.Manager | |||
182 | return false; | 182 | return false; |
183 | } | 183 | } |
184 | 184 | ||
185 | } | 185 | }*/ |
186 | } | 186 | } |
diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs index f9d0f2a..e6e75f9 100644 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using OpenMetaverse; | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * This is the zero mesher. | 33 | * This is the zero mesher. |
@@ -60,13 +61,16 @@ namespace OpenSim.Region.Physics.Manager | |||
60 | 61 | ||
61 | public class ZeroMesher : IMesher | 62 | public class ZeroMesher : IMesher |
62 | { | 63 | { |
63 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) | 64 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) |
64 | { | 65 | { |
65 | return CreateMesh(primName, primShape, size, lod, false); | 66 | return CreateMesh(primName, primShape, size, lod, false); |
66 | } | 67 | } |
67 | 68 | ||
68 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical) | 69 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) |
69 | { | 70 | { |
71 | // Remove the reference to the encoded JPEG2000 data so it can be GCed | ||
72 | primShape.SculptData = OpenMetaverse.Utils.EmptyBytes; | ||
73 | |||
70 | return null; | 74 | return null; |
71 | } | 75 | } |
72 | } | 76 | } |
diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs index 232245f..8cd8dcf 100644 --- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs +++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs | |||
@@ -33,30 +33,52 @@ using OpenMetaverse; | |||
33 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.Physics.Manager; |
34 | using OpenSim.Region.Physics.Meshing; | 34 | using OpenSim.Region.Physics.Meshing; |
35 | 35 | ||
36 | public class Vertex : PhysicsVector, IComparable<Vertex> | 36 | public class Vertex : IComparable<Vertex> |
37 | { | 37 | { |
38 | Vector3 vector; | ||
39 | |||
40 | public float X | ||
41 | { | ||
42 | get { return vector.X; } | ||
43 | set { vector.X = value; } | ||
44 | } | ||
45 | |||
46 | public float Y | ||
47 | { | ||
48 | get { return vector.Y; } | ||
49 | set { vector.Y = value; } | ||
50 | } | ||
51 | |||
52 | public float Z | ||
53 | { | ||
54 | get { return vector.Z; } | ||
55 | set { vector.Z = value; } | ||
56 | } | ||
57 | |||
38 | public Vertex(float x, float y, float z) | 58 | public Vertex(float x, float y, float z) |
39 | : base(x, y, z) | ||
40 | { | 59 | { |
60 | vector.X = x; | ||
61 | vector.Y = y; | ||
62 | vector.Z = z; | ||
41 | } | 63 | } |
42 | 64 | ||
43 | public Vertex normalize() | 65 | public Vertex normalize() |
44 | { | 66 | { |
45 | float tlength = length(); | 67 | float tlength = vector.Length(); |
46 | if (tlength != 0) | 68 | if (tlength != 0f) |
47 | { | 69 | { |
48 | float mul = 1.0f / tlength; | 70 | float mul = 1.0f / tlength; |
49 | return new Vertex(X * mul, Y * mul, Z * mul); | 71 | return new Vertex(vector.X * mul, vector.Y * mul, vector.Z * mul); |
50 | } | 72 | } |
51 | else | 73 | else |
52 | { | 74 | { |
53 | return new Vertex(0, 0, 0); | 75 | return new Vertex(0f, 0f, 0f); |
54 | } | 76 | } |
55 | } | 77 | } |
56 | 78 | ||
57 | public Vertex cross(Vertex v) | 79 | public Vertex cross(Vertex v) |
58 | { | 80 | { |
59 | return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X); | 81 | return new Vertex(vector.Y * v.Z - vector.Z * v.Y, vector.Z * v.X - vector.X * v.Z, vector.X * v.Y - vector.Y * v.X); |
60 | } | 82 | } |
61 | 83 | ||
62 | // disable warning: mono compiler moans about overloading | 84 | // disable warning: mono compiler moans about overloading |
@@ -160,9 +182,9 @@ public class Vertex : PhysicsVector, IComparable<Vertex> | |||
160 | return X * v.X + Y * v.Y + Z * v.Z; | 182 | return X * v.X + Y * v.Y + Z * v.Z; |
161 | } | 183 | } |
162 | 184 | ||
163 | public Vertex(PhysicsVector v) | 185 | public Vertex(Vector3 v) |
164 | : base(v.X, v.Y, v.Z) | ||
165 | { | 186 | { |
187 | vector = v; | ||
166 | } | 188 | } |
167 | 189 | ||
168 | public Vertex Clone() | 190 | public Vertex Clone() |
@@ -175,11 +197,15 @@ public class Vertex : PhysicsVector, IComparable<Vertex> | |||
175 | return new Vertex((float) Math.Cos(angle), (float) Math.Sin(angle), 0.0f); | 197 | return new Vertex((float) Math.Cos(angle), (float) Math.Sin(angle), 0.0f); |
176 | } | 198 | } |
177 | 199 | ||
200 | public float Length() | ||
201 | { | ||
202 | return vector.Length(); | ||
203 | } | ||
178 | 204 | ||
179 | public virtual bool Equals(Vertex v, float tolerance) | 205 | public virtual bool Equals(Vertex v, float tolerance) |
180 | { | 206 | { |
181 | PhysicsVector diff = this - v; | 207 | Vertex diff = this - v; |
182 | float d = diff.length(); | 208 | float d = diff.Length(); |
183 | if (d < tolerance) | 209 | if (d < tolerance) |
184 | return true; | 210 | return true; |
185 | 211 | ||
@@ -369,22 +395,22 @@ public class Triangle | |||
369 | return s1 + ";" + s2 + ";" + s3; | 395 | return s1 + ";" + s2 + ";" + s3; |
370 | } | 396 | } |
371 | 397 | ||
372 | public PhysicsVector getNormal() | 398 | public Vector3 getNormal() |
373 | { | 399 | { |
374 | // Vertices | 400 | // Vertices |
375 | 401 | ||
376 | // Vectors for edges | 402 | // Vectors for edges |
377 | PhysicsVector e1; | 403 | Vector3 e1; |
378 | PhysicsVector e2; | 404 | Vector3 e2; |
379 | 405 | ||
380 | e1 = new PhysicsVector(v1.X - v2.X, v1.Y - v2.Y, v1.Z - v2.Z); | 406 | e1 = new Vector3(v1.X - v2.X, v1.Y - v2.Y, v1.Z - v2.Z); |
381 | e2 = new PhysicsVector(v1.X - v3.X, v1.Y - v3.Y, v1.Z - v3.Z); | 407 | e2 = new Vector3(v1.X - v3.X, v1.Y - v3.Y, v1.Z - v3.Z); |
382 | 408 | ||
383 | // Cross product for normal | 409 | // Cross product for normal |
384 | PhysicsVector n = PhysicsVector.cross(e1, e2); | 410 | Vector3 n = Vector3.Cross(e1, e2); |
385 | 411 | ||
386 | // Length | 412 | // Length |
387 | float l = n.length(); | 413 | float l = n.Length(); |
388 | 414 | ||
389 | // Normalized "normal" | 415 | // Normalized "normal" |
390 | n = n/l; | 416 | n = n/l; |
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs index 4c3cf33..f781ff9 100644 --- a/OpenSim/Region/Physics/Meshing/Mesh.cs +++ b/OpenSim/Region/Physics/Meshing/Mesh.cs | |||
@@ -31,6 +31,7 @@ using System.IO; | |||
31 | using System.Runtime.InteropServices; | 31 | using System.Runtime.InteropServices; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
33 | using PrimMesher; | 33 | using PrimMesher; |
34 | using OpenMetaverse; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.Physics.Meshing | 36 | namespace OpenSim.Region.Physics.Meshing |
36 | { | 37 | { |
@@ -141,12 +142,12 @@ namespace OpenSim.Region.Physics.Meshing | |||
141 | } | 142 | } |
142 | } | 143 | } |
143 | 144 | ||
144 | public List<PhysicsVector> getVertexList() | 145 | public List<Vector3> getVertexList() |
145 | { | 146 | { |
146 | List<PhysicsVector> result = new List<PhysicsVector>(); | 147 | List<Vector3> result = new List<Vector3>(); |
147 | foreach (Vertex v in m_vertices.Keys) | 148 | foreach (Vertex v in m_vertices.Keys) |
148 | { | 149 | { |
149 | result.Add(v); | 150 | result.Add(new Vector3(v.X, v.Y, v.Z)); |
150 | } | 151 | } |
151 | return result; | 152 | return result; |
152 | } | 153 | } |
@@ -174,6 +175,9 @@ namespace OpenSim.Region.Physics.Meshing | |||
174 | 175 | ||
175 | float[] result = getVertexListAsFloat(); | 176 | float[] result = getVertexListAsFloat(); |
176 | m_pinnedVertexes = GCHandle.Alloc(result, GCHandleType.Pinned); | 177 | m_pinnedVertexes = GCHandle.Alloc(result, GCHandleType.Pinned); |
178 | // Inform the garbage collector of this unmanaged allocation so it can schedule | ||
179 | // the next GC round more intelligently | ||
180 | GC.AddMemoryPressure(Buffer.ByteLength(result)); | ||
177 | 181 | ||
178 | return result; | 182 | return result; |
179 | } | 183 | } |
@@ -223,6 +227,9 @@ namespace OpenSim.Region.Physics.Meshing | |||
223 | 227 | ||
224 | int[] result = getIndexListAsInt(); | 228 | int[] result = getIndexListAsInt(); |
225 | m_pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); | 229 | m_pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); |
230 | // Inform the garbage collector of this unmanaged allocation so it can schedule | ||
231 | // the next GC round more intelligently | ||
232 | GC.AddMemoryPressure(Buffer.ByteLength(result)); | ||
226 | 233 | ||
227 | return result; | 234 | return result; |
228 | } | 235 | } |
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index f609e73..fbe1949 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -31,7 +31,6 @@ using System.Collections.Generic; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenMetaverse.Imaging; | ||
35 | using System.Drawing; | 34 | using System.Drawing; |
36 | using System.Drawing.Imaging; | 35 | using System.Drawing.Imaging; |
37 | using PrimMesher; | 36 | using PrimMesher; |
@@ -61,7 +60,6 @@ namespace OpenSim.Region.Physics.Meshing | |||
61 | public class Meshmerizer : IMesher | 60 | public class Meshmerizer : IMesher |
62 | { | 61 | { |
63 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 62 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
64 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
65 | 63 | ||
66 | // Setting baseDir to a path will enable the dumping of raw files | 64 | // Setting baseDir to a path will enable the dumping of raw files |
67 | // raw files can be imported by blender so a visual inspection of the results can be done | 65 | // raw files can be imported by blender so a visual inspection of the results can be done |
@@ -160,7 +158,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
160 | float minZ = float.MaxValue; | 158 | float minZ = float.MaxValue; |
161 | float maxZ = float.MinValue; | 159 | float maxZ = float.MinValue; |
162 | 160 | ||
163 | foreach (Vertex v in meshIn.getVertexList()) | 161 | foreach (Vector3 v in meshIn.getVertexList()) |
164 | { | 162 | { |
165 | if (v != null) | 163 | if (v != null) |
166 | { | 164 | { |
@@ -185,7 +183,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
185 | 183 | ||
186 | } | 184 | } |
187 | 185 | ||
188 | private ulong GetMeshKey(PrimitiveBaseShape pbs, PhysicsVector size, float lod) | 186 | private ulong GetMeshKey(PrimitiveBaseShape pbs, Vector3 size, float lod) |
189 | { | 187 | { |
190 | ulong hash = 5381; | 188 | ulong hash = 5381; |
191 | 189 | ||
@@ -245,9 +243,9 @@ namespace OpenSim.Region.Physics.Meshing | |||
245 | hash = ((hash << 5) + hash) + (ulong)((byte)c); | 243 | hash = ((hash << 5) + hash) + (ulong)((byte)c); |
246 | return ((hash << 5) + hash) + (ulong)(c >> 8); | 244 | return ((hash << 5) + hash) + (ulong)(c >> 8); |
247 | } | 245 | } |
248 | |||
249 | 246 | ||
250 | private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) | 247 | |
248 | private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod) | ||
251 | { | 249 | { |
252 | PrimMesh primMesh; | 250 | PrimMesh primMesh; |
253 | PrimMesher.SculptMesh sculptMesh; | 251 | PrimMesher.SculptMesh sculptMesh; |
@@ -281,16 +279,12 @@ namespace OpenSim.Region.Physics.Meshing | |||
281 | 279 | ||
282 | if (idata == null) | 280 | if (idata == null) |
283 | { | 281 | { |
284 | if (primShape.SculptData.Length == 0) | 282 | if (primShape.SculptData == null || primShape.SculptData.Length == 0) |
285 | return null; | 283 | return null; |
286 | 284 | ||
287 | try | 285 | try |
288 | { | 286 | { |
289 | ManagedImage managedImage; // we never use this | 287 | idata = CSJ2K.J2kImage.FromBytes(primShape.SculptData); |
290 | OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata); | ||
291 | |||
292 | // Remove the reference to the encoded JPEG2000 data so it can be GCed | ||
293 | primShape.SculptData = Utils.EmptyBytes; | ||
294 | 288 | ||
295 | if (cacheSculptMaps) | 289 | if (cacheSculptMaps) |
296 | { | 290 | { |
@@ -315,8 +309,6 @@ namespace OpenSim.Region.Physics.Meshing | |||
315 | } | 309 | } |
316 | } | 310 | } |
317 | 311 | ||
318 | |||
319 | |||
320 | PrimMesher.SculptMesh.SculptType sculptType; | 312 | PrimMesher.SculptMesh.SculptType sculptType; |
321 | switch ((OpenMetaverse.SculptType)primShape.SculptType) | 313 | switch ((OpenMetaverse.SculptType)primShape.SculptType) |
322 | { | 314 | { |
@@ -351,7 +343,6 @@ namespace OpenSim.Region.Physics.Meshing | |||
351 | coords = sculptMesh.coords; | 343 | coords = sculptMesh.coords; |
352 | faces = sculptMesh.faces; | 344 | faces = sculptMesh.faces; |
353 | } | 345 | } |
354 | |||
355 | else | 346 | else |
356 | { | 347 | { |
357 | float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f; | 348 | float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f; |
@@ -466,6 +457,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
466 | faces = primMesh.faces; | 457 | faces = primMesh.faces; |
467 | } | 458 | } |
468 | 459 | ||
460 | // Remove the reference to any JPEG2000 sculpt data so it can be GCed | ||
461 | primShape.SculptData = Utils.EmptyBytes; | ||
469 | 462 | ||
470 | int numCoords = coords.Count; | 463 | int numCoords = coords.Count; |
471 | int numFaces = faces.Count; | 464 | int numFaces = faces.Count; |
@@ -488,12 +481,12 @@ namespace OpenSim.Region.Physics.Meshing | |||
488 | return mesh; | 481 | return mesh; |
489 | } | 482 | } |
490 | 483 | ||
491 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod) | 484 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) |
492 | { | 485 | { |
493 | return CreateMesh(primName, primShape, size, lod, false); | 486 | return CreateMesh(primName, primShape, size, lod, false); |
494 | } | 487 | } |
495 | 488 | ||
496 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical) | 489 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) |
497 | { | 490 | { |
498 | Mesh mesh = null; | 491 | Mesh mesh = null; |
499 | ulong key = 0; | 492 | ulong key = 0; |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 8272083..e344f97 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -68,15 +68,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
68 | { | 68 | { |
69 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 69 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
70 | 70 | ||
71 | private PhysicsVector _position; | 71 | private Vector3 _position; |
72 | private d.Vector3 _zeroPosition; | 72 | private d.Vector3 _zeroPosition; |
73 | // private d.Matrix3 m_StandUpRotation; | 73 | // private d.Matrix3 m_StandUpRotation; |
74 | private bool _zeroFlag = false; | 74 | private bool _zeroFlag = false; |
75 | private bool m_lastUpdateSent = false; | 75 | private bool m_lastUpdateSent = false; |
76 | private PhysicsVector _velocity; | 76 | private Vector3 _velocity; |
77 | private PhysicsVector _target_velocity; | 77 | private Vector3 _target_velocity; |
78 | private PhysicsVector _acceleration; | 78 | private Vector3 _acceleration; |
79 | private PhysicsVector m_rotationalVelocity; | 79 | private Vector3 m_rotationalVelocity; |
80 | private float m_mass = 80f; | 80 | private float m_mass = 80f; |
81 | public float m_density = 60f; | 81 | public float m_density = 60f; |
82 | private bool m_pidControllerActive = true; | 82 | private bool m_pidControllerActive = true; |
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
99 | private bool m_hackSentFall = false; | 99 | private bool m_hackSentFall = false; |
100 | private bool m_hackSentFly = false; | 100 | private bool m_hackSentFly = false; |
101 | private int m_requestedUpdateFrequency = 0; | 101 | private int m_requestedUpdateFrequency = 0; |
102 | private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0); | 102 | private Vector3 m_taintPosition = Vector3.Zero; |
103 | public uint m_localID = 0; | 103 | public uint m_localID = 0; |
104 | public bool m_returnCollisions = false; | 104 | public bool m_returnCollisions = false; |
105 | // taints and their non-tainted counterparts | 105 | // taints and their non-tainted counterparts |
@@ -143,22 +143,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
143 | public UUID m_uuid; | 143 | public UUID m_uuid; |
144 | public bool bad = false; | 144 | public bool bad = false; |
145 | 145 | ||
146 | public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, CollisionLocker dode, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) | 146 | public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) |
147 | { | 147 | { |
148 | m_uuid = UUID.Random(); | 148 | m_uuid = UUID.Random(); |
149 | 149 | ||
150 | // ode = dode; | 150 | if (pos.IsFinite()) |
151 | _velocity = new PhysicsVector(); | ||
152 | _target_velocity = new PhysicsVector(); | ||
153 | |||
154 | |||
155 | if (PhysicsVector.isFinite(pos)) | ||
156 | { | 151 | { |
157 | if (pos.Z > 9999999) | 152 | if (pos.Z > 9999999f) |
158 | { | 153 | { |
159 | pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; | 154 | pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; |
160 | } | 155 | } |
161 | if (pos.Z < -90000) | 156 | if (pos.Z < -90000f) |
162 | { | 157 | { |
163 | pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; | 158 | pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; |
164 | } | 159 | } |
@@ -169,15 +164,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
169 | } | 164 | } |
170 | else | 165 | else |
171 | { | 166 | { |
172 | _position = new PhysicsVector(((int)_parent_scene.WorldExtents.X * 0.5f), ((int)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128, 128) + 10); | 167 | _position = new Vector3(((float)_parent_scene.WorldExtents.X * 0.5f), ((float)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f); |
173 | m_taintPosition.X = _position.X; | 168 | m_taintPosition.X = _position.X; |
174 | m_taintPosition.Y = _position.Y; | 169 | m_taintPosition.Y = _position.Y; |
175 | m_taintPosition.Z = _position.Z; | 170 | m_taintPosition.Z = _position.Z; |
176 | m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); | 171 | m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); |
177 | } | 172 | } |
178 | 173 | ||
179 | |||
180 | _acceleration = new PhysicsVector(); | ||
181 | _parent_scene = parent_scene; | 174 | _parent_scene = parent_scene; |
182 | 175 | ||
183 | PID_D = pid_d; | 176 | PID_D = pid_d; |
@@ -189,7 +182,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
189 | walkDivisor = walk_divisor; | 182 | walkDivisor = walk_divisor; |
190 | runDivisor = rundivisor; | 183 | runDivisor = rundivisor; |
191 | 184 | ||
192 | |||
193 | // m_StandUpRotation = | 185 | // m_StandUpRotation = |
194 | // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f, | 186 | // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f, |
195 | // 0.5f); | 187 | // 0.5f); |
@@ -205,7 +197,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
205 | m_isPhysical = false; // current status: no ODE information exists | 197 | m_isPhysical = false; // current status: no ODE information exists |
206 | m_tainted_isPhysical = true; // new tainted status: need to create ODE information | 198 | m_tainted_isPhysical = true; // new tainted status: need to create ODE information |
207 | 199 | ||
208 | |||
209 | _parent_scene.AddPhysicsActorTaint(this); | 200 | _parent_scene.AddPhysicsActorTaint(this); |
210 | 201 | ||
211 | m_name = avName; | 202 | m_name = avName; |
@@ -412,20 +403,20 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
412 | /// Not really a good choice unless you 'know' it's a good | 403 | /// Not really a good choice unless you 'know' it's a good |
413 | /// spot otherwise you're likely to orbit the avatar. | 404 | /// spot otherwise you're likely to orbit the avatar. |
414 | /// </summary> | 405 | /// </summary> |
415 | public override PhysicsVector Position | 406 | public override Vector3 Position |
416 | { | 407 | { |
417 | get { return _position; } | 408 | get { return _position; } |
418 | set | 409 | set |
419 | { | 410 | { |
420 | if (Body == IntPtr.Zero || Shell == IntPtr.Zero) | 411 | if (Body == IntPtr.Zero || Shell == IntPtr.Zero) |
421 | { | 412 | { |
422 | if (PhysicsVector.isFinite(value)) | 413 | if (value.IsFinite()) |
423 | { | 414 | { |
424 | if (value.Z > 9999999) | 415 | if (value.Z > 9999999f) |
425 | { | 416 | { |
426 | value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; | 417 | value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; |
427 | } | 418 | } |
428 | if (value.Z < -90000) | 419 | if (value.Z < -90000f) |
429 | { | 420 | { |
430 | value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; | 421 | value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; |
431 | } | 422 | } |
@@ -447,7 +438,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
447 | } | 438 | } |
448 | } | 439 | } |
449 | 440 | ||
450 | public override PhysicsVector RotationalVelocity | 441 | public override Vector3 RotationalVelocity |
451 | { | 442 | { |
452 | get { return m_rotationalVelocity; } | 443 | get { return m_rotationalVelocity; } |
453 | set { m_rotationalVelocity = value; } | 444 | set { m_rotationalVelocity = value; } |
@@ -457,20 +448,20 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
457 | /// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight | 448 | /// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight |
458 | /// and use it to offset landings properly | 449 | /// and use it to offset landings properly |
459 | /// </summary> | 450 | /// </summary> |
460 | public override PhysicsVector Size | 451 | public override Vector3 Size |
461 | { | 452 | { |
462 | get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); } | 453 | get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } |
463 | set | 454 | set |
464 | { | 455 | { |
465 | if (PhysicsVector.isFinite(value)) | 456 | if (value.IsFinite()) |
466 | { | 457 | { |
467 | m_pidControllerActive = true; | 458 | m_pidControllerActive = true; |
468 | 459 | ||
469 | PhysicsVector SetSize = value; | 460 | Vector3 SetSize = value; |
470 | m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f; | 461 | m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f; |
471 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); | 462 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); |
472 | 463 | ||
473 | Velocity = new PhysicsVector(0f, 0f, 0f); | 464 | Velocity = Vector3.Zero; |
474 | 465 | ||
475 | _parent_scene.AddPhysicsActorTaint(this); | 466 | _parent_scene.AddPhysicsActorTaint(this); |
476 | } | 467 | } |
@@ -481,7 +472,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
481 | } | 472 | } |
482 | } | 473 | } |
483 | 474 | ||
484 | private void AlignAvatarTiltWithCurrentDirectionOfMovement(PhysicsVector movementVector) | 475 | private void AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3 movementVector) |
485 | { | 476 | { |
486 | movementVector.Z = 0f; | 477 | movementVector.Z = 0f; |
487 | float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y)); | 478 | float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y)); |
@@ -643,7 +634,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
643 | // (with -0..0 motor stops) falls into the terrain for reasons yet | 634 | // (with -0..0 motor stops) falls into the terrain for reasons yet |
644 | // to be comprehended in their entirety. | 635 | // to be comprehended in their entirety. |
645 | #endregion | 636 | #endregion |
646 | AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(0,0,0)); | 637 | AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero); |
647 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f); | 638 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f); |
648 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); | 639 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); |
649 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f); | 640 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f); |
@@ -688,7 +679,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
688 | 679 | ||
689 | } | 680 | } |
690 | 681 | ||
691 | public override void LockAngularMotion(PhysicsVector axis) | 682 | public override void LockAngularMotion(Vector3 axis) |
692 | { | 683 | { |
693 | 684 | ||
694 | } | 685 | } |
@@ -716,9 +707,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
716 | // //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); | 707 | // //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); |
717 | // } | 708 | // } |
718 | 709 | ||
719 | public override PhysicsVector Force | 710 | public override Vector3 Force |
720 | { | 711 | { |
721 | get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); } | 712 | get { return _target_velocity; } |
722 | set { return; } | 713 | set { return; } |
723 | } | 714 | } |
724 | 715 | ||
@@ -733,7 +724,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
733 | 724 | ||
734 | } | 725 | } |
735 | 726 | ||
736 | public override void VehicleVectorParam(int param, PhysicsVector value) | 727 | public override void VehicleVectorParam(int param, Vector3 value) |
737 | { | 728 | { |
738 | 729 | ||
739 | } | 730 | } |
@@ -748,14 +739,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
748 | 739 | ||
749 | } | 740 | } |
750 | 741 | ||
751 | public override PhysicsVector CenterOfMass | 742 | public override Vector3 CenterOfMass |
752 | { | 743 | { |
753 | get { return PhysicsVector.Zero; } | 744 | get { return Vector3.Zero; } |
754 | } | 745 | } |
755 | 746 | ||
756 | public override PhysicsVector GeometricCenter | 747 | public override Vector3 GeometricCenter |
757 | { | 748 | { |
758 | get { return PhysicsVector.Zero; } | 749 | get { return Vector3.Zero; } |
759 | } | 750 | } |
760 | 751 | ||
761 | public override PrimitiveBaseShape Shape | 752 | public override PrimitiveBaseShape Shape |
@@ -763,18 +754,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
763 | set { return; } | 754 | set { return; } |
764 | } | 755 | } |
765 | 756 | ||
766 | public override PhysicsVector Velocity | 757 | public override Vector3 Velocity |
767 | { | 758 | { |
768 | get { | 759 | get { |
769 | // There's a problem with PhysicsVector.Zero! Don't Use it Here! | 760 | // There's a problem with Vector3.Zero! Don't Use it Here! |
770 | if (_zeroFlag) | 761 | if (_zeroFlag) |
771 | return new PhysicsVector(0f, 0f, 0f); | 762 | return Vector3.Zero; |
772 | m_lastUpdateSent = false; | 763 | m_lastUpdateSent = false; |
773 | return _velocity; | 764 | return _velocity; |
774 | } | 765 | } |
775 | set | 766 | set |
776 | { | 767 | { |
777 | if (PhysicsVector.isFinite(value)) | 768 | if (value.IsFinite()) |
778 | { | 769 | { |
779 | m_pidControllerActive = true; | 770 | m_pidControllerActive = true; |
780 | _target_velocity = value; | 771 | _target_velocity = value; |
@@ -786,9 +777,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
786 | } | 777 | } |
787 | } | 778 | } |
788 | 779 | ||
789 | public override PhysicsVector Torque | 780 | public override Vector3 Torque |
790 | { | 781 | { |
791 | get { return PhysicsVector.Zero; } | 782 | get { return Vector3.Zero; } |
792 | set { return; } | 783 | set { return; } |
793 | } | 784 | } |
794 | 785 | ||
@@ -814,12 +805,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
814 | } | 805 | } |
815 | } | 806 | } |
816 | 807 | ||
817 | public override PhysicsVector Acceleration | 808 | public override Vector3 Acceleration |
818 | { | 809 | { |
819 | get { return _acceleration; } | 810 | get { return _acceleration; } |
820 | } | 811 | } |
821 | 812 | ||
822 | public void SetAcceleration(PhysicsVector accel) | 813 | public void SetAcceleration(Vector3 accel) |
823 | { | 814 | { |
824 | m_pidControllerActive = true; | 815 | m_pidControllerActive = true; |
825 | _acceleration = accel; | 816 | _acceleration = accel; |
@@ -830,9 +821,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
830 | /// The PID controller takes this target velocity and tries to make it a reality | 821 | /// The PID controller takes this target velocity and tries to make it a reality |
831 | /// </summary> | 822 | /// </summary> |
832 | /// <param name="force"></param> | 823 | /// <param name="force"></param> |
833 | public override void AddForce(PhysicsVector force, bool pushforce) | 824 | public override void AddForce(Vector3 force, bool pushforce) |
834 | { | 825 | { |
835 | if (PhysicsVector.isFinite(force)) | 826 | if (force.IsFinite()) |
836 | { | 827 | { |
837 | if (pushforce) | 828 | if (pushforce) |
838 | { | 829 | { |
@@ -861,7 +852,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
861 | //m_lastUpdateSent = false; | 852 | //m_lastUpdateSent = false; |
862 | } | 853 | } |
863 | 854 | ||
864 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 855 | public override void AddAngularForce(Vector3 force, bool pushforce) |
865 | { | 856 | { |
866 | 857 | ||
867 | } | 858 | } |
@@ -870,7 +861,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
870 | /// After all of the forces add up with 'add force' we apply them with doForce | 861 | /// After all of the forces add up with 'add force' we apply them with doForce |
871 | /// </summary> | 862 | /// </summary> |
872 | /// <param name="force"></param> | 863 | /// <param name="force"></param> |
873 | public void doForce(PhysicsVector force) | 864 | public void doForce(Vector3 force) |
874 | { | 865 | { |
875 | if (!collidelock) | 866 | if (!collidelock) |
876 | { | 867 | { |
@@ -881,7 +872,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
881 | } | 872 | } |
882 | } | 873 | } |
883 | 874 | ||
884 | public override void SetMomentum(PhysicsVector momentum) | 875 | public override void SetMomentum(Vector3 momentum) |
885 | { | 876 | { |
886 | } | 877 | } |
887 | 878 | ||
@@ -908,9 +899,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
908 | //PidStatus = true; | 899 | //PidStatus = true; |
909 | 900 | ||
910 | d.Vector3 localpos = d.BodyGetPosition(Body); | 901 | d.Vector3 localpos = d.BodyGetPosition(Body); |
911 | PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z); | 902 | Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z); |
912 | 903 | ||
913 | if (!PhysicsVector.isFinite(localPos)) | 904 | if (!localPos.IsFinite()) |
914 | { | 905 | { |
915 | 906 | ||
916 | m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); | 907 | m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); |
@@ -946,7 +937,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
946 | return; | 937 | return; |
947 | } | 938 | } |
948 | 939 | ||
949 | PhysicsVector vec = new PhysicsVector(); | 940 | Vector3 vec = Vector3.Zero; |
950 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 941 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
951 | 942 | ||
952 | float movementdivisor = 1f; | 943 | float movementdivisor = 1f; |
@@ -1059,12 +1050,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1059 | } | 1050 | } |
1060 | // end add Kitto Flora | 1051 | // end add Kitto Flora |
1061 | } | 1052 | } |
1062 | if (PhysicsVector.isFinite(vec)) | 1053 | if (vec.IsFinite()) |
1063 | { | 1054 | { |
1064 | doForce(vec); | 1055 | doForce(vec); |
1065 | if (!_zeroFlag) | 1056 | if (!_zeroFlag) |
1066 | { | 1057 | { |
1067 | AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(vec.X, vec.Y, vec.Z)); | 1058 | AlignAvatarTiltWithCurrentDirectionOfMovement(vec); |
1068 | } | 1059 | } |
1069 | } | 1060 | } |
1070 | else | 1061 | else |
@@ -1197,7 +1188,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1197 | { | 1188 | { |
1198 | } | 1189 | } |
1199 | 1190 | ||
1200 | public override PhysicsVector PIDTarget { set { return; } } | 1191 | public override Vector3 PIDTarget { set { return; } } |
1201 | public override bool PIDActive { set { return; } } | 1192 | public override bool PIDActive { set { return; } } |
1202 | public override float PIDTau { set { return; } } | 1193 | public override float PIDTau { set { return; } } |
1203 | 1194 | ||
@@ -1333,7 +1324,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1333 | d.GeomDestroy(Shell); | 1324 | d.GeomDestroy(Shell); |
1334 | AvatarGeomAndBodyCreation(_position.X, _position.Y, | 1325 | AvatarGeomAndBodyCreation(_position.X, _position.Y, |
1335 | _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); | 1326 | _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); |
1336 | Velocity = new PhysicsVector(0f, 0f, 0f); | 1327 | Velocity = Vector3.Zero; |
1337 | 1328 | ||
1338 | _parent_scene.geom_name_map[Shell] = m_name; | 1329 | _parent_scene.geom_name_map[Shell] = m_name; |
1339 | _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; | 1330 | _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; |
@@ -1347,7 +1338,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1347 | } | 1338 | } |
1348 | } | 1339 | } |
1349 | 1340 | ||
1350 | if (!m_taintPosition.IsIdentical(_position, 0.05f)) | 1341 | if (!m_taintPosition.ApproxEquals(_position, 0.05f)) |
1351 | { | 1342 | { |
1352 | if (Body != IntPtr.Zero) | 1343 | if (Body != IntPtr.Zero) |
1353 | { | 1344 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs index 0c168c6..345112d 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs | |||
@@ -38,6 +38,19 @@ | |||
38 | * | 38 | * |
39 | */ | 39 | */ |
40 | 40 | ||
41 | /* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
42 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
43 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
44 | * characteristics and Kinetic motion. | ||
45 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
46 | * (dynamics) and the associated settings. Old Linear and angular | ||
47 | * motors for dynamic motion have been replace with MoveLinear() | ||
48 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
49 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
50 | * switch between 'VEHICLE' parameter use and general dynamics | ||
51 | * settings use. | ||
52 | */ | ||
53 | |||
41 | using System; | 54 | using System; |
42 | using System.Collections.Generic; | 55 | using System.Collections.Generic; |
43 | using System.Reflection; | 56 | using System.Reflection; |
@@ -232,7 +245,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
232 | 245 | ||
233 | }//end ProcessFloatVehicleParam | 246 | }//end ProcessFloatVehicleParam |
234 | 247 | ||
235 | internal void ProcessVectorVehicleParam(Vehicle pParam, PhysicsVector pValue) | 248 | internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue) |
236 | { | 249 | { |
237 | switch (pParam) | 250 | switch (pParam) |
238 | { | 251 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 93c9a44..62c5c81 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -1,7 +1,5 @@ | |||
1 | /* | 1 | /* Copyright (c) Contributors, http://opensimulator.org/ |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 2 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | 3 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 4 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 5 | * * Redistributions of source code must retain the above copyright |
@@ -36,6 +34,20 @@ | |||
36 | * switch between 'VEHICLE' parameter use and general dynamics | 34 | * switch between 'VEHICLE' parameter use and general dynamics |
37 | * settings use. | 35 | * settings use. |
38 | */ | 36 | */ |
37 | |||
38 | /* | ||
39 | * Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
40 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
41 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
42 | * characteristics and Kinetic motion. | ||
43 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
44 | * (dynamics) and the associated settings. Old Linear and angular | ||
45 | * motors for dynamic motion have been replace with MoveLinear() | ||
46 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
47 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
48 | * switch between 'VEHICLE' parameter use and general dynamics | ||
49 | * settings use. | ||
50 | */ | ||
39 | using System; | 51 | using System; |
40 | using System.Collections.Generic; | 52 | using System.Collections.Generic; |
41 | using System.Reflection; | 53 | using System.Reflection; |
@@ -57,29 +69,28 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
57 | { | 69 | { |
58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 70 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
59 | 71 | ||
60 | private PhysicsVector _position; | 72 | private Vector3 _position; |
61 | private PhysicsVector _velocity; | 73 | private Vector3 _velocity; |
62 | private PhysicsVector _torque = new PhysicsVector(0,0,0); | 74 | private Vector3 _torque; |
63 | private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); | 75 | private Vector3 m_lastVelocity; |
64 | private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); | 76 | private Vector3 m_lastposition; |
65 | private Quaternion m_lastorientation = new Quaternion(); | 77 | private Quaternion m_lastorientation = new Quaternion(); |
66 | private PhysicsVector m_rotationalVelocity; | 78 | private Vector3 m_rotationalVelocity; |
67 | private PhysicsVector _size; | 79 | private Vector3 _size; |
68 | private PhysicsVector _acceleration; | 80 | private Vector3 _acceleration; |
69 | // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); | 81 | // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); |
70 | private Quaternion _orientation; | 82 | private Quaternion _orientation; |
71 | private PhysicsVector m_taintposition; | 83 | private Vector3 m_taintposition; |
72 | private PhysicsVector m_taintsize; | 84 | private Vector3 m_taintsize; |
73 | private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); | 85 | private Vector3 m_taintVelocity; |
74 | private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); | 86 | private Vector3 m_taintTorque; |
75 | private Quaternion m_taintrot; | 87 | private Quaternion m_taintrot; |
76 | private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); | 88 | private Vector3 m_angularlock = Vector3.One; |
77 | private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); | 89 | private Vector3 m_taintAngularLock = Vector3.One; |
78 | private IntPtr Amotor = IntPtr.Zero; | 90 | private IntPtr Amotor = IntPtr.Zero; |
79 | 91 | ||
80 | private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); | 92 | private Vector3 m_PIDTarget; |
81 | // private PhysicsVector m_taintPIDTarget = new PhysicsVector(0, 0, 0); | 93 | private float m_PIDTau; |
82 | private float m_PIDTau = 0f; | ||
83 | private float PID_D = 35f; | 94 | private float PID_D = 35f; |
84 | private float PID_G = 25f; | 95 | private float PID_G = 25f; |
85 | private bool m_usePID = false; | 96 | private bool m_usePID = false; |
@@ -91,15 +102,22 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
91 | 102 | ||
92 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), | 103 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), |
93 | // and are for non-VEHICLES only. | 104 | // and are for non-VEHICLES only. |
94 | 105 | ||
95 | private float m_PIDHoverHeight = 0f; | 106 | private float m_PIDHoverHeight; |
96 | private float m_PIDHoverTau = 0f; | 107 | private float m_PIDHoverTau; |
97 | private bool m_useHoverPID = false; | 108 | private bool m_useHoverPID; |
98 | private PIDHoverType m_PIDHoverType = PIDHoverType.Ground; | 109 | private PIDHoverType m_PIDHoverType = PIDHoverType.Ground; |
110 | <<<<<<< HEAD:OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | ||
99 | private float m_targetHoverHeight = 0f; | 111 | private float m_targetHoverHeight = 0f; |
100 | private float m_groundHeight = 0f; | 112 | private float m_groundHeight = 0f; |
101 | private float m_waterHeight = 0f; | 113 | private float m_waterHeight = 0f; |
102 | private float m_buoyancy = 0f; //Set by llSetBuoyancy(), for non-vehicles. | 114 | private float m_buoyancy = 0f; //Set by llSetBuoyancy(), for non-vehicles. |
115 | ======= | ||
116 | private float m_targetHoverHeight; | ||
117 | private float m_groundHeight; | ||
118 | private float m_waterHeight; | ||
119 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | ||
120 | >>>>>>> vehicles:OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | ||
103 | 121 | ||
104 | // private float m_tensor = 5f; | 122 | // private float m_tensor = 5f; |
105 | private int body_autodisable_frames = 20; | 123 | private int body_autodisable_frames = 20; |
@@ -110,11 +128,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
110 | | CollisionCategories.Body | 128 | | CollisionCategories.Body |
111 | | CollisionCategories.Character | 129 | | CollisionCategories.Character |
112 | ); | 130 | ); |
113 | private bool m_taintshape = false; | 131 | private bool m_taintshape; |
114 | private bool m_taintPhysics = false; | 132 | private bool m_taintPhysics; |
115 | private bool m_collidesLand = true; | 133 | private bool m_collidesLand = true; |
116 | private bool m_collidesWater = false; | 134 | private bool m_collidesWater; |
117 | public bool m_returnCollisions = false; | 135 | public bool m_returnCollisions; |
118 | 136 | ||
119 | // Default we're a Geometry | 137 | // Default we're a Geometry |
120 | private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); | 138 | private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); |
@@ -122,69 +140,68 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
122 | // Default, Collide with Other Geometries, spaces and Bodies | 140 | // Default, Collide with Other Geometries, spaces and Bodies |
123 | private CollisionCategories m_collisionFlags = m_default_collisionFlags; | 141 | private CollisionCategories m_collisionFlags = m_default_collisionFlags; |
124 | 142 | ||
125 | public bool m_taintremove = false; | 143 | public bool m_taintremove; |
126 | public bool m_taintdisable = false; | 144 | public bool m_taintdisable; |
127 | public bool m_disabled = false; | 145 | public bool m_disabled; |
128 | public bool m_taintadd = false; | 146 | public bool m_taintadd; |
129 | public bool m_taintselected = false; | 147 | public bool m_taintselected; |
130 | public bool m_taintCollidesWater = false; | 148 | public bool m_taintCollidesWater; |
131 | 149 | ||
132 | public uint m_localID = 0; | 150 | public uint m_localID; |
133 | 151 | ||
134 | //public GCHandle gc; | 152 | //public GCHandle gc; |
135 | private CollisionLocker ode; | 153 | private CollisionLocker ode; |
136 | 154 | ||
137 | private bool m_taintforce = false; | 155 | private bool m_taintforce = false; |
138 | private bool m_taintaddangularforce = false; | 156 | private bool m_taintaddangularforce = false; |
139 | private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); | 157 | private Vector3 m_force; |
140 | private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); | 158 | private List<Vector3> m_forcelist = new List<Vector3>(); |
141 | private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>(); | 159 | private List<Vector3> m_angularforcelist = new List<Vector3>(); |
142 | 160 | ||
143 | private IMesh _mesh; | 161 | private IMesh _mesh; |
144 | private PrimitiveBaseShape _pbs; | 162 | private PrimitiveBaseShape _pbs; |
145 | private OdeScene _parent_scene; | 163 | private OdeScene _parent_scene; |
146 | public IntPtr m_targetSpace = (IntPtr) 0; | 164 | public IntPtr m_targetSpace = IntPtr.Zero; |
147 | public IntPtr prim_geom; | 165 | public IntPtr prim_geom; |
148 | public IntPtr prev_geom; | 166 | public IntPtr prev_geom; |
149 | public IntPtr _triMeshData; | 167 | public IntPtr _triMeshData; |
150 | 168 | ||
151 | private IntPtr _linkJointGroup = (IntPtr)0; | 169 | private IntPtr _linkJointGroup = IntPtr.Zero; |
152 | private PhysicsActor _parent = null; | 170 | private PhysicsActor _parent; |
153 | private PhysicsActor m_taintparent = null; | 171 | private PhysicsActor m_taintparent; |
154 | 172 | ||
155 | private List<OdePrim> childrenPrim = new List<OdePrim>(); | 173 | private List<OdePrim> childrenPrim = new List<OdePrim>(); |
156 | 174 | ||
157 | private bool iscolliding = false; | 175 | private bool iscolliding; |
158 | private bool m_isphysical = false; | 176 | private bool m_isphysical; |
159 | private bool m_isSelected = false; | 177 | private bool m_isSelected; |
160 | 178 | ||
161 | internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively | 179 | internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively |
162 | 180 | ||
163 | private bool m_throttleUpdates = false; | 181 | private bool m_throttleUpdates; |
164 | private int throttleCounter = 0; | 182 | private int throttleCounter; |
165 | public int m_interpenetrationcount = 0; | 183 | public int m_interpenetrationcount; |
166 | public float m_collisionscore = 0; | 184 | public float m_collisionscore; |
167 | public int m_roundsUnderMotionThreshold = 0; | 185 | public int m_roundsUnderMotionThreshold; |
168 | private int m_crossingfailures = 0; | 186 | private int m_crossingfailures; |
169 | 187 | ||
170 | public bool outofBounds = false; | 188 | public bool outofBounds; |
171 | private float m_density = 10.000006836f; // Aluminum g/cm3; | 189 | private float m_density = 10.000006836f; // Aluminum g/cm3; |
172 | 190 | ||
173 | public bool _zeroFlag = false; | 191 | public bool _zeroFlag; |
174 | private bool m_lastUpdateSent = false; | 192 | private bool m_lastUpdateSent; |
175 | 193 | ||
176 | public IntPtr Body = (IntPtr) 0; | 194 | public IntPtr Body = IntPtr.Zero; |
177 | public String m_primName; | 195 | public String m_primName; |
178 | // private String m_primName; | 196 | private Vector3 _target_velocity; |
179 | private PhysicsVector _target_velocity; | ||
180 | public d.Mass pMass; | 197 | public d.Mass pMass; |
181 | 198 | ||
182 | public int m_eventsubscription = 0; | 199 | public int m_eventsubscription; |
183 | private CollisionEventUpdate CollisionEventsThisFrame = null; | 200 | private CollisionEventUpdate CollisionEventsThisFrame; |
184 | 201 | ||
185 | private IntPtr m_linkJoint = (IntPtr)0; | 202 | private IntPtr m_linkJoint = IntPtr.Zero; |
186 | 203 | ||
187 | public volatile bool childPrim = false; | 204 | public volatile bool childPrim; |
188 | 205 | ||
189 | private ODEDynamics m_vehicle; | 206 | private ODEDynamics m_vehicle; |
190 | 207 | ||
@@ -193,17 +210,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
193 | private int frcount = 0; // Used to limit dynamics debug output to | 210 | private int frcount = 0; // Used to limit dynamics debug output to |
194 | 211 | ||
195 | 212 | ||
196 | public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, | 213 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, |
197 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) | 214 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) |
198 | { | 215 | { |
199 | _target_velocity = new PhysicsVector(0, 0, 0); | ||
200 | m_vehicle = new ODEDynamics(); | 216 | m_vehicle = new ODEDynamics(); |
201 | //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned); | 217 | //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned); |
202 | ode = dode; | 218 | ode = dode; |
203 | _velocity = new PhysicsVector(); | 219 | if (!pos.IsFinite()) |
204 | if (!PhysicsVector.isFinite(pos)) | ||
205 | { | 220 | { |
206 | pos = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), parent_scene.GetTerrainHeightAtXY(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f)) + 0.5f); | 221 | pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), |
222 | parent_scene.GetTerrainHeightAtXY(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f)) + 0.5f); | ||
207 | m_log.Warn("[PHYSICS]: Got nonFinite Object create Position"); | 223 | m_log.Warn("[PHYSICS]: Got nonFinite Object create Position"); |
208 | } | 224 | } |
209 | _position = pos; | 225 | _position = pos; |
@@ -218,9 +234,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
218 | prim_geom = IntPtr.Zero; | 234 | prim_geom = IntPtr.Zero; |
219 | prev_geom = IntPtr.Zero; | 235 | prev_geom = IntPtr.Zero; |
220 | 236 | ||
221 | if (!PhysicsVector.isFinite(pos)) | 237 | if (!pos.IsFinite()) |
222 | { | 238 | { |
223 | size = new PhysicsVector(0.5f, 0.5f, 0.5f); | 239 | size = new Vector3(0.5f, 0.5f, 0.5f); |
224 | m_log.Warn("[PHYSICS]: Got nonFinite Object create Size"); | 240 | m_log.Warn("[PHYSICS]: Got nonFinite Object create Size"); |
225 | } | 241 | } |
226 | 242 | ||
@@ -230,8 +246,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
230 | 246 | ||
231 | _size = size; | 247 | _size = size; |
232 | m_taintsize = _size; | 248 | m_taintsize = _size; |
233 | _acceleration = new PhysicsVector(); | ||
234 | m_rotationalVelocity = PhysicsVector.Zero; | ||
235 | 249 | ||
236 | if (!QuaternionIsFinite(rotation)) | 250 | if (!QuaternionIsFinite(rotation)) |
237 | { | 251 | { |
@@ -396,7 +410,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
396 | m_disabled = false; | 410 | m_disabled = false; |
397 | 411 | ||
398 | // The body doesn't already have a finite rotation mode set here | 412 | // The body doesn't already have a finite rotation mode set here |
399 | if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) | 413 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0.0f)) && _parent == null) |
400 | { | 414 | { |
401 | createAMotor(m_angularlock); | 415 | createAMotor(m_angularlock); |
402 | } | 416 | } |
@@ -809,6 +823,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
809 | m_collisionscore = 0; | 823 | m_collisionscore = 0; |
810 | } | 824 | } |
811 | 825 | ||
826 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); | ||
827 | |||
812 | public void setMesh(OdeScene parent_scene, IMesh mesh) | 828 | public void setMesh(OdeScene parent_scene, IMesh mesh) |
813 | { | 829 | { |
814 | // This sleeper is there to moderate how long it takes between | 830 | // This sleeper is there to moderate how long it takes between |
@@ -840,19 +856,24 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
840 | mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage | 856 | mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage |
841 | 857 | ||
842 | mesh.releaseSourceMeshData(); // free up the original mesh data to save memory | 858 | mesh.releaseSourceMeshData(); // free up the original mesh data to save memory |
859 | if (m_MeshToTriMeshMap.ContainsKey(mesh)) | ||
860 | { | ||
861 | _triMeshData = m_MeshToTriMeshMap[mesh]; | ||
862 | } | ||
863 | else | ||
864 | { | ||
865 | _triMeshData = d.GeomTriMeshDataCreate(); | ||
843 | 866 | ||
844 | _triMeshData = d.GeomTriMeshDataCreate(); | 867 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); |
845 | 868 | d.GeomTriMeshDataPreprocess(_triMeshData); | |
846 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); | 869 | m_MeshToTriMeshMap[mesh] = _triMeshData; |
847 | d.GeomTriMeshDataPreprocess(_triMeshData); | 870 | } |
848 | 871 | ||
849 | _parent_scene.waitForSpaceUnlock(m_targetSpace); | 872 | _parent_scene.waitForSpaceUnlock(m_targetSpace); |
850 | |||
851 | try | 873 | try |
852 | { | 874 | { |
853 | if (prim_geom == IntPtr.Zero) | 875 | if (prim_geom == IntPtr.Zero) |
854 | { | 876 | { |
855 | //Console.WriteLine(" setMesh 1"); | ||
856 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); | 877 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); |
857 | } | 878 | } |
858 | } | 879 | } |
@@ -862,6 +883,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
862 | return; | 883 | return; |
863 | } | 884 | } |
864 | 885 | ||
886 | |||
865 | // if (IsPhysical && Body == (IntPtr) 0) | 887 | // if (IsPhysical && Body == (IntPtr) 0) |
866 | // { | 888 | // { |
867 | // Recreate the body | 889 | // Recreate the body |
@@ -882,7 +904,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
882 | 904 | ||
883 | if (prim_geom != IntPtr.Zero) | 905 | if (prim_geom != IntPtr.Zero) |
884 | { | 906 | { |
885 | if (!_position.IsIdentical(m_taintposition,0f)) | 907 | if (!_position.ApproxEquals(m_taintposition, 0f)) |
886 | changemove(timestep); | 908 | changemove(timestep); |
887 | 909 | ||
888 | if (m_taintrot != _orientation) | 910 | if (m_taintrot != _orientation) |
@@ -907,7 +929,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
907 | changePhysicsStatus(timestep); | 929 | changePhysicsStatus(timestep); |
908 | // | 930 | // |
909 | 931 | ||
910 | if (!_size.IsIdentical(m_taintsize,0)) | 932 | if (!_size.ApproxEquals(m_taintsize,0f)) |
911 | changesize(timestep); | 933 | changesize(timestep); |
912 | // | 934 | // |
913 | 935 | ||
@@ -921,7 +943,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
921 | if (m_taintaddangularforce) | 943 | if (m_taintaddangularforce) |
922 | changeAddAngularForce(timestep); | 944 | changeAddAngularForce(timestep); |
923 | 945 | ||
924 | if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f)) | 946 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) |
925 | changeSetTorque(timestep); | 947 | changeSetTorque(timestep); |
926 | 948 | ||
927 | if (m_taintdisable) | 949 | if (m_taintdisable) |
@@ -930,7 +952,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
930 | if (m_taintselected != m_isSelected) | 952 | if (m_taintselected != m_isSelected) |
931 | changeSelectedStatus(timestep); | 953 | changeSelectedStatus(timestep); |
932 | 954 | ||
933 | if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f)) | 955 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) |
934 | changevelocity(timestep); | 956 | changevelocity(timestep); |
935 | 957 | ||
936 | if (m_taintparent != _parent) | 958 | if (m_taintparent != _parent) |
@@ -939,7 +961,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
939 | if (m_taintCollidesWater != m_collidesWater) | 961 | if (m_taintCollidesWater != m_collidesWater) |
940 | changefloatonwater(timestep); | 962 | changefloatonwater(timestep); |
941 | 963 | ||
942 | if (!m_angularlock.IsIdentical(m_taintAngularLock,0)) | 964 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) |
943 | changeAngularLock(timestep); | 965 | changeAngularLock(timestep); |
944 | 966 | ||
945 | } | 967 | } |
@@ -959,7 +981,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
959 | //If we have a parent then we're not authorative here | 981 | //If we have a parent then we're not authorative here |
960 | if (_parent == null) | 982 | if (_parent == null) |
961 | { | 983 | { |
962 | if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f,1f,1f), 0)) | 984 | if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f)) |
963 | { | 985 | { |
964 | //d.BodySetFiniteRotationMode(Body, 0); | 986 | //d.BodySetFiniteRotationMode(Body, 0); |
965 | //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); | 987 | //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); |
@@ -976,7 +998,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
976 | } | 998 | } |
977 | } | 999 | } |
978 | // Store this for later in case we get turned into a separate body | 1000 | // Store this for later in case we get turned into a separate body |
979 | m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z); | 1001 | m_angularlock = m_taintAngularLock; |
980 | 1002 | ||
981 | } | 1003 | } |
982 | 1004 | ||
@@ -1120,7 +1142,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1120 | prm.m_disabled = false; | 1142 | prm.m_disabled = false; |
1121 | 1143 | ||
1122 | // The body doesn't already have a finite rotation mode set here | 1144 | // The body doesn't already have a finite rotation mode set here |
1123 | if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) | 1145 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) |
1124 | { | 1146 | { |
1125 | prm.createAMotor(m_angularlock); | 1147 | prm.createAMotor(m_angularlock); |
1126 | } | 1148 | } |
@@ -1163,7 +1185,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1163 | m_disabled = false; | 1185 | m_disabled = false; |
1164 | 1186 | ||
1165 | // The body doesn't already have a finite rotation mode set here | 1187 | // The body doesn't already have a finite rotation mode set here |
1166 | if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) | 1188 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) |
1167 | { | 1189 | { |
1168 | createAMotor(m_angularlock); | 1190 | createAMotor(m_angularlock); |
1169 | } | 1191 | } |
@@ -1347,7 +1369,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1347 | m_taintshape = false; | 1369 | m_taintshape = false; |
1348 | m_taintforce = false; | 1370 | m_taintforce = false; |
1349 | m_taintdisable = false; | 1371 | m_taintdisable = false; |
1350 | m_taintVelocity = PhysicsVector.Zero; | 1372 | m_taintVelocity = Vector3.Zero; |
1351 | } | 1373 | } |
1352 | 1374 | ||
1353 | public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) | 1375 | public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) |
@@ -1580,7 +1602,7 @@ if(frcount == 0) Console.WriteLine("Move " + m_primName + " VTyp " + m_vehicle | |||
1580 | { | 1602 | { |
1581 | if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 | 1603 | if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 |
1582 | // NON-'VEHICLES' are dealt with here | 1604 | // NON-'VEHICLES' are dealt with here |
1583 | if (d.BodyIsEnabled(Body) && !m_angularlock.IsIdentical(PhysicsVector.Zero, 0.003f)) | 1605 | if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) |
1584 | { | 1606 | { |
1585 | d.Vector3 avel2 = d.BodyGetAngularVel(Body); | 1607 | d.Vector3 avel2 = d.BodyGetAngularVel(Body); |
1586 | if (m_angularlock.X == 1) | 1608 | if (m_angularlock.X == 1) |
@@ -1634,7 +1656,7 @@ if(frcount == 0) Console.WriteLine("Move " + m_primName + " VTyp " + m_vehicle | |||
1634 | 1656 | ||
1635 | d.Vector3 pos = d.BodyGetPosition(Body); | 1657 | d.Vector3 pos = d.BodyGetPosition(Body); |
1636 | _target_velocity = | 1658 | _target_velocity = |
1637 | new PhysicsVector( | 1659 | new Vector3( |
1638 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), | 1660 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), |
1639 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), | 1661 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), |
1640 | (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) | 1662 | (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) |
@@ -1642,7 +1664,7 @@ if(frcount == 0) Console.WriteLine("Move " + m_primName + " VTyp " + m_vehicle | |||
1642 | 1664 | ||
1643 | // if velocity is zero, use position control; otherwise, velocity control | 1665 | // if velocity is zero, use position control; otherwise, velocity control |
1644 | 1666 | ||
1645 | if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f)) | 1667 | if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f)) |
1646 | { | 1668 | { |
1647 | // keep track of where we stopped. No more slippin' & slidin' | 1669 | // keep track of where we stopped. No more slippin' & slidin' |
1648 | 1670 | ||
@@ -1727,13 +1749,13 @@ if(frcount == 0) Console.WriteLine("Move " + m_primName + " VTyp " + m_vehicle | |||
1727 | 1749 | ||
1728 | 1750 | ||
1729 | _target_velocity = | 1751 | _target_velocity = |
1730 | new PhysicsVector(0.0f, 0.0f, | 1752 | new Vector3(0.0f, 0.0f, |
1731 | (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) | 1753 | (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) |
1732 | ); | 1754 | ); |
1733 | 1755 | ||
1734 | // if velocity is zero, use position control; otherwise, velocity control | 1756 | // if velocity is zero, use position control; otherwise, velocity control |
1735 | 1757 | ||
1736 | if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f)) | 1758 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) |
1737 | { | 1759 | { |
1738 | // keep track of where we stopped. No more slippin' & slidin' | 1760 | // keep track of where we stopped. No more slippin' & slidin' |
1739 | 1761 | ||
@@ -1860,7 +1882,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
1860 | d.BodySetQuaternion(Body, ref myrot); | 1882 | d.BodySetQuaternion(Body, ref myrot); |
1861 | if (m_isphysical) | 1883 | if (m_isphysical) |
1862 | { | 1884 | { |
1863 | if (!m_angularlock.IsIdentical(new PhysicsVector(1, 1, 1), 0)) | 1885 | if (!m_angularlock.ApproxEquals(Vector3.One, 0f)) |
1864 | createAMotor(m_angularlock); | 1886 | createAMotor(m_angularlock); |
1865 | } | 1887 | } |
1866 | } | 1888 | } |
@@ -2169,7 +2191,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2169 | //m_log.Info("[PHYSICS]: dequeing forcelist"); | 2191 | //m_log.Info("[PHYSICS]: dequeing forcelist"); |
2170 | if (IsPhysical) | 2192 | if (IsPhysical) |
2171 | { | 2193 | { |
2172 | PhysicsVector iforce = new PhysicsVector(); | 2194 | Vector3 iforce = Vector3.Zero; |
2173 | for (int i = 0; i < m_forcelist.Count; i++) | 2195 | for (int i = 0; i < m_forcelist.Count; i++) |
2174 | { | 2196 | { |
2175 | iforce = iforce + (m_forcelist[i] * 100); | 2197 | iforce = iforce + (m_forcelist[i] * 100); |
@@ -2199,8 +2221,8 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2199 | d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z); | 2221 | d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z); |
2200 | } | 2222 | } |
2201 | } | 2223 | } |
2202 | 2224 | ||
2203 | m_taintTorque = new PhysicsVector(0, 0, 0); | 2225 | m_taintTorque = Vector3.Zero; |
2204 | } | 2226 | } |
2205 | 2227 | ||
2206 | public void changeAddAngularForce(float timestamp) | 2228 | public void changeAddAngularForce(float timestamp) |
@@ -2212,7 +2234,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2212 | //m_log.Info("[PHYSICS]: dequeing forcelist"); | 2234 | //m_log.Info("[PHYSICS]: dequeing forcelist"); |
2213 | if (IsPhysical) | 2235 | if (IsPhysical) |
2214 | { | 2236 | { |
2215 | PhysicsVector iforce = new PhysicsVector(); | 2237 | Vector3 iforce = Vector3.Zero; |
2216 | for (int i = 0; i < m_angularforcelist.Count; i++) | 2238 | for (int i = 0; i < m_angularforcelist.Count; i++) |
2217 | { | 2239 | { |
2218 | iforce = iforce + (m_angularforcelist[i] * 100); | 2240 | iforce = iforce + (m_angularforcelist[i] * 100); |
@@ -2246,7 +2268,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2246 | 2268 | ||
2247 | //resetCollisionAccounting(); | 2269 | //resetCollisionAccounting(); |
2248 | } | 2270 | } |
2249 | m_taintVelocity = PhysicsVector.Zero; | 2271 | m_taintVelocity = Vector3.Zero; |
2250 | } | 2272 | } |
2251 | 2273 | ||
2252 | public override bool IsPhysical | 2274 | public override bool IsPhysical |
@@ -2255,7 +2277,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2255 | set { | 2277 | set { |
2256 | m_isphysical = value; | 2278 | m_isphysical = value; |
2257 | if (!m_isphysical) // Zero the remembered last velocity | 2279 | if (!m_isphysical) // Zero the remembered last velocity |
2258 | m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); | 2280 | m_lastVelocity = Vector3.Zero; |
2259 | } | 2281 | } |
2260 | } | 2282 | } |
2261 | 2283 | ||
@@ -2300,7 +2322,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2300 | get { return _zeroFlag; } | 2322 | get { return _zeroFlag; } |
2301 | } | 2323 | } |
2302 | 2324 | ||
2303 | public override PhysicsVector Position | 2325 | public override Vector3 Position |
2304 | { | 2326 | { |
2305 | get { return _position; } | 2327 | get { return _position; } |
2306 | 2328 | ||
@@ -2309,12 +2331,12 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2309 | } | 2331 | } |
2310 | } | 2332 | } |
2311 | 2333 | ||
2312 | public override PhysicsVector Size | 2334 | public override Vector3 Size |
2313 | { | 2335 | { |
2314 | get { return _size; } | 2336 | get { return _size; } |
2315 | set | 2337 | set |
2316 | { | 2338 | { |
2317 | if (PhysicsVector.isFinite(value)) | 2339 | if (value.IsFinite()) |
2318 | { | 2340 | { |
2319 | _size = value; | 2341 | _size = value; |
2320 | } | 2342 | } |
@@ -2330,13 +2352,13 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2330 | get { return CalculateMass(); } | 2352 | get { return CalculateMass(); } |
2331 | } | 2353 | } |
2332 | 2354 | ||
2333 | public override PhysicsVector Force | 2355 | public override Vector3 Force |
2334 | { | 2356 | { |
2335 | //get { return PhysicsVector.Zero; } | 2357 | //get { return Vector3.Zero; } |
2336 | get { return m_force; } | 2358 | get { return m_force; } |
2337 | set | 2359 | set |
2338 | { | 2360 | { |
2339 | if (PhysicsVector.isFinite(value)) | 2361 | if (value.IsFinite()) |
2340 | { | 2362 | { |
2341 | m_force = value; | 2363 | m_force = value; |
2342 | } | 2364 | } |
@@ -2358,7 +2380,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2358 | m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value); | 2380 | m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value); |
2359 | } | 2381 | } |
2360 | 2382 | ||
2361 | public override void VehicleVectorParam(int param, PhysicsVector value) | 2383 | public override void VehicleVectorParam(int param, Vector3 value) |
2362 | { | 2384 | { |
2363 | m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value); | 2385 | m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value); |
2364 | } | 2386 | } |
@@ -2376,14 +2398,14 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2376 | } | 2398 | } |
2377 | } | 2399 | } |
2378 | 2400 | ||
2379 | public override PhysicsVector CenterOfMass | 2401 | public override Vector3 CenterOfMass |
2380 | { | 2402 | { |
2381 | get { return PhysicsVector.Zero; } | 2403 | get { return Vector3.Zero; } |
2382 | } | 2404 | } |
2383 | 2405 | ||
2384 | public override PhysicsVector GeometricCenter | 2406 | public override Vector3 GeometricCenter |
2385 | { | 2407 | { |
2386 | get { return PhysicsVector.Zero; } | 2408 | get { return Vector3.Zero; } |
2387 | } | 2409 | } |
2388 | 2410 | ||
2389 | public override PrimitiveBaseShape Shape | 2411 | public override PrimitiveBaseShape Shape |
@@ -2395,13 +2417,13 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2395 | } | 2417 | } |
2396 | } | 2418 | } |
2397 | 2419 | ||
2398 | public override PhysicsVector Velocity | 2420 | public override Vector3 Velocity |
2399 | { | 2421 | { |
2400 | get | 2422 | get |
2401 | { | 2423 | { |
2402 | // Averate previous velocity with the new one so | 2424 | // Averate previous velocity with the new one so |
2403 | // client object interpolation works a 'little' better | 2425 | // client object interpolation works a 'little' better |
2404 | PhysicsVector returnVelocity = new PhysicsVector(); | 2426 | Vector3 returnVelocity = Vector3.Zero; |
2405 | returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; | 2427 | returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; |
2406 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2; | 2428 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2; |
2407 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; | 2429 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; |
@@ -2409,7 +2431,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2409 | } | 2431 | } |
2410 | set | 2432 | set |
2411 | { | 2433 | { |
2412 | if (PhysicsVector.isFinite(value)) | 2434 | if (value.IsFinite()) |
2413 | { | 2435 | { |
2414 | _velocity = value; | 2436 | _velocity = value; |
2415 | 2437 | ||
@@ -2424,19 +2446,19 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2424 | } | 2446 | } |
2425 | } | 2447 | } |
2426 | 2448 | ||
2427 | public override PhysicsVector Torque | 2449 | public override Vector3 Torque |
2428 | { | 2450 | { |
2429 | get | 2451 | get |
2430 | { | 2452 | { |
2431 | if (!m_isphysical || Body == IntPtr.Zero) | 2453 | if (!m_isphysical || Body == IntPtr.Zero) |
2432 | return new PhysicsVector(0,0,0); | 2454 | return Vector3.Zero; |
2433 | 2455 | ||
2434 | return _torque; | 2456 | return _torque; |
2435 | } | 2457 | } |
2436 | 2458 | ||
2437 | set | 2459 | set |
2438 | { | 2460 | { |
2439 | if (PhysicsVector.isFinite(value)) | 2461 | if (value.IsFinite()) |
2440 | { | 2462 | { |
2441 | m_taintTorque = value; | 2463 | m_taintTorque = value; |
2442 | _parent_scene.AddPhysicsActorTaint(this); | 2464 | _parent_scene.AddPhysicsActorTaint(this); |
@@ -2488,20 +2510,20 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2488 | return true; | 2510 | return true; |
2489 | } | 2511 | } |
2490 | 2512 | ||
2491 | public override PhysicsVector Acceleration | 2513 | public override Vector3 Acceleration |
2492 | { | 2514 | { |
2493 | get { return _acceleration; } | 2515 | get { return _acceleration; } |
2494 | } | 2516 | } |
2495 | 2517 | ||
2496 | 2518 | ||
2497 | public void SetAcceleration(PhysicsVector accel) | 2519 | public void SetAcceleration(Vector3 accel) |
2498 | { | 2520 | { |
2499 | _acceleration = accel; | 2521 | _acceleration = accel; |
2500 | } | 2522 | } |
2501 | 2523 | ||
2502 | public override void AddForce(PhysicsVector force, bool pushforce) | 2524 | public override void AddForce(Vector3 force, bool pushforce) |
2503 | { | 2525 | { |
2504 | if (PhysicsVector.isFinite(force)) | 2526 | if (force.IsFinite()) |
2505 | { | 2527 | { |
2506 | m_forcelist.Add(force); | 2528 | m_forcelist.Add(force); |
2507 | m_taintforce = true; | 2529 | m_taintforce = true; |
@@ -2513,9 +2535,9 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2513 | //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); | 2535 | //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); |
2514 | } | 2536 | } |
2515 | 2537 | ||
2516 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 2538 | public override void AddAngularForce(Vector3 force, bool pushforce) |
2517 | { | 2539 | { |
2518 | if (PhysicsVector.isFinite(force)) | 2540 | if (force.IsFinite()) |
2519 | { | 2541 | { |
2520 | m_angularforcelist.Add(force); | 2542 | m_angularforcelist.Add(force); |
2521 | m_taintaddangularforce = true; | 2543 | m_taintaddangularforce = true; |
@@ -2526,23 +2548,23 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2526 | } | 2548 | } |
2527 | } | 2549 | } |
2528 | 2550 | ||
2529 | public override PhysicsVector RotationalVelocity | 2551 | public override Vector3 RotationalVelocity |
2530 | { | 2552 | { |
2531 | get | 2553 | get |
2532 | { | 2554 | { |
2533 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | 2555 | Vector3 pv = Vector3.Zero; |
2534 | if (_zeroFlag) | 2556 | if (_zeroFlag) |
2535 | return pv; | 2557 | return pv; |
2536 | m_lastUpdateSent = false; | 2558 | m_lastUpdateSent = false; |
2537 | 2559 | ||
2538 | if (m_rotationalVelocity.IsIdentical(pv, 0.2f)) | 2560 | if (m_rotationalVelocity.ApproxEquals(pv, 0.2f)) |
2539 | return pv; | 2561 | return pv; |
2540 | 2562 | ||
2541 | return m_rotationalVelocity; | 2563 | return m_rotationalVelocity; |
2542 | } | 2564 | } |
2543 | set | 2565 | set |
2544 | { | 2566 | { |
2545 | if (PhysicsVector.isFinite(value)) | 2567 | if (value.IsFinite()) |
2546 | { | 2568 | { |
2547 | m_rotationalVelocity = value; | 2569 | m_rotationalVelocity = value; |
2548 | } | 2570 | } |
@@ -2583,16 +2605,16 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2583 | m_taintparent = null; | 2605 | m_taintparent = null; |
2584 | } | 2606 | } |
2585 | 2607 | ||
2586 | public override void LockAngularMotion(PhysicsVector axis) | 2608 | public override void LockAngularMotion(Vector3 axis) |
2587 | { | 2609 | { |
2588 | // reverse the zero/non zero values for ODE. | 2610 | // reverse the zero/non zero values for ODE. |
2589 | if (PhysicsVector.isFinite(axis)) | 2611 | if (axis.IsFinite()) |
2590 | { | 2612 | { |
2591 | axis.X = (axis.X > 0) ? 1f : 0f; | 2613 | axis.X = (axis.X > 0) ? 1f : 0f; |
2592 | axis.Y = (axis.Y > 0) ? 1f : 0f; | 2614 | axis.Y = (axis.Y > 0) ? 1f : 0f; |
2593 | axis.Z = (axis.Z > 0) ? 1f : 0f; | 2615 | axis.Z = (axis.Z > 0) ? 1f : 0f; |
2594 | m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); | 2616 | m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); |
2595 | m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z); | 2617 | m_taintAngularLock = axis; |
2596 | } | 2618 | } |
2597 | else | 2619 | else |
2598 | { | 2620 | { |
@@ -2605,7 +2627,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2605 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 2627 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
2606 | if (_parent == null) | 2628 | if (_parent == null) |
2607 | { | 2629 | { |
2608 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | 2630 | Vector3 pv = Vector3.Zero; |
2609 | bool lastZeroFlag = _zeroFlag; | 2631 | bool lastZeroFlag = _zeroFlag; |
2610 | if (Body != (IntPtr)0) // FIXME -> or if it is a joint | 2632 | if (Body != (IntPtr)0) // FIXME -> or if it is a joint |
2611 | { | 2633 | { |
@@ -2614,9 +2636,9 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2614 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 2636 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
2615 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); | 2637 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); |
2616 | d.Vector3 torque = d.BodyGetTorque(Body); | 2638 | d.Vector3 torque = d.BodyGetTorque(Body); |
2617 | _torque.setValues(torque.X, torque.Y, torque.Z); | 2639 | _torque = new Vector3(torque.X, torque.Y, torque.Z); |
2618 | PhysicsVector l_position = new PhysicsVector(); | 2640 | Vector3 l_position = Vector3.Zero; |
2619 | Quaternion l_orientation = new Quaternion(); | 2641 | Quaternion l_orientation = Quaternion.Identity; |
2620 | 2642 | ||
2621 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 2643 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
2622 | //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | 2644 | //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } |
@@ -2751,16 +2773,16 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2751 | _velocity.Z = vel.Z; | 2773 | _velocity.Z = vel.Z; |
2752 | 2774 | ||
2753 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); | 2775 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); |
2754 | _acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); | 2776 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); |
2755 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); | 2777 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); |
2756 | 2778 | ||
2757 | if (_velocity.IsIdentical(pv, 0.5f)) | 2779 | if (_velocity.ApproxEquals(pv, 0.5f)) |
2758 | { | 2780 | { |
2759 | m_rotationalVelocity = pv; | 2781 | m_rotationalVelocity = pv; |
2760 | } | 2782 | } |
2761 | else | 2783 | else |
2762 | { | 2784 | { |
2763 | m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z); | 2785 | m_rotationalVelocity = new Vector3(rotvel.X, rotvel.Y, rotvel.Z); |
2764 | } | 2786 | } |
2765 | 2787 | ||
2766 | //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); | 2788 | //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); |
@@ -2808,15 +2830,15 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2808 | } | 2830 | } |
2809 | } | 2831 | } |
2810 | 2832 | ||
2811 | public override void SetMomentum(PhysicsVector momentum) | 2833 | public override void SetMomentum(Vector3 momentum) |
2812 | { | 2834 | { |
2813 | } | 2835 | } |
2814 | 2836 | ||
2815 | public override PhysicsVector PIDTarget | 2837 | public override Vector3 PIDTarget |
2816 | { | 2838 | { |
2817 | set | 2839 | set |
2818 | { | 2840 | { |
2819 | if (PhysicsVector.isFinite(value)) | 2841 | if (value.IsFinite()) |
2820 | { | 2842 | { |
2821 | m_PIDTarget = value; | 2843 | m_PIDTarget = value; |
2822 | } | 2844 | } |
@@ -2838,7 +2860,7 @@ if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + | |||
2838 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 2860 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } |
2839 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } | 2861 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } |
2840 | 2862 | ||
2841 | private void createAMotor(PhysicsVector axis) | 2863 | private void createAMotor(Vector3 axis) |
2842 | { | 2864 | { |
2843 | if (Body == IntPtr.Zero) | 2865 | if (Body == IntPtr.Zero) |
2844 | return; | 2866 | return; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 0a065be..2f42646 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -239,6 +239,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
239 | private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>(); | 239 | private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>(); |
240 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); | 240 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); |
241 | private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>(); | 241 | private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>(); |
242 | private readonly Object _taintedPrimLock = new Object(); | ||
242 | private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>(); | 243 | private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>(); |
243 | private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); | 244 | private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); |
244 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); | 245 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); |
@@ -683,7 +684,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
683 | /// </summary> | 684 | /// </summary> |
684 | /// <param name="pos"></param> | 685 | /// <param name="pos"></param> |
685 | /// <returns>Returns which split up space the given position is in.</returns> | 686 | /// <returns>Returns which split up space the given position is in.</returns> |
686 | public string whichspaceamIin(PhysicsVector pos) | 687 | public string whichspaceamIin(Vector3 pos) |
687 | { | 688 | { |
688 | return calculateSpaceForGeom(pos).ToString(); | 689 | return calculateSpaceForGeom(pos).ToString(); |
689 | } | 690 | } |
@@ -962,7 +963,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
962 | 963 | ||
963 | //p2.CollidingObj = true; | 964 | //p2.CollidingObj = true; |
964 | contacts[i].depth = 0.00000003f; | 965 | contacts[i].depth = 0.00000003f; |
965 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); | 966 | p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f); |
966 | contacts[i].pos = | 967 | contacts[i].pos = |
967 | new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), | 968 | new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), |
968 | contacts[i].pos.Y + (p1.Size.Y/2), | 969 | contacts[i].pos.Y + (p1.Size.Y/2), |
@@ -980,7 +981,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
980 | 981 | ||
981 | //p2.CollidingObj = true; | 982 | //p2.CollidingObj = true; |
982 | contacts[i].depth = 0.00000003f; | 983 | contacts[i].depth = 0.00000003f; |
983 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f); | 984 | p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f); |
984 | contacts[i].pos = | 985 | contacts[i].pos = |
985 | new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), | 986 | new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), |
986 | contacts[i].pos.Y + (p1.Size.Y/2), | 987 | contacts[i].pos.Y + (p1.Size.Y/2), |
@@ -1645,9 +1646,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1645 | 1646 | ||
1646 | #region Add/Remove Entities | 1647 | #region Add/Remove Entities |
1647 | 1648 | ||
1648 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 1649 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
1649 | { | 1650 | { |
1650 | PhysicsVector pos = new PhysicsVector(); | 1651 | Vector3 pos; |
1651 | pos.X = position.X; | 1652 | pos.X = position.X; |
1652 | pos.Y = position.Y; | 1653 | pos.Y = position.Y; |
1653 | pos.Z = position.Z; | 1654 | pos.Z = position.Z; |
@@ -1697,18 +1698,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1697 | 1698 | ||
1698 | } | 1699 | } |
1699 | 1700 | ||
1700 | private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, | 1701 | private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, |
1701 | IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) | 1702 | IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) |
1702 | { | 1703 | { |
1703 | 1704 | ||
1704 | PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); | 1705 | Vector3 pos = position; |
1705 | //pos.X = position.X; | 1706 | Vector3 siz = size; |
1706 | //pos.Y = position.Y; | ||
1707 | //pos.Z = position.Z; | ||
1708 | PhysicsVector siz = new PhysicsVector(); | ||
1709 | siz.X = size.X; | ||
1710 | siz.Y = size.Y; | ||
1711 | siz.Z = size.Z; | ||
1712 | Quaternion rot = rotation; | 1707 | Quaternion rot = rotation; |
1713 | 1708 | ||
1714 | OdePrim newPrim; | 1709 | OdePrim newPrim; |
@@ -1735,14 +1730,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1735 | } | 1730 | } |
1736 | } | 1731 | } |
1737 | 1732 | ||
1738 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 1733 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
1739 | PhysicsVector size, Quaternion rotation) //To be removed | 1734 | Vector3 size, Quaternion rotation) //To be removed |
1740 | { | 1735 | { |
1741 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 1736 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
1742 | } | 1737 | } |
1743 | 1738 | ||
1744 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 1739 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
1745 | PhysicsVector size, Quaternion rotation, bool isPhysical) | 1740 | Vector3 size, Quaternion rotation, bool isPhysical) |
1746 | { | 1741 | { |
1747 | PhysicsActor result; | 1742 | PhysicsActor result; |
1748 | IMesh mesh = null; | 1743 | IMesh mesh = null; |
@@ -1975,7 +1970,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1975 | // this joint will just be added to a waiting list that is NOT processed during the main | 1970 | // this joint will just be added to a waiting list that is NOT processed during the main |
1976 | // Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests. | 1971 | // Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests. |
1977 | 1972 | ||
1978 | public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position, | 1973 | public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position, |
1979 | Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation) | 1974 | Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation) |
1980 | 1975 | ||
1981 | { | 1976 | { |
@@ -1983,7 +1978,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1983 | OdePhysicsJoint joint = new OdePhysicsJoint(); | 1978 | OdePhysicsJoint joint = new OdePhysicsJoint(); |
1984 | joint.ObjectNameInScene = objectNameInScene; | 1979 | joint.ObjectNameInScene = objectNameInScene; |
1985 | joint.Type = jointType; | 1980 | joint.Type = jointType; |
1986 | joint.Position = new PhysicsVector(position.X, position.Y, position.Z); | 1981 | joint.Position = position; |
1987 | joint.Rotation = rotation; | 1982 | joint.Rotation = rotation; |
1988 | joint.RawParams = parms; | 1983 | joint.RawParams = parms; |
1989 | joint.BodyNames = new List<string>(bodyNames); | 1984 | joint.BodyNames = new List<string>(bodyNames); |
@@ -2035,7 +2030,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2035 | } | 2030 | } |
2036 | 2031 | ||
2037 | // normally called from within OnJointMoved, which is called from within a lock (OdeLock) | 2032 | // normally called from within OnJointMoved, which is called from within a lock (OdeLock) |
2038 | public override PhysicsVector GetJointAnchor(PhysicsJoint joint) | 2033 | public override Vector3 GetJointAnchor(PhysicsJoint joint) |
2039 | { | 2034 | { |
2040 | Debug.Assert(joint.IsInPhysicsEngine); | 2035 | Debug.Assert(joint.IsInPhysicsEngine); |
2041 | d.Vector3 pos = new d.Vector3(); | 2036 | d.Vector3 pos = new d.Vector3(); |
@@ -2057,14 +2052,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2057 | break; | 2052 | break; |
2058 | } | 2053 | } |
2059 | } | 2054 | } |
2060 | return new PhysicsVector(pos.X, pos.Y, pos.Z); | 2055 | return new Vector3(pos.X, pos.Y, pos.Z); |
2061 | } | 2056 | } |
2062 | 2057 | ||
2063 | // normally called from within OnJointMoved, which is called from within a lock (OdeLock) | 2058 | // normally called from within OnJointMoved, which is called from within a lock (OdeLock) |
2064 | // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function | 2059 | // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function |
2065 | // appears to be unreliable. Fortunately we can compute the joint axis ourselves by | 2060 | // appears to be unreliable. Fortunately we can compute the joint axis ourselves by |
2066 | // keeping track of the joint's original orientation relative to one of the involved bodies. | 2061 | // keeping track of the joint's original orientation relative to one of the involved bodies. |
2067 | public override PhysicsVector GetJointAxis(PhysicsJoint joint) | 2062 | public override Vector3 GetJointAxis(PhysicsJoint joint) |
2068 | { | 2063 | { |
2069 | Debug.Assert(joint.IsInPhysicsEngine); | 2064 | Debug.Assert(joint.IsInPhysicsEngine); |
2070 | d.Vector3 axis = new d.Vector3(); | 2065 | d.Vector3 axis = new d.Vector3(); |
@@ -2086,7 +2081,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2086 | break; | 2081 | break; |
2087 | } | 2082 | } |
2088 | } | 2083 | } |
2089 | return new PhysicsVector(axis.X, axis.Y, axis.Z); | 2084 | return new Vector3(axis.X, axis.Y, axis.Z); |
2090 | } | 2085 | } |
2091 | 2086 | ||
2092 | 2087 | ||
@@ -2254,7 +2249,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2254 | /// <param name="pos">the position that the geom moved to</param> | 2249 | /// <param name="pos">the position that the geom moved to</param> |
2255 | /// <param name="currentspace">a pointer to the space it was in before it was moved.</param> | 2250 | /// <param name="currentspace">a pointer to the space it was in before it was moved.</param> |
2256 | /// <returns>a pointer to the new space it's in</returns> | 2251 | /// <returns>a pointer to the new space it's in</returns> |
2257 | public IntPtr recalculateSpaceForGeom(IntPtr geom, PhysicsVector pos, IntPtr currentspace) | 2252 | public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace) |
2258 | { | 2253 | { |
2259 | // Called from setting the Position and Size of an ODEPrim so | 2254 | // Called from setting the Position and Size of an ODEPrim so |
2260 | // it's already in locked space. | 2255 | // it's already in locked space. |
@@ -2401,7 +2396,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2401 | /// </summary> | 2396 | /// </summary> |
2402 | /// <param name="pos"></param> | 2397 | /// <param name="pos"></param> |
2403 | /// <returns>a pointer to the space. This could be a new space or reused space.</returns> | 2398 | /// <returns>a pointer to the space. This could be a new space or reused space.</returns> |
2404 | public IntPtr calculateSpaceForGeom(PhysicsVector pos) | 2399 | public IntPtr calculateSpaceForGeom(Vector3 pos) |
2405 | { | 2400 | { |
2406 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); | 2401 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); |
2407 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); | 2402 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); |
@@ -2413,7 +2408,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2413 | /// </summary> | 2408 | /// </summary> |
2414 | /// <param name="pos"></param> | 2409 | /// <param name="pos"></param> |
2415 | /// <returns>an array item based on the position</returns> | 2410 | /// <returns>an array item based on the position</returns> |
2416 | public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos) | 2411 | public int[] calculateSpaceArrayItemFromPos(Vector3 pos) |
2417 | { | 2412 | { |
2418 | int[] returnint = new int[2]; | 2413 | int[] returnint = new int[2]; |
2419 | 2414 | ||
@@ -2572,7 +2567,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2572 | if (prim is OdePrim) | 2567 | if (prim is OdePrim) |
2573 | { | 2568 | { |
2574 | OdePrim taintedprim = ((OdePrim) prim); | 2569 | OdePrim taintedprim = ((OdePrim) prim); |
2575 | lock (_taintedPrimH) | 2570 | lock (_taintedPrimLock) |
2576 | { | 2571 | { |
2577 | if (!(_taintedPrimH.Contains(taintedprim))) | 2572 | if (!(_taintedPrimH.Contains(taintedprim))) |
2578 | { | 2573 | { |
@@ -2700,24 +2695,28 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2700 | // Modify other objects in the scene. | 2695 | // Modify other objects in the scene. |
2701 | processedtaints = false; | 2696 | processedtaints = false; |
2702 | 2697 | ||
2703 | lock (_taintedPrimL) | 2698 | lock (_taintedPrimLock) |
2704 | { | 2699 | { |
2705 | foreach (OdePrim prim in _taintedPrimL) | 2700 | foreach (OdePrim prim in _taintedPrimL) |
2706 | { | 2701 | { |
2707 | |||
2708 | |||
2709 | if (prim.m_taintremove) | 2702 | if (prim.m_taintremove) |
2710 | { | 2703 | { |
2711 | //Console.WriteLine("Simulate calls RemovePrimThreadLocked"); | 2704 | //Console.WriteLine("Simulate calls RemovePrimThreadLocked"); |
2712 | RemovePrimThreadLocked(prim); | 2705 | RemovePrimThreadLocked(prim); |
2713 | } | 2706 | } |
2714 | else | 2707 | else |
2715 | { | 2708 | { |
2716 | //Console.WriteLine("Simulate calls ProcessTaints"); | 2709 | //Console.WriteLine("Simulate calls ProcessTaints"); |
2717 | prim.ProcessTaints(timeStep); | 2710 | prim.ProcessTaints(timeStep); |
2718 | } | 2711 | } |
2719 | processedtaints = true; | 2712 | processedtaints = true; |
2720 | prim.m_collisionscore = 0; | 2713 | prim.m_collisionscore = 0; |
2714 | |||
2715 | // This loop can block up the Heartbeat for a very long time on large regions. | ||
2716 | // We need to let the Watchdog know that the Heartbeat is not dead | ||
2717 | // NOTE: This is currently commented out, but if things like OAR loading are | ||
2718 | // timing the heartbeat out we will need to uncomment it | ||
2719 | //Watchdog.UpdateThread(); | ||
2721 | } | 2720 | } |
2722 | 2721 | ||
2723 | if (SupportsNINJAJoints) | 2722 | if (SupportsNINJAJoints) |
diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index cdd38c4..69e2d03 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs | |||
@@ -76,8 +76,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
76 | public void CreateAndDropPhysicalCube() | 76 | public void CreateAndDropPhysicalCube() |
77 | { | 77 | { |
78 | PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox(); | 78 | PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox(); |
79 | PhysicsVector position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); | 79 | Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); |
80 | PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f); | 80 | Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); |
81 | Quaternion rot = Quaternion.Identity; | 81 | Quaternion rot = Quaternion.Identity; |
82 | PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); | 82 | PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); |
83 | OdePrim oprim = (OdePrim)prim; | 83 | OdePrim oprim = (OdePrim)prim; |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index 135f49e..566b4e7 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | |||
@@ -36,20 +36,17 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
36 | { | 36 | { |
37 | public class POSCharacter : PhysicsActor | 37 | public class POSCharacter : PhysicsActor |
38 | { | 38 | { |
39 | private PhysicsVector _position; | 39 | private Vector3 _position; |
40 | public PhysicsVector _velocity; | 40 | public Vector3 _velocity; |
41 | public PhysicsVector _target_velocity = PhysicsVector.Zero; | 41 | public Vector3 _target_velocity = Vector3.Zero; |
42 | public PhysicsVector _size = PhysicsVector.Zero; | 42 | public Vector3 _size = Vector3.Zero; |
43 | private PhysicsVector _acceleration; | 43 | private Vector3 _acceleration; |
44 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | 44 | private Vector3 m_rotationalVelocity = Vector3.Zero; |
45 | private bool flying; | 45 | private bool flying; |
46 | private bool isColliding; | 46 | private bool isColliding; |
47 | 47 | ||
48 | public POSCharacter() | 48 | public POSCharacter() |
49 | { | 49 | { |
50 | _velocity = new PhysicsVector(); | ||
51 | _position = new PhysicsVector(); | ||
52 | _acceleration = new PhysicsVector(); | ||
53 | } | 50 | } |
54 | 51 | ||
55 | public override int PhysicsActorType | 52 | public override int PhysicsActorType |
@@ -58,7 +55,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
58 | set { return; } | 55 | set { return; } |
59 | } | 56 | } |
60 | 57 | ||
61 | public override PhysicsVector RotationalVelocity | 58 | public override Vector3 RotationalVelocity |
62 | { | 59 | { |
63 | get { return m_rotationalVelocity; } | 60 | get { return m_rotationalVelocity; } |
64 | set { m_rotationalVelocity = value; } | 61 | set { m_rotationalVelocity = value; } |
@@ -137,13 +134,13 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
137 | get { return false; } | 134 | get { return false; } |
138 | } | 135 | } |
139 | 136 | ||
140 | public override PhysicsVector Position | 137 | public override Vector3 Position |
141 | { | 138 | { |
142 | get { return _position; } | 139 | get { return _position; } |
143 | set { _position = value; } | 140 | set { _position = value; } |
144 | } | 141 | } |
145 | 142 | ||
146 | public override PhysicsVector Size | 143 | public override Vector3 Size |
147 | { | 144 | { |
148 | get { return _size; } | 145 | get { return _size; } |
149 | set | 146 | set |
@@ -158,9 +155,9 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
158 | get { return 0f; } | 155 | get { return 0f; } |
159 | } | 156 | } |
160 | 157 | ||
161 | public override PhysicsVector Force | 158 | public override Vector3 Force |
162 | { | 159 | { |
163 | get { return PhysicsVector.Zero; } | 160 | get { return Vector3.Zero; } |
164 | set { return; } | 161 | set { return; } |
165 | } | 162 | } |
166 | 163 | ||
@@ -175,7 +172,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
175 | 172 | ||
176 | } | 173 | } |
177 | 174 | ||
178 | public override void VehicleVectorParam(int param, PhysicsVector value) | 175 | public override void VehicleVectorParam(int param, Vector3 value) |
179 | { | 176 | { |
180 | 177 | ||
181 | } | 178 | } |
@@ -190,14 +187,14 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
190 | 187 | ||
191 | } | 188 | } |
192 | 189 | ||
193 | public override PhysicsVector CenterOfMass | 190 | public override Vector3 CenterOfMass |
194 | { | 191 | { |
195 | get { return PhysicsVector.Zero; } | 192 | get { return Vector3.Zero; } |
196 | } | 193 | } |
197 | 194 | ||
198 | public override PhysicsVector GeometricCenter | 195 | public override Vector3 GeometricCenter |
199 | { | 196 | { |
200 | get { return PhysicsVector.Zero; } | 197 | get { return Vector3.Zero; } |
201 | } | 198 | } |
202 | 199 | ||
203 | public override PrimitiveBaseShape Shape | 200 | public override PrimitiveBaseShape Shape |
@@ -205,15 +202,15 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
205 | set { return; } | 202 | set { return; } |
206 | } | 203 | } |
207 | 204 | ||
208 | public override PhysicsVector Velocity | 205 | public override Vector3 Velocity |
209 | { | 206 | { |
210 | get { return _velocity; } | 207 | get { return _velocity; } |
211 | set { _target_velocity = value; } | 208 | set { _target_velocity = value; } |
212 | } | 209 | } |
213 | 210 | ||
214 | public override PhysicsVector Torque | 211 | public override Vector3 Torque |
215 | { | 212 | { |
216 | get { return PhysicsVector.Zero; } | 213 | get { return Vector3.Zero; } |
217 | set { return; } | 214 | set { return; } |
218 | } | 215 | } |
219 | 216 | ||
@@ -229,7 +226,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
229 | set { } | 226 | set { } |
230 | } | 227 | } |
231 | 228 | ||
232 | public override PhysicsVector Acceleration | 229 | public override Vector3 Acceleration |
233 | { | 230 | { |
234 | get { return _acceleration; } | 231 | get { return _acceleration; } |
235 | } | 232 | } |
@@ -248,24 +245,24 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
248 | { | 245 | { |
249 | } | 246 | } |
250 | 247 | ||
251 | public override void LockAngularMotion(PhysicsVector axis) | 248 | public override void LockAngularMotion(Vector3 axis) |
252 | { | 249 | { |
253 | } | 250 | } |
254 | 251 | ||
255 | public void SetAcceleration(PhysicsVector accel) | 252 | public void SetAcceleration(Vector3 accel) |
256 | { | 253 | { |
257 | _acceleration = accel; | 254 | _acceleration = accel; |
258 | } | 255 | } |
259 | 256 | ||
260 | public override void AddForce(PhysicsVector force, bool pushforce) | 257 | public override void AddForce(Vector3 force, bool pushforce) |
261 | { | 258 | { |
262 | } | 259 | } |
263 | 260 | ||
264 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 261 | public override void AddAngularForce(Vector3 force, bool pushforce) |
265 | { | 262 | { |
266 | } | 263 | } |
267 | 264 | ||
268 | public override void SetMomentum(PhysicsVector momentum) | 265 | public override void SetMomentum(Vector3 momentum) |
269 | { | 266 | { |
270 | } | 267 | } |
271 | 268 | ||
@@ -273,7 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
273 | { | 270 | { |
274 | } | 271 | } |
275 | 272 | ||
276 | public override PhysicsVector PIDTarget | 273 | public override Vector3 PIDTarget |
277 | { | 274 | { |
278 | set { return; } | 275 | set { return; } |
279 | } | 276 | } |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index 4521dce..847b634 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs | |||
@@ -36,19 +36,16 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
36 | { | 36 | { |
37 | public class POSPrim : PhysicsActor | 37 | public class POSPrim : PhysicsActor |
38 | { | 38 | { |
39 | private PhysicsVector _position; | 39 | private Vector3 _position; |
40 | private PhysicsVector _velocity; | 40 | private Vector3 _velocity; |
41 | private PhysicsVector _acceleration; | 41 | private Vector3 _acceleration; |
42 | private PhysicsVector _size; | 42 | private Vector3 _size; |
43 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | 43 | private Vector3 m_rotationalVelocity = Vector3.Zero; |
44 | private Quaternion _orientation; | 44 | private Quaternion _orientation; |
45 | private bool iscolliding; | 45 | private bool iscolliding; |
46 | 46 | ||
47 | public POSPrim() | 47 | public POSPrim() |
48 | { | 48 | { |
49 | _velocity = new PhysicsVector(); | ||
50 | _position = new PhysicsVector(); | ||
51 | _acceleration = new PhysicsVector(); | ||
52 | } | 49 | } |
53 | 50 | ||
54 | public override int PhysicsActorType | 51 | public override int PhysicsActorType |
@@ -57,7 +54,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
57 | set { return; } | 54 | set { return; } |
58 | } | 55 | } |
59 | 56 | ||
60 | public override PhysicsVector RotationalVelocity | 57 | public override Vector3 RotationalVelocity |
61 | { | 58 | { |
62 | get { return m_rotationalVelocity; } | 59 | get { return m_rotationalVelocity; } |
63 | set { m_rotationalVelocity = value; } | 60 | set { m_rotationalVelocity = value; } |
@@ -98,13 +95,13 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
98 | get { return false; } | 95 | get { return false; } |
99 | } | 96 | } |
100 | 97 | ||
101 | public override PhysicsVector Position | 98 | public override Vector3 Position |
102 | { | 99 | { |
103 | get { return _position; } | 100 | get { return _position; } |
104 | set { _position = value; } | 101 | set { _position = value; } |
105 | } | 102 | } |
106 | 103 | ||
107 | public override PhysicsVector Size | 104 | public override Vector3 Size |
108 | { | 105 | { |
109 | get { return _size; } | 106 | get { return _size; } |
110 | set { _size = value; } | 107 | set { _size = value; } |
@@ -115,9 +112,9 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
115 | get { return 0f; } | 112 | get { return 0f; } |
116 | } | 113 | } |
117 | 114 | ||
118 | public override PhysicsVector Force | 115 | public override Vector3 Force |
119 | { | 116 | { |
120 | get { return PhysicsVector.Zero; } | 117 | get { return Vector3.Zero; } |
121 | set { return; } | 118 | set { return; } |
122 | } | 119 | } |
123 | 120 | ||
@@ -132,7 +129,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
132 | 129 | ||
133 | } | 130 | } |
134 | 131 | ||
135 | public override void VehicleVectorParam(int param, PhysicsVector value) | 132 | public override void VehicleVectorParam(int param, Vector3 value) |
136 | { | 133 | { |
137 | 134 | ||
138 | } | 135 | } |
@@ -147,14 +144,14 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
147 | 144 | ||
148 | } | 145 | } |
149 | 146 | ||
150 | public override PhysicsVector CenterOfMass | 147 | public override Vector3 CenterOfMass |
151 | { | 148 | { |
152 | get { return PhysicsVector.Zero; } | 149 | get { return Vector3.Zero; } |
153 | } | 150 | } |
154 | 151 | ||
155 | public override PhysicsVector GeometricCenter | 152 | public override Vector3 GeometricCenter |
156 | { | 153 | { |
157 | get { return PhysicsVector.Zero; } | 154 | get { return Vector3.Zero; } |
158 | } | 155 | } |
159 | 156 | ||
160 | public override PrimitiveBaseShape Shape | 157 | public override PrimitiveBaseShape Shape |
@@ -173,7 +170,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
173 | set { return; } | 170 | set { return; } |
174 | } | 171 | } |
175 | 172 | ||
176 | public override PhysicsVector Velocity | 173 | public override Vector3 Velocity |
177 | { | 174 | { |
178 | get { return _velocity; } | 175 | get { return _velocity; } |
179 | set { _velocity = value; } | 176 | set { _velocity = value; } |
@@ -191,7 +188,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
191 | set { _orientation = value; } | 188 | set { _orientation = value; } |
192 | } | 189 | } |
193 | 190 | ||
194 | public override PhysicsVector Acceleration | 191 | public override Vector3 Acceleration |
195 | { | 192 | { |
196 | get { return _acceleration; } | 193 | get { return _acceleration; } |
197 | } | 194 | } |
@@ -202,26 +199,26 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
202 | set { } | 199 | set { } |
203 | } | 200 | } |
204 | 201 | ||
205 | public void SetAcceleration(PhysicsVector accel) | 202 | public void SetAcceleration(Vector3 accel) |
206 | { | 203 | { |
207 | _acceleration = accel; | 204 | _acceleration = accel; |
208 | } | 205 | } |
209 | 206 | ||
210 | public override void AddForce(PhysicsVector force, bool pushforce) | 207 | public override void AddForce(Vector3 force, bool pushforce) |
211 | { | 208 | { |
212 | } | 209 | } |
213 | 210 | ||
214 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 211 | public override void AddAngularForce(Vector3 force, bool pushforce) |
215 | { | 212 | { |
216 | } | 213 | } |
217 | 214 | ||
218 | public override PhysicsVector Torque | 215 | public override Vector3 Torque |
219 | { | 216 | { |
220 | get { return PhysicsVector.Zero; } | 217 | get { return Vector3.Zero; } |
221 | set { return; } | 218 | set { return; } |
222 | } | 219 | } |
223 | 220 | ||
224 | public override void SetMomentum(PhysicsVector momentum) | 221 | public override void SetMomentum(Vector3 momentum) |
225 | { | 222 | { |
226 | } | 223 | } |
227 | 224 | ||
@@ -255,7 +252,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
255 | { | 252 | { |
256 | } | 253 | } |
257 | 254 | ||
258 | public override void LockAngularMotion(PhysicsVector axis) | 255 | public override void LockAngularMotion(Vector3 axis) |
259 | { | 256 | { |
260 | } | 257 | } |
261 | 258 | ||
@@ -268,7 +265,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
268 | { | 265 | { |
269 | } | 266 | } |
270 | 267 | ||
271 | public override PhysicsVector PIDTarget | 268 | public override Vector3 PIDTarget |
272 | { | 269 | { |
273 | set { return; } | 270 | set { return; } |
274 | } | 271 | } |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs index fa8cc70..c3f5040 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs | |||
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
56 | { | 56 | { |
57 | } | 57 | } |
58 | 58 | ||
59 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 59 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
60 | { | 60 | { |
61 | POSCharacter act = new POSCharacter(); | 61 | POSCharacter act = new POSCharacter(); |
62 | act.Position = position; | 62 | act.Position = position; |
@@ -84,20 +84,20 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
84 | } | 84 | } |
85 | 85 | ||
86 | /* | 86 | /* |
87 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) | 87 | public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) |
88 | { | 88 | { |
89 | return null; | 89 | return null; |
90 | } | 90 | } |
91 | */ | 91 | */ |
92 | 92 | ||
93 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 93 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
94 | PhysicsVector size, Quaternion rotation) | 94 | Vector3 size, Quaternion rotation) |
95 | { | 95 | { |
96 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 96 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
97 | } | 97 | } |
98 | 98 | ||
99 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 99 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
100 | PhysicsVector size, Quaternion rotation, bool isPhysical) | 100 | Vector3 size, Quaternion rotation, bool isPhysical) |
101 | { | 101 | { |
102 | POSPrim prim = new POSPrim(); | 102 | POSPrim prim = new POSPrim(); |
103 | prim.Position = position; | 103 | prim.Position = position; |
@@ -152,23 +152,25 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
152 | character._target_velocity.Z += gravity * timeStep; | 152 | character._target_velocity.Z += gravity * timeStep; |
153 | } | 153 | } |
154 | 154 | ||
155 | character.Position.X += character._target_velocity.X * timeStep; | 155 | Vector3 characterPosition = character.Position; |
156 | character.Position.Y += character._target_velocity.Y * timeStep; | ||
157 | 156 | ||
158 | character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f); | 157 | characterPosition.X += character._target_velocity.X * timeStep; |
159 | character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f); | 158 | characterPosition.Y += character._target_velocity.Y * timeStep; |
159 | |||
160 | characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f); | ||
161 | characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f); | ||
160 | 162 | ||
161 | bool forcedZ = false; | 163 | bool forcedZ = false; |
162 | 164 | ||
163 | float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X]; | 165 | float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X]; |
164 | if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) | 166 | if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) |
165 | { | 167 | { |
166 | character.Position.Z = terrainheight + character.Size.Z; | 168 | characterPosition.Z = terrainheight + character.Size.Z; |
167 | forcedZ = true; | 169 | forcedZ = true; |
168 | } | 170 | } |
169 | else | 171 | else |
170 | { | 172 | { |
171 | character.Position.Z += character._target_velocity.Z*timeStep; | 173 | characterPosition.Z += character._target_velocity.Z*timeStep; |
172 | } | 174 | } |
173 | 175 | ||
174 | /// this is it -- the magic you've all been waiting for! Ladies and gentlemen -- | 176 | /// this is it -- the magic you've all been waiting for! Ladies and gentlemen -- |
@@ -177,29 +179,29 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
177 | 179 | ||
178 | if (isCollidingWithPrim(character)) | 180 | if (isCollidingWithPrim(character)) |
179 | { | 181 | { |
180 | character.Position.Z = oldposZ; // first try Z axis | 182 | characterPosition.Z = oldposZ; // first try Z axis |
181 | if (isCollidingWithPrim(character)) | 183 | if (isCollidingWithPrim(character)) |
182 | { | 184 | { |
183 | character.Position.Z = oldposZ + character.Size.Z / 4.4f; // try harder | 185 | characterPosition.Z = oldposZ + character.Size.Z / 4.4f; // try harder |
184 | if (isCollidingWithPrim(character)) | 186 | if (isCollidingWithPrim(character)) |
185 | { | 187 | { |
186 | character.Position.Z = oldposZ + character.Size.Z / 2.2f; // try very hard | 188 | characterPosition.Z = oldposZ + character.Size.Z / 2.2f; // try very hard |
187 | if (isCollidingWithPrim(character)) | 189 | if (isCollidingWithPrim(character)) |
188 | { | 190 | { |
189 | character.Position.X = oldposX; | 191 | characterPosition.X = oldposX; |
190 | character.Position.Y = oldposY; | 192 | characterPosition.Y = oldposY; |
191 | character.Position.Z = oldposZ; | 193 | characterPosition.Z = oldposZ; |
192 | 194 | ||
193 | character.Position.X += character._target_velocity.X * timeStep; | 195 | characterPosition.X += character._target_velocity.X * timeStep; |
194 | if (isCollidingWithPrim(character)) | 196 | if (isCollidingWithPrim(character)) |
195 | { | 197 | { |
196 | character.Position.X = oldposX; | 198 | characterPosition.X = oldposX; |
197 | } | 199 | } |
198 | 200 | ||
199 | character.Position.Y += character._target_velocity.Y * timeStep; | 201 | characterPosition.Y += character._target_velocity.Y * timeStep; |
200 | if (isCollidingWithPrim(character)) | 202 | if (isCollidingWithPrim(character)) |
201 | { | 203 | { |
202 | character.Position.Y = oldposY; | 204 | characterPosition.Y = oldposY; |
203 | } | 205 | } |
204 | } | 206 | } |
205 | else | 207 | else |
@@ -218,8 +220,10 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
218 | } | 220 | } |
219 | } | 221 | } |
220 | 222 | ||
221 | character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f); | 223 | characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f); |
222 | character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f); | 224 | characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f); |
225 | |||
226 | character.Position = characterPosition; | ||
223 | 227 | ||
224 | character._velocity.X = (character.Position.X - oldposX)/timeStep; | 228 | character._velocity.X = (character.Position.X - oldposX)/timeStep; |
225 | character._velocity.Y = (character.Position.Y - oldposY)/timeStep; | 229 | character._velocity.Y = (character.Position.Y - oldposY)/timeStep; |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index b3bf70b..24eb6b1 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -34,6 +34,7 @@ using PhysXWrapper; | |||
34 | using Quaternion=OpenMetaverse.Quaternion; | 34 | using Quaternion=OpenMetaverse.Quaternion; |
35 | using System.Reflection; | 35 | using System.Reflection; |
36 | using log4net; | 36 | using log4net; |
37 | using OpenMetaverse; | ||
37 | 38 | ||
38 | namespace OpenSim.Region.Physics.PhysXPlugin | 39 | namespace OpenSim.Region.Physics.PhysXPlugin |
39 | { | 40 | { |
@@ -106,7 +107,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
106 | 107 | ||
107 | } | 108 | } |
108 | 109 | ||
109 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 110 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
110 | { | 111 | { |
111 | Vec3 pos = new Vec3(); | 112 | Vec3 pos = new Vec3(); |
112 | pos.X = position.X; | 113 | pos.X = position.X; |
@@ -127,7 +128,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
127 | { | 128 | { |
128 | } | 129 | } |
129 | 130 | ||
130 | private PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) | 131 | private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) |
131 | { | 132 | { |
132 | Vec3 pos = new Vec3(); | 133 | Vec3 pos = new Vec3(); |
133 | pos.X = position.X; | 134 | pos.X = position.X; |
@@ -142,14 +143,14 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
142 | return act; | 143 | return act; |
143 | } | 144 | } |
144 | 145 | ||
145 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 146 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
146 | PhysicsVector size, Quaternion rotation) //To be removed | 147 | Vector3 size, Quaternion rotation) //To be removed |
147 | { | 148 | { |
148 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 149 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
149 | } | 150 | } |
150 | 151 | ||
151 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 152 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
152 | PhysicsVector size, Quaternion rotation, bool isPhysical) | 153 | Vector3 size, Quaternion rotation, bool isPhysical) |
153 | { | 154 | { |
154 | return AddPrim(position, size, rotation); | 155 | return AddPrim(position, size, rotation); |
155 | } | 156 | } |
@@ -219,10 +220,10 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
219 | 220 | ||
220 | public class PhysXCharacter : PhysicsActor | 221 | public class PhysXCharacter : PhysicsActor |
221 | { | 222 | { |
222 | private PhysicsVector _position; | 223 | private Vector3 _position; |
223 | private PhysicsVector _velocity; | 224 | private Vector3 _velocity; |
224 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | 225 | private Vector3 m_rotationalVelocity = Vector3.Zero; |
225 | private PhysicsVector _acceleration; | 226 | private Vector3 _acceleration; |
226 | private NxCharacter _character; | 227 | private NxCharacter _character; |
227 | private bool flying; | 228 | private bool flying; |
228 | private bool iscolliding = false; | 229 | private bool iscolliding = false; |
@@ -230,9 +231,6 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
230 | 231 | ||
231 | public PhysXCharacter(NxCharacter character) | 232 | public PhysXCharacter(NxCharacter character) |
232 | { | 233 | { |
233 | _velocity = new PhysicsVector(); | ||
234 | _position = new PhysicsVector(); | ||
235 | _acceleration = new PhysicsVector(); | ||
236 | _character = character; | 234 | _character = character; |
237 | } | 235 | } |
238 | 236 | ||
@@ -310,7 +308,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
310 | set { return; } | 308 | set { return; } |
311 | } | 309 | } |
312 | 310 | ||
313 | public override PhysicsVector RotationalVelocity | 311 | public override Vector3 RotationalVelocity |
314 | { | 312 | { |
315 | get { return m_rotationalVelocity; } | 313 | get { return m_rotationalVelocity; } |
316 | set { m_rotationalVelocity = value; } | 314 | set { m_rotationalVelocity = value; } |
@@ -321,7 +319,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
321 | get { return false; } | 319 | get { return false; } |
322 | } | 320 | } |
323 | 321 | ||
324 | public override PhysicsVector Position | 322 | public override Vector3 Position |
325 | { | 323 | { |
326 | get { return _position; } | 324 | get { return _position; } |
327 | set | 325 | set |
@@ -335,9 +333,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
335 | } | 333 | } |
336 | } | 334 | } |
337 | 335 | ||
338 | public override PhysicsVector Size | 336 | public override Vector3 Size |
339 | { | 337 | { |
340 | get { return PhysicsVector.Zero; } | 338 | get { return Vector3.Zero; } |
341 | set { } | 339 | set { } |
342 | } | 340 | } |
343 | 341 | ||
@@ -346,9 +344,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
346 | get { return 0f; } | 344 | get { return 0f; } |
347 | } | 345 | } |
348 | 346 | ||
349 | public override PhysicsVector Force | 347 | public override Vector3 Force |
350 | { | 348 | { |
351 | get { return PhysicsVector.Zero; } | 349 | get { return Vector3.Zero; } |
352 | set { return; } | 350 | set { return; } |
353 | } | 351 | } |
354 | 352 | ||
@@ -363,7 +361,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
363 | 361 | ||
364 | } | 362 | } |
365 | 363 | ||
366 | public override void VehicleVectorParam(int param, PhysicsVector value) | 364 | public override void VehicleVectorParam(int param, Vector3 value) |
367 | { | 365 | { |
368 | 366 | ||
369 | } | 367 | } |
@@ -379,17 +377,17 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
379 | } | 377 | } |
380 | 378 | ||
381 | 379 | ||
382 | public override PhysicsVector CenterOfMass | 380 | public override Vector3 CenterOfMass |
383 | { | 381 | { |
384 | get { return PhysicsVector.Zero; } | 382 | get { return Vector3.Zero; } |
385 | } | 383 | } |
386 | 384 | ||
387 | public override PhysicsVector GeometricCenter | 385 | public override Vector3 GeometricCenter |
388 | { | 386 | { |
389 | get { return PhysicsVector.Zero; } | 387 | get { return Vector3.Zero; } |
390 | } | 388 | } |
391 | 389 | ||
392 | public override PhysicsVector Velocity | 390 | public override Vector3 Velocity |
393 | { | 391 | { |
394 | get { return _velocity; } | 392 | get { return _velocity; } |
395 | set { _velocity = value; } | 393 | set { _velocity = value; } |
@@ -413,25 +411,25 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
413 | set { } | 411 | set { } |
414 | } | 412 | } |
415 | 413 | ||
416 | public override PhysicsVector Acceleration | 414 | public override Vector3 Acceleration |
417 | { | 415 | { |
418 | get { return _acceleration; } | 416 | get { return _acceleration; } |
419 | } | 417 | } |
420 | 418 | ||
421 | public void SetAcceleration(PhysicsVector accel) | 419 | public void SetAcceleration(Vector3 accel) |
422 | { | 420 | { |
423 | _acceleration = accel; | 421 | _acceleration = accel; |
424 | } | 422 | } |
425 | 423 | ||
426 | public override void AddForce(PhysicsVector force, bool pushforce) | 424 | public override void AddForce(Vector3 force, bool pushforce) |
427 | { | 425 | { |
428 | } | 426 | } |
429 | public override PhysicsVector Torque | 427 | public override Vector3 Torque |
430 | { | 428 | { |
431 | get { return PhysicsVector.Zero; } | 429 | get { return Vector3.Zero; } |
432 | set { return; } | 430 | set { return; } |
433 | } | 431 | } |
434 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 432 | public override void AddAngularForce(Vector3 force, bool pushforce) |
435 | { | 433 | { |
436 | } | 434 | } |
437 | 435 | ||
@@ -445,12 +443,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
445 | 443 | ||
446 | } | 444 | } |
447 | 445 | ||
448 | public override void LockAngularMotion(PhysicsVector axis) | 446 | public override void LockAngularMotion(Vector3 axis) |
449 | { | 447 | { |
450 | 448 | ||
451 | } | 449 | } |
452 | 450 | ||
453 | public override void SetMomentum(PhysicsVector momentum) | 451 | public override void SetMomentum(Vector3 momentum) |
454 | { | 452 | { |
455 | } | 453 | } |
456 | 454 | ||
@@ -492,7 +490,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
492 | 490 | ||
493 | } | 491 | } |
494 | 492 | ||
495 | public override PhysicsVector PIDTarget { set { return; } } | 493 | public override Vector3 PIDTarget { set { return; } } |
496 | public override bool PIDActive { set { return; } } | 494 | public override bool PIDActive { set { return; } } |
497 | public override float PIDTau { set { return; } } | 495 | public override float PIDTau { set { return; } } |
498 | 496 | ||
@@ -540,15 +538,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
540 | 538 | ||
541 | public class PhysXPrim : PhysicsActor | 539 | public class PhysXPrim : PhysicsActor |
542 | { | 540 | { |
543 | private PhysicsVector _velocity; | 541 | private Vector3 _velocity; |
544 | private PhysicsVector _acceleration; | 542 | private Vector3 _acceleration; |
545 | private PhysicsVector m_rotationalVelocity; | 543 | private Vector3 m_rotationalVelocity; |
546 | private NxActor _prim; | 544 | private NxActor _prim; |
547 | 545 | ||
548 | public PhysXPrim(NxActor prim) | 546 | public PhysXPrim(NxActor prim) |
549 | { | 547 | { |
550 | _velocity = new PhysicsVector(); | 548 | _velocity = Vector3.Zero; |
551 | _acceleration = new PhysicsVector(); | 549 | _acceleration = Vector3.Zero; |
552 | _prim = prim; | 550 | _prim = prim; |
553 | } | 551 | } |
554 | 552 | ||
@@ -602,7 +600,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
602 | set { return; } | 600 | set { return; } |
603 | } | 601 | } |
604 | 602 | ||
605 | public override PhysicsVector RotationalVelocity | 603 | public override Vector3 RotationalVelocity |
606 | { | 604 | { |
607 | get { return m_rotationalVelocity; } | 605 | get { return m_rotationalVelocity; } |
608 | set { m_rotationalVelocity = value; } | 606 | set { m_rotationalVelocity = value; } |
@@ -638,11 +636,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
638 | get { return false; } | 636 | get { return false; } |
639 | } | 637 | } |
640 | 638 | ||
641 | public override PhysicsVector Position | 639 | public override Vector3 Position |
642 | { | 640 | { |
643 | get | 641 | get |
644 | { | 642 | { |
645 | PhysicsVector pos = new PhysicsVector(); | 643 | Vector3 pos = Vector3.Zero; |
646 | Vec3 vec = _prim.Position; | 644 | Vec3 vec = _prim.Position; |
647 | pos.X = vec.X; | 645 | pos.X = vec.X; |
648 | pos.Y = vec.Y; | 646 | pos.Y = vec.Y; |
@@ -651,7 +649,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
651 | } | 649 | } |
652 | set | 650 | set |
653 | { | 651 | { |
654 | PhysicsVector vec = value; | 652 | Vector3 vec = value; |
655 | Vec3 pos = new Vec3(); | 653 | Vec3 pos = new Vec3(); |
656 | pos.X = vec.X; | 654 | pos.X = vec.X; |
657 | pos.Y = vec.Y; | 655 | pos.Y = vec.Y; |
@@ -665,15 +663,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
665 | set { return; } | 663 | set { return; } |
666 | } | 664 | } |
667 | 665 | ||
668 | public override PhysicsVector Velocity | 666 | public override Vector3 Velocity |
669 | { | 667 | { |
670 | get { return _velocity; } | 668 | get { return _velocity; } |
671 | set { _velocity = value; } | 669 | set { _velocity = value; } |
672 | } | 670 | } |
673 | 671 | ||
674 | public override PhysicsVector Torque | 672 | public override Vector3 Torque |
675 | { | 673 | { |
676 | get { return PhysicsVector.Zero; } | 674 | get { return Vector3.Zero; } |
677 | set { return; } | 675 | set { return; } |
678 | } | 676 | } |
679 | 677 | ||
@@ -704,31 +702,31 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
704 | set { } | 702 | set { } |
705 | } | 703 | } |
706 | 704 | ||
707 | public override PhysicsVector Acceleration | 705 | public override Vector3 Acceleration |
708 | { | 706 | { |
709 | get { return _acceleration; } | 707 | get { return _acceleration; } |
710 | } | 708 | } |
711 | 709 | ||
712 | public void SetAcceleration(PhysicsVector accel) | 710 | public void SetAcceleration(Vector3 accel) |
713 | { | 711 | { |
714 | _acceleration = accel; | 712 | _acceleration = accel; |
715 | } | 713 | } |
716 | 714 | ||
717 | public override void AddForce(PhysicsVector force, bool pushforce) | 715 | public override void AddForce(Vector3 force, bool pushforce) |
718 | { | 716 | { |
719 | } | 717 | } |
720 | 718 | ||
721 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 719 | public override void AddAngularForce(Vector3 force, bool pushforce) |
722 | { | 720 | { |
723 | } | 721 | } |
724 | 722 | ||
725 | public override void SetMomentum(PhysicsVector momentum) | 723 | public override void SetMomentum(Vector3 momentum) |
726 | { | 724 | { |
727 | } | 725 | } |
728 | 726 | ||
729 | public override PhysicsVector Size | 727 | public override Vector3 Size |
730 | { | 728 | { |
731 | get { return PhysicsVector.Zero; } | 729 | get { return Vector3.Zero; } |
732 | set { } | 730 | set { } |
733 | } | 731 | } |
734 | 732 | ||
@@ -740,7 +738,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
740 | { | 738 | { |
741 | } | 739 | } |
742 | 740 | ||
743 | public override void LockAngularMotion(PhysicsVector axis) | 741 | public override void LockAngularMotion(Vector3 axis) |
744 | { | 742 | { |
745 | 743 | ||
746 | } | 744 | } |
@@ -750,9 +748,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
750 | get { return 0f; } | 748 | get { return 0f; } |
751 | } | 749 | } |
752 | 750 | ||
753 | public override PhysicsVector Force | 751 | public override Vector3 Force |
754 | { | 752 | { |
755 | get { return PhysicsVector.Zero; } | 753 | get { return Vector3.Zero; } |
756 | set { return; } | 754 | set { return; } |
757 | } | 755 | } |
758 | 756 | ||
@@ -767,7 +765,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
767 | 765 | ||
768 | } | 766 | } |
769 | 767 | ||
770 | public override void VehicleVectorParam(int param, PhysicsVector value) | 768 | public override void VehicleVectorParam(int param, Vector3 value) |
771 | { | 769 | { |
772 | 770 | ||
773 | } | 771 | } |
@@ -782,21 +780,21 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
782 | 780 | ||
783 | } | 781 | } |
784 | 782 | ||
785 | public override PhysicsVector CenterOfMass | 783 | public override Vector3 CenterOfMass |
786 | { | 784 | { |
787 | get { return PhysicsVector.Zero; } | 785 | get { return Vector3.Zero; } |
788 | } | 786 | } |
789 | 787 | ||
790 | public override PhysicsVector GeometricCenter | 788 | public override Vector3 GeometricCenter |
791 | { | 789 | { |
792 | get { return PhysicsVector.Zero; } | 790 | get { return Vector3.Zero; } |
793 | } | 791 | } |
794 | 792 | ||
795 | public override void CrossingFailure() | 793 | public override void CrossingFailure() |
796 | { | 794 | { |
797 | } | 795 | } |
798 | 796 | ||
799 | public override PhysicsVector PIDTarget { set { return; } } | 797 | public override Vector3 PIDTarget { set { return; } } |
800 | public override bool PIDActive { set { return; } } | 798 | public override bool PIDActive { set { return; } } |
801 | public override float PIDTau { set { return; } } | 799 | public override float PIDTau { set { return; } } |
802 | 800 | ||