diff options
author | Melanie | 2009-10-27 11:32:11 +0000 |
---|---|---|
committer | Melanie | 2009-10-27 11:32:11 +0000 |
commit | 31a848e97bd984ab0a85feca397ce419f6ae839a (patch) | |
tree | 4743f5eb7c12b3723ed4b986d19714d1b3a0a3ea /OpenSim/Region/Physics | |
parent | Commented out instrumentation in ODEPrim.cs (diff) | |
parent | Finally hunted down the Parallel deadlock. Packets were being handled asynchr... (diff) | |
download | opensim-SC_OLD-31a848e97bd984ab0a85feca397ce419f6ae839a.zip opensim-SC_OLD-31a848e97bd984ab0a85feca397ce419f6ae839a.tar.gz opensim-SC_OLD-31a848e97bd984ab0a85feca397ce419f6ae839a.tar.bz2 opensim-SC_OLD-31a848e97bd984ab0a85feca397ce419f6ae839a.tar.xz |
Merge branch 'master' into vehicles
Diffstat (limited to '')
25 files changed, 858 insertions, 842 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index 8d8b3fe..8df997e 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 8da9687..5ed3b14 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 | ||
@@ -634,7 +626,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
634 | /// </summary> | 626 | /// </summary> |
635 | /// <param name="force"></param> | 627 | /// <param name="force"></param> |
636 | /// <param name="pushforce">Is this a push by a script?</param> | 628 | /// <param name="pushforce">Is this a push by a script?</param> |
637 | public override void AddForce(PhysicsVector force, bool pushforce) | 629 | public override void AddForce(Vector3 force, bool pushforce) |
638 | { | 630 | { |
639 | if (pushforce) | 631 | if (pushforce) |
640 | { | 632 | { |
@@ -656,7 +648,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
656 | //m_lastUpdateSent = false; | 648 | //m_lastUpdateSent = false; |
657 | } | 649 | } |
658 | 650 | ||
659 | public void doForce(PhysicsVector force, bool now) | 651 | public void doForce(Vector3 force, bool now) |
660 | { | 652 | { |
661 | 653 | ||
662 | tempVector3.setValue(force.X, force.Y, force.Z); | 654 | tempVector3.setValue(force.X, force.Y, force.Z); |
@@ -671,7 +663,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
671 | } | 663 | } |
672 | } | 664 | } |
673 | 665 | ||
674 | public void doImpulse(PhysicsVector force, bool now) | 666 | public void doImpulse(Vector3 force, bool now) |
675 | { | 667 | { |
676 | 668 | ||
677 | tempVector3.setValue(force.X, force.Y, force.Z); | 669 | tempVector3.setValue(force.X, force.Y, force.Z); |
@@ -686,12 +678,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
686 | } | 678 | } |
687 | } | 679 | } |
688 | 680 | ||
689 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 681 | public override void AddAngularForce(Vector3 force, bool pushforce) |
690 | { | 682 | { |
691 | 683 | ||
692 | } | 684 | } |
693 | 685 | ||
694 | public override void SetMomentum(PhysicsVector momentum) | 686 | public override void SetMomentum(Vector3 momentum) |
695 | { | 687 | { |
696 | 688 | ||
697 | } | 689 | } |
@@ -808,7 +800,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
808 | 800 | ||
809 | AvatarGeomAndBodyCreation(m_position.X, m_position.Y, | 801 | AvatarGeomAndBodyCreation(m_position.X, m_position.Y, |
810 | m_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2)); | 802 | m_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2)); |
811 | Velocity = new PhysicsVector(0f, 0f, 0f); | 803 | Velocity = Vector3.Zero; |
812 | 804 | ||
813 | } | 805 | } |
814 | else | 806 | else |
@@ -852,9 +844,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
852 | } | 844 | } |
853 | //PidStatus = true; | 845 | //PidStatus = true; |
854 | 846 | ||
855 | PhysicsVector vec = new PhysicsVector(); | 847 | Vector3 vec = Vector3.Zero; |
856 | 848 | ||
857 | PhysicsVector vel = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); | 849 | Vector3 vel = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); |
858 | 850 | ||
859 | float movementdivisor = 1f; | 851 | float movementdivisor = 1f; |
860 | 852 | ||
@@ -885,7 +877,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
885 | // Avatar to Avatar collisions | 877 | // Avatar to Avatar collisions |
886 | // Prim to avatar collisions | 878 | // Prim to avatar collisions |
887 | 879 | ||
888 | PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); | 880 | Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); |
889 | vec.X = (m_target_velocity.X - vel.X) * (PID_D) + (m_zeroPosition.X - pos.X) * (PID_P * 2); | 881 | vec.X = (m_target_velocity.X - vel.X) * (PID_D) + (m_zeroPosition.X - pos.X) * (PID_P * 2); |
890 | vec.Y = (m_target_velocity.Y - vel.Y) * (PID_D) + (m_zeroPosition.Y - pos.Y) * (PID_P * 2); | 882 | vec.Y = (m_target_velocity.Y - vel.Y) * (PID_D) + (m_zeroPosition.Y - pos.Y) * (PID_P * 2); |
891 | if (m_flying) | 883 | if (m_flying) |
@@ -927,7 +919,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
927 | { | 919 | { |
928 | // We're colliding with something and we're not flying but we're moving | 920 | // We're colliding with something and we're not flying but we're moving |
929 | // This means we're walking or running. | 921 | // This means we're walking or running. |
930 | PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); | 922 | Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); |
931 | vec.Z = (m_target_velocity.Z - vel.Z) * PID_D + (m_zeroPosition.Z - pos.Z) * PID_P; | 923 | vec.Z = (m_target_velocity.Z - vel.Z) * PID_D + (m_zeroPosition.Z - pos.Z) * PID_P; |
932 | if (m_target_velocity.X > 0) | 924 | if (m_target_velocity.X > 0) |
933 | { | 925 | { |
@@ -1016,7 +1008,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1016 | tempVector2 = Body.getInterpolationLinearVelocity(); | 1008 | tempVector2 = Body.getInterpolationLinearVelocity(); |
1017 | 1009 | ||
1018 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 1010 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
1019 | PhysicsVector vec = new PhysicsVector(tempVector1.getX(),tempVector1.getY(),tempVector1.getZ()); | 1011 | Vector3 vec = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ()); |
1020 | 1012 | ||
1021 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 1013 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
1022 | if (vec.X < -10.0f) vec.X = 0.0f; | 1014 | if (vec.X < -10.0f) vec.X = 0.0f; |
@@ -1048,7 +1040,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1048 | else | 1040 | else |
1049 | { | 1041 | { |
1050 | m_lastUpdateSent = false; | 1042 | m_lastUpdateSent = false; |
1051 | vec = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); | 1043 | vec = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ()); |
1052 | m_velocity.X = (vec.X); | 1044 | m_velocity.X = (vec.X); |
1053 | m_velocity.Y = (vec.Y); | 1045 | m_velocity.Y = (vec.Y); |
1054 | 1046 | ||
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs index f22ea71..5b542db 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 | ||
@@ -567,20 +566,20 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
567 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } | 566 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } |
568 | 567 | ||
569 | 568 | ||
570 | public override void AddForce(PhysicsVector force, bool pushforce) | 569 | public override void AddForce(Vector3 force, bool pushforce) |
571 | { | 570 | { |
572 | m_forcelist.Add(force); | 571 | m_forcelist.Add(force); |
573 | m_taintforce = true; | 572 | m_taintforce = true; |
574 | //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); | 573 | //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); |
575 | } | 574 | } |
576 | 575 | ||
577 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 576 | public override void AddAngularForce(Vector3 force, bool pushforce) |
578 | { | 577 | { |
579 | m_angularforcelist.Add(force); | 578 | m_angularforcelist.Add(force); |
580 | m_taintaddangularforce = true; | 579 | m_taintaddangularforce = true; |
581 | } | 580 | } |
582 | 581 | ||
583 | public override void SetMomentum(PhysicsVector momentum) | 582 | public override void SetMomentum(Vector3 momentum) |
584 | { | 583 | { |
585 | } | 584 | } |
586 | 585 | ||
@@ -778,7 +777,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
778 | 777 | ||
779 | } | 778 | } |
780 | 779 | ||
781 | if (!_position.IsIdentical(m_taintposition, 0f)) | 780 | if (!_position.ApproxEquals(m_taintposition, 0f)) |
782 | { | 781 | { |
783 | m_log.Debug("[PHYSICS]: TaintMove"); | 782 | m_log.Debug("[PHYSICS]: TaintMove"); |
784 | changemove(timestep); | 783 | changemove(timestep); |
@@ -796,7 +795,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
796 | } | 795 | } |
797 | // | 796 | // |
798 | 797 | ||
799 | if (!_size.IsIdentical(m_taintsize, 0)) | 798 | if (!_size.ApproxEquals(m_taintsize, 0f)) |
800 | { | 799 | { |
801 | m_log.Debug("[PHYSICS]: TaintSize"); | 800 | m_log.Debug("[PHYSICS]: TaintSize"); |
802 | changesize(timestep); | 801 | changesize(timestep); |
@@ -820,7 +819,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
820 | m_log.Debug("[PHYSICS]: TaintAngularForce"); | 819 | m_log.Debug("[PHYSICS]: TaintAngularForce"); |
821 | changeAddAngularForce(timestep); | 820 | changeAddAngularForce(timestep); |
822 | } | 821 | } |
823 | if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f)) | 822 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) |
824 | { | 823 | { |
825 | m_log.Debug("[PHYSICS]: TaintTorque"); | 824 | m_log.Debug("[PHYSICS]: TaintTorque"); |
826 | changeSetTorque(timestep); | 825 | changeSetTorque(timestep); |
@@ -835,7 +834,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
835 | m_log.Debug("[PHYSICS]: TaintSelected"); | 834 | m_log.Debug("[PHYSICS]: TaintSelected"); |
836 | changeSelectedStatus(timestep); | 835 | changeSelectedStatus(timestep); |
837 | } | 836 | } |
838 | if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f)) | 837 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) |
839 | { | 838 | { |
840 | m_log.Debug("[PHYSICS]: TaintVelocity"); | 839 | m_log.Debug("[PHYSICS]: TaintVelocity"); |
841 | changevelocity(timestep); | 840 | changevelocity(timestep); |
@@ -849,7 +848,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
849 | { | 848 | { |
850 | changefloatonwater(timestep); | 849 | changefloatonwater(timestep); |
851 | } | 850 | } |
852 | if (!m_angularlock.IsIdentical(m_taintAngularLock, 0)) | 851 | if (!m_angularlock.ApproxEquals(m_taintAngularLock, 0)) |
853 | { | 852 | { |
854 | m_log.Debug("[PHYSICS]: TaintAngularLock"); | 853 | m_log.Debug("[PHYSICS]: TaintAngularLock"); |
855 | changeAngularLock(timestep); | 854 | changeAngularLock(timestep); |
@@ -1012,7 +1011,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1012 | { | 1011 | { |
1013 | if (_parent_scene.needsMeshing(_pbs)) | 1012 | if (_parent_scene.needsMeshing(_pbs)) |
1014 | { | 1013 | { |
1015 | ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity); | 1014 | ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity); |
1016 | // createmesh returns null when it doesn't mesh. | 1015 | // createmesh returns null when it doesn't mesh. |
1017 | CreateGeom(IntPtr.Zero, _mesh); | 1016 | CreateGeom(IntPtr.Zero, _mesh); |
1018 | } | 1017 | } |
@@ -1029,7 +1028,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1029 | return _parent_scene.needsMeshing(_pbs); | 1028 | return _parent_scene.needsMeshing(_pbs); |
1030 | } | 1029 | } |
1031 | 1030 | ||
1032 | internal void ProcessGeomCreationAsTriMesh(PhysicsVector positionOffset, Quaternion orientation) | 1031 | internal void ProcessGeomCreationAsTriMesh(Vector3 positionOffset, Quaternion orientation) |
1033 | { | 1032 | { |
1034 | // Don't need to re-enable body.. it's done in SetMesh | 1033 | // Don't need to re-enable body.. it's done in SetMesh |
1035 | float meshlod = _parent_scene.meshSculptLOD; | 1034 | float meshlod = _parent_scene.meshSculptLOD; |
@@ -1038,7 +1037,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1038 | meshlod = _parent_scene.MeshSculptphysicalLOD; | 1037 | meshlod = _parent_scene.MeshSculptphysicalLOD; |
1039 | 1038 | ||
1040 | IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical); | 1039 | IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical); |
1041 | if (!positionOffset.IsIdentical(PhysicsVector.Zero, 0.001f) || orientation != Quaternion.Identity) | 1040 | if (!positionOffset.ApproxEquals(Vector3.Zero, 0.001f) || orientation != Quaternion.Identity) |
1042 | { | 1041 | { |
1043 | 1042 | ||
1044 | float[] xyz = new float[3]; | 1043 | float[] xyz = new float[3]; |
@@ -1202,7 +1201,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1202 | //m_log.Info("[PHYSICS]: dequeing forcelist"); | 1201 | //m_log.Info("[PHYSICS]: dequeing forcelist"); |
1203 | if (IsPhysical) | 1202 | if (IsPhysical) |
1204 | { | 1203 | { |
1205 | PhysicsVector iforce = new PhysicsVector(); | 1204 | Vector3 iforce = Vector3.Zero; |
1206 | for (int i = 0; i < m_forcelist.Count; i++) | 1205 | for (int i = 0; i < m_forcelist.Count; i++) |
1207 | { | 1206 | { |
1208 | iforce = iforce + m_forcelist[i]; | 1207 | iforce = iforce + m_forcelist[i]; |
@@ -1237,7 +1236,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1237 | //m_log.Info("[PHYSICS]: dequeing forcelist"); | 1236 | //m_log.Info("[PHYSICS]: dequeing forcelist"); |
1238 | if (IsPhysical) | 1237 | if (IsPhysical) |
1239 | { | 1238 | { |
1240 | PhysicsVector iforce = new PhysicsVector(); | 1239 | Vector3 iforce = Vector3.Zero; |
1241 | for (int i = 0; i < m_angularforcelist.Count; i++) | 1240 | for (int i = 0; i < m_angularforcelist.Count; i++) |
1242 | { | 1241 | { |
1243 | iforce = iforce + m_angularforcelist[i]; | 1242 | iforce = iforce + m_angularforcelist[i]; |
@@ -1276,7 +1275,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1276 | } | 1275 | } |
1277 | } | 1276 | } |
1278 | } | 1277 | } |
1279 | m_taintTorque = new PhysicsVector(0, 0, 0); | 1278 | m_taintTorque = Vector3.Zero; |
1280 | } | 1279 | } |
1281 | 1280 | ||
1282 | private void changedisable(float timestep) | 1281 | private void changedisable(float timestep) |
@@ -1317,7 +1316,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1317 | 1316 | ||
1318 | //resetCollisionAccounting(); | 1317 | //resetCollisionAccounting(); |
1319 | } | 1318 | } |
1320 | m_taintVelocity = PhysicsVector.Zero; | 1319 | m_taintVelocity = Vector3.Zero; |
1321 | } | 1320 | } |
1322 | 1321 | ||
1323 | private void changelink(float timestep) | 1322 | private void changelink(float timestep) |
@@ -1361,7 +1360,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1361 | 1360 | ||
1362 | if (m_taintparent != null) | 1361 | if (m_taintparent != null) |
1363 | { | 1362 | { |
1364 | m_taintparent.Position.Z = m_taintparent.Position.Z + 0.02f; | 1363 | Vector3 taintparentPosition = m_taintparent.Position; |
1364 | taintparentPosition.Z = m_taintparent.Position.Z + 0.02f; | ||
1365 | m_taintparent.Position = taintparentPosition; | ||
1365 | _parent_scene.AddPhysicsActorTaint(m_taintparent); | 1366 | _parent_scene.AddPhysicsActorTaint(m_taintparent); |
1366 | } | 1367 | } |
1367 | } | 1368 | } |
@@ -1382,7 +1383,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1382 | { | 1383 | { |
1383 | if (_parent == null) | 1384 | if (_parent == null) |
1384 | { | 1385 | { |
1385 | if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f, 1f, 1f), 0)) | 1386 | if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f)) |
1386 | { | 1387 | { |
1387 | //d.BodySetFiniteRotationMode(Body, 0); | 1388 | //d.BodySetFiniteRotationMode(Body, 0); |
1388 | //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); | 1389 | //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); |
@@ -1395,7 +1396,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1395 | } | 1396 | } |
1396 | 1397 | ||
1397 | } | 1398 | } |
1398 | m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z); | 1399 | m_angularlock = m_taintAngularLock; |
1399 | 1400 | ||
1400 | } | 1401 | } |
1401 | #endregion | 1402 | #endregion |
@@ -1460,17 +1461,17 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1460 | // TODO: NEED btVector3 for Linear Velocity | 1461 | // TODO: NEED btVector3 for Linear Velocity |
1461 | // NEED btVector3 for Position | 1462 | // NEED btVector3 for Position |
1462 | 1463 | ||
1463 | PhysicsVector pos = new PhysicsVector(_position.X, _position.Y, _position.Z); //TODO: Insert values gotten from bullet | 1464 | Vector3 pos = _position; //TODO: Insert values gotten from bullet |
1464 | PhysicsVector vel = new PhysicsVector(_velocity.X, _velocity.Y, _velocity.Z); | 1465 | Vector3 vel = _velocity; |
1465 | 1466 | ||
1466 | _target_velocity = | 1467 | _target_velocity = |
1467 | new PhysicsVector( | 1468 | new Vector3( |
1468 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), | 1469 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), |
1469 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), | 1470 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), |
1470 | (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) | 1471 | (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) |
1471 | ); | 1472 | ); |
1472 | 1473 | ||
1473 | if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f)) | 1474 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) |
1474 | { | 1475 | { |
1475 | 1476 | ||
1476 | /* TODO: Do Bullet equiv | 1477 | /* TODO: Do Bullet equiv |
@@ -1512,8 +1513,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1512 | { | 1513 | { |
1513 | PID_G = m_PIDTau + 1; | 1514 | PID_G = m_PIDTau + 1; |
1514 | } | 1515 | } |
1515 | PhysicsVector pos = new PhysicsVector(0, 0, 0); //TODO: Insert values gotten from bullet | 1516 | Vector3 pos = Vector3.Zero; //TODO: Insert values gotten from bullet |
1516 | PhysicsVector vel = new PhysicsVector(0, 0, 0); | 1517 | Vector3 vel = Vector3.Zero; |
1517 | 1518 | ||
1518 | // determine what our target height really is based on HoverType | 1519 | // determine what our target height really is based on HoverType |
1519 | switch (m_PIDHoverType) | 1520 | switch (m_PIDHoverType) |
@@ -1545,13 +1546,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1545 | 1546 | ||
1546 | 1547 | ||
1547 | _target_velocity = | 1548 | _target_velocity = |
1548 | new PhysicsVector(0.0f, 0.0f, | 1549 | new Vector3(0.0f, 0.0f, |
1549 | (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) | 1550 | (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) |
1550 | ); | 1551 | ); |
1551 | 1552 | ||
1552 | // if velocity is zero, use position control; otherwise, velocity control | 1553 | // if velocity is zero, use position control; otherwise, velocity control |
1553 | 1554 | ||
1554 | if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f)) | 1555 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) |
1555 | { | 1556 | { |
1556 | 1557 | ||
1557 | /* TODO: Do Bullet Equiv | 1558 | /* TODO: Do Bullet Equiv |
@@ -1626,8 +1627,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1626 | else | 1627 | else |
1627 | { | 1628 | { |
1628 | if (m_zeroPosition == null) | 1629 | if (m_zeroPosition == null) |
1629 | m_zeroPosition = new PhysicsVector(0, 0, 0); | 1630 | m_zeroPosition = Vector3.Zero; |
1630 | m_zeroPosition.setValues(_position.X, _position.Y, _position.Z); | 1631 | m_zeroPosition = _position; |
1631 | return; | 1632 | return; |
1632 | } | 1633 | } |
1633 | } | 1634 | } |
@@ -2177,7 +2178,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2177 | 2178 | ||
2178 | //if (hasTrimesh) | 2179 | //if (hasTrimesh) |
2179 | //{ | 2180 | //{ |
2180 | ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity); | 2181 | ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity); |
2181 | // createmesh returns null when it doesn't mesh. | 2182 | // createmesh returns null when it doesn't mesh. |
2182 | 2183 | ||
2183 | /* | 2184 | /* |
@@ -2197,11 +2198,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2197 | { | 2198 | { |
2198 | if (chld == null) | 2199 | if (chld == null) |
2199 | continue; | 2200 | continue; |
2200 | PhysicsVector offset = chld.Position - Position; | 2201 | Vector3 offset = chld.Position - Position; |
2201 | Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z); | 2202 | Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z); |
2202 | pos *= Quaternion.Inverse(Orientation); | 2203 | pos *= Quaternion.Inverse(Orientation); |
2203 | //pos *= Orientation; | 2204 | //pos *= Orientation; |
2204 | offset.setValues(pos.X, pos.Y, pos.Z); | 2205 | offset = pos; |
2205 | chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation); | 2206 | chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation); |
2206 | 2207 | ||
2207 | _mesh.Append(chld._mesh); | 2208 | _mesh.Append(chld._mesh); |
@@ -2433,7 +2434,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2433 | m_collisionscore = 0; | 2434 | m_collisionscore = 0; |
2434 | m_disabled = false; | 2435 | m_disabled = false; |
2435 | // The body doesn't already have a finite rotation mode set here | 2436 | // The body doesn't already have a finite rotation mode set here |
2436 | if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) | 2437 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) |
2437 | { | 2438 | { |
2438 | // TODO: Create Angular Motor on Axis Lock! | 2439 | // TODO: Create Angular Motor on Axis Lock! |
2439 | } | 2440 | } |
@@ -2447,7 +2448,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2447 | { | 2448 | { |
2448 | if (_parent == null) | 2449 | if (_parent == null) |
2449 | { | 2450 | { |
2450 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | 2451 | Vector3 pv = Vector3.Zero; |
2451 | bool lastZeroFlag = _zeroFlag; | 2452 | bool lastZeroFlag = _zeroFlag; |
2452 | if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero) | 2453 | if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero) |
2453 | tempPosition3.Dispose(); | 2454 | tempPosition3.Dispose(); |
@@ -2471,10 +2472,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2471 | tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel | 2472 | tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel |
2472 | tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel | 2473 | tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel |
2473 | 2474 | ||
2474 | _torque.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(), | 2475 | _torque = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(), |
2475 | tempAngularVelocity1.getZ()); | 2476 | tempAngularVelocity1.getZ()); |
2476 | PhysicsVector l_position = new PhysicsVector(); | 2477 | Vector3 l_position = Vector3.Zero; |
2477 | Quaternion l_orientation = new Quaternion(); | 2478 | Quaternion l_orientation = Quaternion.Identity; |
2478 | m_lastposition = _position; | 2479 | m_lastposition = _position; |
2479 | m_lastorientation = _orientation; | 2480 | m_lastorientation = _orientation; |
2480 | 2481 | ||
@@ -2598,20 +2599,18 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2598 | _velocity.Z = tempLinearVelocity1.getZ(); | 2599 | _velocity.Z = tempLinearVelocity1.getZ(); |
2599 | 2600 | ||
2600 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); | 2601 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); |
2601 | _acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, | 2602 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, |
2602 | _velocity.Y - m_lastVelocity.Y / 0.1f, | 2603 | _velocity.Y - m_lastVelocity.Y / 0.1f, |
2603 | _velocity.Z - m_lastVelocity.Z / 0.1f); | 2604 | _velocity.Z - m_lastVelocity.Z / 0.1f); |
2604 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); | 2605 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); |
2605 | 2606 | ||
2606 | if (_velocity.IsIdentical(pv, 0.5f)) | 2607 | if (_velocity.ApproxEquals(pv, 0.5f)) |
2607 | { | 2608 | { |
2608 | m_rotationalVelocity = pv; | 2609 | m_rotationalVelocity = pv; |
2609 | } | 2610 | } |
2610 | else | 2611 | else |
2611 | { | 2612 | { |
2612 | 2613 | m_rotationalVelocity = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(), tempAngularVelocity1.getZ()); | |
2613 | m_rotationalVelocity.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(), | ||
2614 | tempAngularVelocity1.getZ()); | ||
2615 | } | 2614 | } |
2616 | 2615 | ||
2617 | //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); | 2616 | //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); |
@@ -2665,7 +2664,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
2665 | m_taintremove = true; | 2664 | m_taintremove = true; |
2666 | } | 2665 | } |
2667 | 2666 | ||
2668 | internal void EnableAxisMotor(PhysicsVector axislock) | 2667 | internal void EnableAxisMotor(Vector3 axislock) |
2669 | { | 2668 | { |
2670 | if (m_aMotor != null) | 2669 | if (m_aMotor != null) |
2671 | DisableAxisMotor(); | 2670 | 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 abed8df..cbe73bb 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 | ||
@@ -1256,19 +1256,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1256 | /// </summary> | 1256 | /// </summary> |
1257 | public class BulletXCharacter : BulletXActor | 1257 | public class BulletXCharacter : BulletXActor |
1258 | { | 1258 | { |
1259 | public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos) | 1259 | public BulletXCharacter(BulletXScene parent_scene, OpenMetaverse.Vector3 pos) |
1260 | : this(String.Empty, parent_scene, pos) | 1260 | : this(String.Empty, parent_scene, pos) |
1261 | { | 1261 | { |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) | 1264 | public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos) |
1265 | : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), | 1265 | : this(avName, parent_scene, pos, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero, |
1266 | OpenMetaverse.Quaternion.Identity) | 1266 | OpenMetaverse.Quaternion.Identity) |
1267 | { | 1267 | { |
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, | 1270 | public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity, |
1271 | PhysicsVector size, PhysicsVector acceleration, OpenMetaverse.Quaternion orientation) | 1271 | OpenMetaverse.Vector3 size, OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion orientation) |
1272 | : base(avName) | 1272 | : base(avName) |
1273 | { | 1273 | { |
1274 | //This fields will be removed. They're temporal | 1274 | //This fields will be removed. They're temporal |
@@ -1323,25 +1323,25 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1323 | set { return; } | 1323 | set { return; } |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | public override PhysicsVector Position | 1326 | public override OpenMetaverse.Vector3 Position |
1327 | { | 1327 | { |
1328 | get { return base.Position; } | 1328 | get { return base.Position; } |
1329 | set { base.Position = value; } | 1329 | set { base.Position = value; } |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | public override PhysicsVector Velocity | 1332 | public override OpenMetaverse.Vector3 Velocity |
1333 | { | 1333 | { |
1334 | get { return base.Velocity; } | 1334 | get { return base.Velocity; } |
1335 | set { base.Velocity = value; } | 1335 | set { base.Velocity = value; } |
1336 | } | 1336 | } |
1337 | 1337 | ||
1338 | public override PhysicsVector Size | 1338 | public override OpenMetaverse.Vector3 Size |
1339 | { | 1339 | { |
1340 | get { return base.Size; } | 1340 | get { return base.Size; } |
1341 | set { base.Size = value; } | 1341 | set { base.Size = value; } |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | public override PhysicsVector Acceleration | 1344 | public override OpenMetaverse.Vector3 Acceleration |
1345 | { | 1345 | { |
1346 | get { return base.Acceleration; } | 1346 | get { return base.Acceleration; } |
1347 | } | 1347 | } |
@@ -1370,17 +1370,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1370 | set { base.Kinematic = value; } | 1370 | set { base.Kinematic = value; } |
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | public override void SetAcceleration(PhysicsVector accel) | 1373 | public override void SetAcceleration(OpenMetaverse.Vector3 accel) |
1374 | { | 1374 | { |
1375 | base.SetAcceleration(accel); | 1375 | base.SetAcceleration(accel); |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | public override void AddForce(PhysicsVector force, bool pushforce) | 1378 | public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce) |
1379 | { | 1379 | { |
1380 | base.AddForce(force, pushforce); | 1380 | base.AddForce(force, pushforce); |
1381 | } | 1381 | } |
1382 | 1382 | ||
1383 | public override void SetMomentum(PhysicsVector momentum) | 1383 | public override void SetMomentum(OpenMetaverse.Vector3 momentum) |
1384 | { | 1384 | { |
1385 | base.SetMomentum(momentum); | 1385 | base.SetMomentum(momentum); |
1386 | } | 1386 | } |
@@ -1430,7 +1430,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1430 | m.Translation = v3; | 1430 | m.Translation = v3; |
1431 | rigidBody.WorldTransform = m; | 1431 | rigidBody.WorldTransform = m; |
1432 | //When an Avie touch the ground it's vertical velocity it's reduced to ZERO | 1432 | //When an Avie touch the ground it's vertical velocity it's reduced to ZERO |
1433 | Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); | 1433 | Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); |
1434 | } | 1434 | } |
1435 | } | 1435 | } |
1436 | 1436 | ||
@@ -1452,7 +1452,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1452 | //For now all prims have the same density, all prims are made of water. Be water my friend! :D | 1452 | //For now all prims have the same density, all prims are made of water. Be water my friend! :D |
1453 | private const float _density = 1000.0f; | 1453 | private const float _density = 1000.0f; |
1454 | private BulletXScene _parent_scene; | 1454 | private BulletXScene _parent_scene; |
1455 | private PhysicsVector m_prev_position = new PhysicsVector(0, 0, 0); | 1455 | private OpenMetaverse.Vector3 m_prev_position; |
1456 | private bool m_lastUpdateSent = false; | 1456 | private bool m_lastUpdateSent = false; |
1457 | //added by jed zhu | 1457 | //added by jed zhu |
1458 | private IMesh _mesh; | 1458 | private IMesh _mesh; |
@@ -1460,17 +1460,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1460 | 1460 | ||
1461 | 1461 | ||
1462 | 1462 | ||
1463 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, | 1463 | public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 size, |
1464 | OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) | 1464 | OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) |
1465 | : this( | 1465 | : this( |
1466 | primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs, | 1466 | primName, parent_scene, pos, OpenMetaverse.Vector3.Zero, size, OpenMetaverse.Vector3.Zero, rotation, mesh, pbs, |
1467 | isPhysical) | 1467 | isPhysical) |
1468 | { | 1468 | { |
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, | 1471 | public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity, |
1472 | PhysicsVector size, | 1472 | OpenMetaverse.Vector3 size, |
1473 | PhysicsVector acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, | 1473 | OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, |
1474 | bool isPhysical) | 1474 | bool isPhysical) |
1475 | : base(primName) | 1475 | : base(primName) |
1476 | { | 1476 | { |
@@ -1481,7 +1481,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1481 | 1481 | ||
1482 | _position = pos; | 1482 | _position = pos; |
1483 | _physical = isPhysical; | 1483 | _physical = isPhysical; |
1484 | _velocity = _physical ? velocity : new PhysicsVector(); | 1484 | _velocity = _physical ? velocity : OpenMetaverse.Vector3.Zero; |
1485 | _size = size; | 1485 | _size = size; |
1486 | _acceleration = acceleration; | 1486 | _acceleration = acceleration; |
1487 | _orientation = rotation; | 1487 | _orientation = rotation; |
@@ -1497,19 +1497,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1497 | set { return; } | 1497 | set { return; } |
1498 | } | 1498 | } |
1499 | 1499 | ||
1500 | public override PhysicsVector Position | 1500 | public override OpenMetaverse.Vector3 Position |
1501 | { | 1501 | { |
1502 | get { return base.Position; } | 1502 | get { return base.Position; } |
1503 | set { base.Position = value; } | 1503 | set { base.Position = value; } |
1504 | } | 1504 | } |
1505 | 1505 | ||
1506 | public override PhysicsVector Velocity | 1506 | public override OpenMetaverse.Vector3 Velocity |
1507 | { | 1507 | { |
1508 | get { return base.Velocity; } | 1508 | get { return base.Velocity; } |
1509 | set { base.Velocity = value; } | 1509 | set { base.Velocity = value; } |
1510 | } | 1510 | } |
1511 | 1511 | ||
1512 | public override PhysicsVector Size | 1512 | public override OpenMetaverse.Vector3 Size |
1513 | { | 1513 | { |
1514 | get { return _size; } | 1514 | get { return _size; } |
1515 | set | 1515 | set |
@@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1522 | } | 1522 | } |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | public override PhysicsVector Acceleration | 1525 | public override OpenMetaverse.Vector3 Acceleration |
1526 | { | 1526 | { |
1527 | get { return base.Acceleration; } | 1527 | get { return base.Acceleration; } |
1528 | } | 1528 | } |
@@ -1583,7 +1583,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1583 | set { base.Kinematic = value; } | 1583 | set { base.Kinematic = value; } |
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | public override void SetAcceleration(PhysicsVector accel) | 1586 | public override void SetAcceleration(OpenMetaverse.Vector3 accel) |
1587 | { | 1587 | { |
1588 | lock (BulletXScene.BulletXLock) | 1588 | lock (BulletXScene.BulletXLock) |
1589 | { | 1589 | { |
@@ -1591,12 +1591,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1591 | } | 1591 | } |
1592 | } | 1592 | } |
1593 | 1593 | ||
1594 | public override void AddForce(PhysicsVector force, bool pushforce) | 1594 | public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce) |
1595 | { | 1595 | { |
1596 | base.AddForce(force,pushforce); | 1596 | base.AddForce(force,pushforce); |
1597 | } | 1597 | } |
1598 | 1598 | ||
1599 | public override void SetMomentum(PhysicsVector momentum) | 1599 | public override void SetMomentum(OpenMetaverse.Vector3 momentum) |
1600 | { | 1600 | { |
1601 | base.SetMomentum(momentum); | 1601 | base.SetMomentum(momentum); |
1602 | } | 1602 | } |
@@ -1613,7 +1613,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1613 | //When a Prim touch the ground it's vertical velocity it's reduced to ZERO | 1613 | //When a Prim touch the ground it's vertical velocity it's reduced to ZERO |
1614 | //Static objects don't have linear velocity | 1614 | //Static objects don't have linear velocity |
1615 | if (_physical) | 1615 | if (_physical) |
1616 | Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); | 1616 | Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); |
1617 | } | 1617 | } |
1618 | } | 1618 | } |
1619 | 1619 | ||
@@ -1632,7 +1632,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1632 | { | 1632 | { |
1633 | if (!m_lastUpdateSent) | 1633 | if (!m_lastUpdateSent) |
1634 | { | 1634 | { |
1635 | _velocity = new PhysicsVector(0, 0, 0); | 1635 | _velocity = OpenMetaverse.Vector3.Zero; |
1636 | base.ScheduleTerseUpdate(); | 1636 | base.ScheduleTerseUpdate(); |
1637 | m_lastUpdateSent = true; | 1637 | m_lastUpdateSent = true; |
1638 | } | 1638 | } |
@@ -1654,8 +1654,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1654 | 1654 | ||
1655 | #region Methods for updating values of RigidBody | 1655 | #region Methods for updating values of RigidBody |
1656 | 1656 | ||
1657 | protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, PhysicsVector pos, | 1657 | protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, OpenMetaverse.Vector3 pos, |
1658 | PhysicsVector size) | 1658 | OpenMetaverse.Vector3 size) |
1659 | { | 1659 | { |
1660 | //For RigidBody Constructor. The next values might change | 1660 | //For RigidBody Constructor. The next values might change |
1661 | float _linearDamping = 0.0f; | 1661 | float _linearDamping = 0.0f; |
@@ -1683,7 +1683,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1683 | Vector3[] v3Vertices = new Vector3[iVertexCount]; | 1683 | Vector3[] v3Vertices = new Vector3[iVertexCount]; |
1684 | for (int i = 0; i < iVertexCount; i++) | 1684 | for (int i = 0; i < iVertexCount; i++) |
1685 | { | 1685 | { |
1686 | PhysicsVector v = mesh.getVertexList()[i]; | 1686 | OpenMetaverse.Vector3 v = mesh.getVertexList()[i]; |
1687 | if (v != null) // Note, null has special meaning. See meshing code for details | 1687 | if (v != null) // Note, null has special meaning. See meshing code for details |
1688 | v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); | 1688 | v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); |
1689 | else | 1689 | else |
@@ -1709,7 +1709,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1709 | } | 1709 | } |
1710 | } | 1710 | } |
1711 | 1711 | ||
1712 | protected internal void ReCreateRigidBody(PhysicsVector size) | 1712 | protected internal void ReCreateRigidBody(OpenMetaverse.Vector3 size) |
1713 | { | 1713 | { |
1714 | //There is a bug when trying to remove a rigidBody that is colliding with something.. | 1714 | //There is a bug when trying to remove a rigidBody that is colliding with something.. |
1715 | try | 1715 | try |
@@ -1729,7 +1729,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1729 | GC.Collect(); | 1729 | GC.Collect(); |
1730 | } | 1730 | } |
1731 | 1731 | ||
1732 | protected internal override void ReSize(PhysicsVector _newSize) | 1732 | protected internal override void ReSize(OpenMetaverse.Vector3 _newSize) |
1733 | { | 1733 | { |
1734 | //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't | 1734 | //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't |
1735 | //so i have to do it manually. That's recreating rigidbody | 1735 | //so i have to do it manually. That's recreating rigidbody |
@@ -1744,8 +1744,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1744 | /// </summary> | 1744 | /// </summary> |
1745 | internal class BulletXPlanet | 1745 | internal class BulletXPlanet |
1746 | { | 1746 | { |
1747 | private PhysicsVector _staticPosition; | 1747 | private OpenMetaverse.Vector3 _staticPosition; |
1748 | // private PhysicsVector _staticVelocity; | 1748 | // private Vector3 _staticVelocity; |
1749 | // private OpenMetaverse.Quaternion _staticOrientation; | 1749 | // private OpenMetaverse.Quaternion _staticOrientation; |
1750 | private float _mass; | 1750 | private float _mass; |
1751 | // private BulletXScene _parentscene; | 1751 | // private BulletXScene _parentscene; |
@@ -1759,7 +1759,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1759 | 1759 | ||
1760 | internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) | 1760 | internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) |
1761 | { | 1761 | { |
1762 | _staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0); | 1762 | _staticPosition = new OpenMetaverse.Vector3(BulletXScene.MaxXY / 2, BulletXScene.MaxXY / 2, 0); |
1763 | // _staticVelocity = new PhysicsVector(); | 1763 | // _staticVelocity = new PhysicsVector(); |
1764 | // _staticOrientation = OpenMetaverse.Quaternion.Identity; | 1764 | // _staticOrientation = OpenMetaverse.Quaternion.Identity; |
1765 | _mass = 0; //No active | 1765 | _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 7603131..6bfdff2 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 | ||
@@ -231,9 +231,9 @@ namespace OpenSim.Region.Physics.Manager | |||
231 | public abstract float PIDHoverTau { set;} | 231 | public abstract float PIDHoverTau { set;} |
232 | 232 | ||
233 | 233 | ||
234 | public abstract void AddForce(PhysicsVector force, bool pushforce); | 234 | public abstract void AddForce(Vector3 force, bool pushforce); |
235 | public abstract void AddAngularForce(PhysicsVector force, bool pushforce); | 235 | public abstract void AddAngularForce(Vector3 force, bool pushforce); |
236 | public abstract void SetMomentum(PhysicsVector momentum); | 236 | public abstract void SetMomentum(Vector3 momentum); |
237 | public abstract void SubscribeEvents(int ms); | 237 | public abstract void SubscribeEvents(int ms); |
238 | public abstract void UnSubscribeEvents(); | 238 | public abstract void UnSubscribeEvents(); |
239 | public abstract bool SubscribedEvents(); | 239 | public abstract bool SubscribedEvents(); |
@@ -246,9 +246,9 @@ namespace OpenSim.Region.Physics.Manager | |||
246 | get{ return false; } | 246 | get{ return false; } |
247 | } | 247 | } |
248 | 248 | ||
249 | public override PhysicsVector Position | 249 | public override Vector3 Position |
250 | { | 250 | { |
251 | get { return PhysicsVector.Zero; } | 251 | get { return Vector3.Zero; } |
252 | set { return; } | 252 | set { return; } |
253 | } | 253 | } |
254 | 254 | ||
@@ -296,9 +296,9 @@ namespace OpenSim.Region.Physics.Manager | |||
296 | set { return; } | 296 | set { return; } |
297 | } | 297 | } |
298 | 298 | ||
299 | public override PhysicsVector Size | 299 | public override Vector3 Size |
300 | { | 300 | { |
301 | get { return PhysicsVector.Zero; } | 301 | get { return Vector3.Zero; } |
302 | set { return; } | 302 | set { return; } |
303 | } | 303 | } |
304 | 304 | ||
@@ -307,9 +307,9 @@ namespace OpenSim.Region.Physics.Manager | |||
307 | get { return 0f; } | 307 | get { return 0f; } |
308 | } | 308 | } |
309 | 309 | ||
310 | public override PhysicsVector Force | 310 | public override Vector3 Force |
311 | { | 311 | { |
312 | get { return PhysicsVector.Zero; } | 312 | get { return Vector3.Zero; } |
313 | set { return; } | 313 | set { return; } |
314 | } | 314 | } |
315 | 315 | ||
@@ -324,7 +324,7 @@ namespace OpenSim.Region.Physics.Manager | |||
324 | 324 | ||
325 | } | 325 | } |
326 | 326 | ||
327 | public override void VehicleVectorParam(int param, PhysicsVector value) | 327 | public override void VehicleVectorParam(int param, Vector3 value) |
328 | { | 328 | { |
329 | 329 | ||
330 | } | 330 | } |
@@ -344,14 +344,14 @@ namespace OpenSim.Region.Physics.Manager | |||
344 | 344 | ||
345 | } | 345 | } |
346 | 346 | ||
347 | public override PhysicsVector CenterOfMass | 347 | public override Vector3 CenterOfMass |
348 | { | 348 | { |
349 | get { return PhysicsVector.Zero; } | 349 | get { return Vector3.Zero; } |
350 | } | 350 | } |
351 | 351 | ||
352 | public override PhysicsVector GeometricCenter | 352 | public override Vector3 GeometricCenter |
353 | { | 353 | { |
354 | get { return PhysicsVector.Zero; } | 354 | get { return Vector3.Zero; } |
355 | } | 355 | } |
356 | 356 | ||
357 | public override PrimitiveBaseShape Shape | 357 | public override PrimitiveBaseShape Shape |
@@ -359,15 +359,15 @@ namespace OpenSim.Region.Physics.Manager | |||
359 | set { return; } | 359 | set { return; } |
360 | } | 360 | } |
361 | 361 | ||
362 | public override PhysicsVector Velocity | 362 | public override Vector3 Velocity |
363 | { | 363 | { |
364 | get { return PhysicsVector.Zero; } | 364 | get { return Vector3.Zero; } |
365 | set { return; } | 365 | set { return; } |
366 | } | 366 | } |
367 | 367 | ||
368 | public override PhysicsVector Torque | 368 | public override Vector3 Torque |
369 | { | 369 | { |
370 | get { return PhysicsVector.Zero; } | 370 | get { return Vector3.Zero; } |
371 | set { return; } | 371 | set { return; } |
372 | } | 372 | } |
373 | 373 | ||
@@ -387,9 +387,9 @@ namespace OpenSim.Region.Physics.Manager | |||
387 | set { } | 387 | set { } |
388 | } | 388 | } |
389 | 389 | ||
390 | public override PhysicsVector Acceleration | 390 | public override Vector3 Acceleration |
391 | { | 391 | { |
392 | get { return PhysicsVector.Zero; } | 392 | get { return Vector3.Zero; } |
393 | } | 393 | } |
394 | 394 | ||
395 | public override bool IsPhysical | 395 | public override bool IsPhysical |
@@ -436,26 +436,26 @@ namespace OpenSim.Region.Physics.Manager | |||
436 | { | 436 | { |
437 | } | 437 | } |
438 | 438 | ||
439 | public override void LockAngularMotion(PhysicsVector axis) | 439 | public override void LockAngularMotion(Vector3 axis) |
440 | { | 440 | { |
441 | } | 441 | } |
442 | 442 | ||
443 | public override void AddForce(PhysicsVector force, bool pushforce) | 443 | public override void AddForce(Vector3 force, bool pushforce) |
444 | { | 444 | { |
445 | } | 445 | } |
446 | 446 | ||
447 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 447 | public override void AddAngularForce(Vector3 force, bool pushforce) |
448 | { | 448 | { |
449 | 449 | ||
450 | } | 450 | } |
451 | 451 | ||
452 | public override PhysicsVector RotationalVelocity | 452 | public override Vector3 RotationalVelocity |
453 | { | 453 | { |
454 | get { return PhysicsVector.Zero; } | 454 | get { return Vector3.Zero; } |
455 | set { return; } | 455 | set { return; } |
456 | } | 456 | } |
457 | 457 | ||
458 | public override PhysicsVector PIDTarget { set { return; } } | 458 | public override Vector3 PIDTarget { set { return; } } |
459 | public override bool PIDActive { set { return; } } | 459 | public override bool PIDActive { set { return; } } |
460 | public override float PIDTau { set { return; } } | 460 | public override float PIDTau { set { return; } } |
461 | 461 | ||
@@ -464,7 +464,7 @@ namespace OpenSim.Region.Physics.Manager | |||
464 | public override PIDHoverType PIDHoverType { set { return; } } | 464 | public override PIDHoverType PIDHoverType { set { return; } } |
465 | public override float PIDHoverTau { set { return; } } | 465 | public override float PIDHoverTau { set { return; } } |
466 | 466 | ||
467 | public override void SetMomentum(PhysicsVector momentum) | 467 | public override void SetMomentum(Vector3 momentum) |
468 | { | 468 | { |
469 | } | 469 | } |
470 | 470 | ||
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 71ace16..c86bc62 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 | ||
@@ -1311,7 +1302,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1311 | d.GeomDestroy(Shell); | 1302 | d.GeomDestroy(Shell); |
1312 | AvatarGeomAndBodyCreation(_position.X, _position.Y, | 1303 | AvatarGeomAndBodyCreation(_position.X, _position.Y, |
1313 | _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); | 1304 | _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); |
1314 | Velocity = new PhysicsVector(0f, 0f, 0f); | 1305 | Velocity = Vector3.Zero; |
1315 | 1306 | ||
1316 | _parent_scene.geom_name_map[Shell] = m_name; | 1307 | _parent_scene.geom_name_map[Shell] = m_name; |
1317 | _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; | 1308 | _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; |
@@ -1325,7 +1316,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1325 | } | 1316 | } |
1326 | } | 1317 | } |
1327 | 1318 | ||
1328 | if (!m_taintPosition.IsIdentical(_position, 0.05f)) | 1319 | if (!m_taintPosition.ApproxEquals(_position, 0.05f)) |
1329 | { | 1320 | { |
1330 | if (Body != IntPtr.Zero) | 1321 | if (Body != IntPtr.Zero) |
1331 | { | 1322 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs index 467eba0..4a802cd 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs | |||
@@ -1,16 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
3 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
4 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
5 | * characteristics and Kinetic motion. | ||
6 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
7 | * (dynamics) and the associated settings. Old Linear and angular | ||
8 | * motors for dynamic motion have been replace with MoveLinear() | ||
9 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
10 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
11 | * switch between 'VEHICLE' parameter use and general dynamics | ||
12 | * settings use. | ||
13 | * | ||
14 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
15 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
16 | * | 4 | * |
@@ -37,6 +25,19 @@ | |||
37 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
38 | */ | 26 | */ |
39 | 27 | ||
28 | /* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
29 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
30 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
31 | * characteristics and Kinetic motion. | ||
32 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
33 | * (dynamics) and the associated settings. Old Linear and angular | ||
34 | * motors for dynamic motion have been replace with MoveLinear() | ||
35 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
36 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
37 | * switch between 'VEHICLE' parameter use and general dynamics | ||
38 | * settings use. | ||
39 | */ | ||
40 | |||
40 | using System; | 41 | using System; |
41 | using System.Collections.Generic; | 42 | using System.Collections.Generic; |
42 | using System.Reflection; | 43 | using System.Reflection; |
@@ -231,7 +232,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
231 | 232 | ||
232 | }//end ProcessFloatVehicleParam | 233 | }//end ProcessFloatVehicleParam |
233 | 234 | ||
234 | internal void ProcessVectorVehicleParam(Vehicle pParam, PhysicsVector pValue) | 235 | internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue) |
235 | { | 236 | { |
236 | switch (pParam) | 237 | switch (pParam) |
237 | { | 238 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index f59f0ae..5ff9d32 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -1,18 +1,5 @@ | |||
1 | /* | 1 | /* Copyright (c) Contributors, http://opensimulator.org/ |
2 | * Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
3 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
4 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
5 | * characteristics and Kinetic motion. | ||
6 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
7 | * (dynamics) and the associated settings. Old Linear and angular | ||
8 | * motors for dynamic motion have been replace with MoveLinear() | ||
9 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
10 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
11 | * switch between 'VEHICLE' parameter use and general dynamics | ||
12 | * settings use. | ||
13 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
14 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 2 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
15 | * | ||
16 | * Redistribution and use in source and binary forms, with or without | 3 | * Redistribution and use in source and binary forms, with or without |
17 | * modification, are permitted provided that the following conditions are met: | 4 | * modification, are permitted provided that the following conditions are met: |
18 | * * Redistributions of source code must retain the above copyright | 5 | * * Redistributions of source code must retain the above copyright |
@@ -35,6 +22,20 @@ | |||
35 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
37 | */ | 24 | */ |
25 | |||
26 | /* | ||
27 | * Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
28 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
29 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
30 | * characteristics and Kinetic motion. | ||
31 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
32 | * (dynamics) and the associated settings. Old Linear and angular | ||
33 | * motors for dynamic motion have been replace with MoveLinear() | ||
34 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
35 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
36 | * switch between 'VEHICLE' parameter use and general dynamics | ||
37 | * settings use. | ||
38 | */ | ||
38 | using System; | 39 | using System; |
39 | using System.Collections.Generic; | 40 | using System.Collections.Generic; |
40 | using System.Reflection; | 41 | using System.Reflection; |
@@ -56,44 +57,43 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
56 | { | 57 | { |
57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
58 | 59 | ||
59 | private PhysicsVector _position; | 60 | private Vector3 _position; |
60 | private PhysicsVector _velocity; | 61 | private Vector3 _velocity; |
61 | private PhysicsVector _torque = new PhysicsVector(0,0,0); | 62 | private Vector3 _torque; |
62 | private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); | 63 | private Vector3 m_lastVelocity; |
63 | private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f); | 64 | private Vector3 m_lastposition; |
64 | private Quaternion m_lastorientation = new Quaternion(); | 65 | private Quaternion m_lastorientation = new Quaternion(); |
65 | private PhysicsVector m_rotationalVelocity; | 66 | private Vector3 m_rotationalVelocity; |
66 | private PhysicsVector _size; | 67 | private Vector3 _size; |
67 | private PhysicsVector _acceleration; | 68 | private Vector3 _acceleration; |
68 | // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); | 69 | // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); |
69 | private Quaternion _orientation; | 70 | private Quaternion _orientation; |
70 | private PhysicsVector m_taintposition; | 71 | private Vector3 m_taintposition; |
71 | private PhysicsVector m_taintsize; | 72 | private Vector3 m_taintsize; |
72 | private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0); | 73 | private Vector3 m_taintVelocity; |
73 | private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0); | 74 | private Vector3 m_taintTorque; |
74 | private Quaternion m_taintrot; | 75 | private Quaternion m_taintrot; |
75 | private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f); | 76 | private Vector3 m_angularlock = Vector3.One; |
76 | private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f); | 77 | private Vector3 m_taintAngularLock = Vector3.One; |
77 | private IntPtr Amotor = IntPtr.Zero; | 78 | private IntPtr Amotor = IntPtr.Zero; |
78 | 79 | ||
79 | private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0); | 80 | private Vector3 m_PIDTarget; |
80 | // private PhysicsVector m_taintPIDTarget = new PhysicsVector(0, 0, 0); | 81 | private float m_PIDTau; |
81 | private float m_PIDTau = 0f; | ||
82 | private float PID_D = 35f; | 82 | private float PID_D = 35f; |
83 | private float PID_G = 25f; | 83 | private float PID_G = 25f; |
84 | private bool m_usePID = false; | 84 | private bool m_usePID; |
85 | 85 | ||
86 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), | 86 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), |
87 | // and are for non-VEHICLES only. | 87 | // and are for non-VEHICLES only. |
88 | 88 | ||
89 | private float m_PIDHoverHeight = 0f; | 89 | private float m_PIDHoverHeight; |
90 | private float m_PIDHoverTau = 0f; | 90 | private float m_PIDHoverTau; |
91 | private bool m_useHoverPID = false; | 91 | private bool m_useHoverPID; |
92 | private PIDHoverType m_PIDHoverType = PIDHoverType.Ground; | 92 | private PIDHoverType m_PIDHoverType = PIDHoverType.Ground; |
93 | private float m_targetHoverHeight = 0f; | 93 | private float m_targetHoverHeight; |
94 | private float m_groundHeight = 0f; | 94 | private float m_groundHeight; |
95 | private float m_waterHeight = 0f; | 95 | private float m_waterHeight; |
96 | private float m_buoyancy = 0f; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 96 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. |
97 | 97 | ||
98 | // private float m_tensor = 5f; | 98 | // private float m_tensor = 5f; |
99 | private int body_autodisable_frames = 20; | 99 | private int body_autodisable_frames = 20; |
@@ -104,11 +104,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
104 | | CollisionCategories.Body | 104 | | CollisionCategories.Body |
105 | | CollisionCategories.Character | 105 | | CollisionCategories.Character |
106 | ); | 106 | ); |
107 | private bool m_taintshape = false; | 107 | private bool m_taintshape; |
108 | private bool m_taintPhysics = false; | 108 | private bool m_taintPhysics; |
109 | private bool m_collidesLand = true; | 109 | private bool m_collidesLand = true; |
110 | private bool m_collidesWater = false; | 110 | private bool m_collidesWater; |
111 | public bool m_returnCollisions = false; | 111 | public bool m_returnCollisions; |
112 | 112 | ||
113 | // Default we're a Geometry | 113 | // Default we're a Geometry |
114 | private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); | 114 | private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); |
@@ -116,85 +116,83 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
116 | // Default, Collide with Other Geometries, spaces and Bodies | 116 | // Default, Collide with Other Geometries, spaces and Bodies |
117 | private CollisionCategories m_collisionFlags = m_default_collisionFlags; | 117 | private CollisionCategories m_collisionFlags = m_default_collisionFlags; |
118 | 118 | ||
119 | public bool m_taintremove = false; | 119 | public bool m_taintremove; |
120 | public bool m_taintdisable = false; | 120 | public bool m_taintdisable; |
121 | public bool m_disabled = false; | 121 | public bool m_disabled; |
122 | public bool m_taintadd = false; | 122 | public bool m_taintadd; |
123 | public bool m_taintselected = false; | 123 | public bool m_taintselected; |
124 | public bool m_taintCollidesWater = false; | 124 | public bool m_taintCollidesWater; |
125 | 125 | ||
126 | public uint m_localID = 0; | 126 | public uint m_localID; |
127 | 127 | ||
128 | //public GCHandle gc; | 128 | //public GCHandle gc; |
129 | private CollisionLocker ode; | 129 | private CollisionLocker ode; |
130 | 130 | ||
131 | private bool m_taintforce = false; | 131 | private bool m_taintforce = false; |
132 | private bool m_taintaddangularforce = false; | 132 | private bool m_taintaddangularforce = false; |
133 | private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); | 133 | private Vector3 m_force; |
134 | private List<PhysicsVector> m_forcelist = new List<PhysicsVector>(); | 134 | private List<Vector3> m_forcelist = new List<Vector3>(); |
135 | private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>(); | 135 | private List<Vector3> m_angularforcelist = new List<Vector3>(); |
136 | 136 | ||
137 | private IMesh _mesh; | 137 | private IMesh _mesh; |
138 | private PrimitiveBaseShape _pbs; | 138 | private PrimitiveBaseShape _pbs; |
139 | private OdeScene _parent_scene; | 139 | private OdeScene _parent_scene; |
140 | public IntPtr m_targetSpace = (IntPtr) 0; | 140 | public IntPtr m_targetSpace = IntPtr.Zero; |
141 | public IntPtr prim_geom; | 141 | public IntPtr prim_geom; |
142 | public IntPtr prev_geom; | 142 | public IntPtr prev_geom; |
143 | public IntPtr _triMeshData; | 143 | public IntPtr _triMeshData; |
144 | 144 | ||
145 | private IntPtr _linkJointGroup = (IntPtr)0; | 145 | private IntPtr _linkJointGroup = IntPtr.Zero; |
146 | private PhysicsActor _parent = null; | 146 | private PhysicsActor _parent; |
147 | private PhysicsActor m_taintparent = null; | 147 | private PhysicsActor m_taintparent; |
148 | 148 | ||
149 | private List<OdePrim> childrenPrim = new List<OdePrim>(); | 149 | private List<OdePrim> childrenPrim = new List<OdePrim>(); |
150 | 150 | ||
151 | private bool iscolliding = false; | 151 | private bool iscolliding; |
152 | private bool m_isphysical = false; | 152 | private bool m_isphysical; |
153 | private bool m_isSelected = false; | 153 | private bool m_isSelected; |
154 | 154 | ||
155 | internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively | 155 | internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively |
156 | 156 | ||
157 | private bool m_throttleUpdates = false; | 157 | private bool m_throttleUpdates; |
158 | private int throttleCounter = 0; | 158 | private int throttleCounter; |
159 | public int m_interpenetrationcount = 0; | 159 | public int m_interpenetrationcount; |
160 | public float m_collisionscore = 0; | 160 | public float m_collisionscore; |
161 | public int m_roundsUnderMotionThreshold = 0; | 161 | public int m_roundsUnderMotionThreshold; |
162 | private int m_crossingfailures = 0; | 162 | private int m_crossingfailures; |
163 | 163 | ||
164 | public bool outofBounds = false; | 164 | public bool outofBounds; |
165 | private float m_density = 10.000006836f; // Aluminum g/cm3; | 165 | private float m_density = 10.000006836f; // Aluminum g/cm3; |
166 | 166 | ||
167 | public bool _zeroFlag = false; | 167 | public bool _zeroFlag; |
168 | private bool m_lastUpdateSent = false; | 168 | private bool m_lastUpdateSent; |
169 | 169 | ||
170 | public IntPtr Body = (IntPtr) 0; | 170 | public IntPtr Body = IntPtr.Zero; |
171 | public String m_primName; | 171 | public String m_primName; |
172 | // private String m_primName; | 172 | private Vector3 _target_velocity; |
173 | private PhysicsVector _target_velocity; | ||
174 | public d.Mass pMass; | 173 | public d.Mass pMass; |
175 | 174 | ||
176 | public int m_eventsubscription = 0; | 175 | public int m_eventsubscription; |
177 | private CollisionEventUpdate CollisionEventsThisFrame = null; | 176 | private CollisionEventUpdate CollisionEventsThisFrame; |
178 | 177 | ||
179 | private IntPtr m_linkJoint = (IntPtr)0; | 178 | private IntPtr m_linkJoint = IntPtr.Zero; |
180 | 179 | ||
181 | public volatile bool childPrim = false; | 180 | public volatile bool childPrim; |
182 | 181 | ||
183 | private ODEDynamics m_vehicle; | 182 | private ODEDynamics m_vehicle; |
184 | 183 | ||
185 | internal int m_material = (int)Material.Wood; | 184 | internal int m_material = (int)Material.Wood; |
186 | 185 | ||
187 | public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, | 186 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, |
188 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) | 187 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) |
189 | { | 188 | { |
190 | _target_velocity = new PhysicsVector(0, 0, 0); | ||
191 | m_vehicle = new ODEDynamics(); | 189 | m_vehicle = new ODEDynamics(); |
192 | //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned); | 190 | //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned); |
193 | ode = dode; | 191 | ode = dode; |
194 | _velocity = new PhysicsVector(); | 192 | if (!pos.IsFinite()) |
195 | if (!PhysicsVector.isFinite(pos)) | ||
196 | { | 193 | { |
197 | 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); | 194 | pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), |
195 | parent_scene.GetTerrainHeightAtXY(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f)) + 0.5f); | ||
198 | m_log.Warn("[PHYSICS]: Got nonFinite Object create Position"); | 196 | m_log.Warn("[PHYSICS]: Got nonFinite Object create Position"); |
199 | } | 197 | } |
200 | _position = pos; | 198 | _position = pos; |
@@ -209,9 +207,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
209 | prim_geom = IntPtr.Zero; | 207 | prim_geom = IntPtr.Zero; |
210 | prev_geom = IntPtr.Zero; | 208 | prev_geom = IntPtr.Zero; |
211 | 209 | ||
212 | if (!PhysicsVector.isFinite(pos)) | 210 | if (!pos.IsFinite()) |
213 | { | 211 | { |
214 | size = new PhysicsVector(0.5f, 0.5f, 0.5f); | 212 | size = new Vector3(0.5f, 0.5f, 0.5f); |
215 | m_log.Warn("[PHYSICS]: Got nonFinite Object create Size"); | 213 | m_log.Warn("[PHYSICS]: Got nonFinite Object create Size"); |
216 | } | 214 | } |
217 | 215 | ||
@@ -221,8 +219,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
221 | 219 | ||
222 | _size = size; | 220 | _size = size; |
223 | m_taintsize = _size; | 221 | m_taintsize = _size; |
224 | _acceleration = new PhysicsVector(); | ||
225 | m_rotationalVelocity = PhysicsVector.Zero; | ||
226 | 222 | ||
227 | if (!QuaternionIsFinite(rotation)) | 223 | if (!QuaternionIsFinite(rotation)) |
228 | { | 224 | { |
@@ -387,7 +383,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
387 | m_disabled = false; | 383 | m_disabled = false; |
388 | 384 | ||
389 | // The body doesn't already have a finite rotation mode set here | 385 | // The body doesn't already have a finite rotation mode set here |
390 | if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) | 386 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0.0f)) && _parent == null) |
391 | { | 387 | { |
392 | createAMotor(m_angularlock); | 388 | createAMotor(m_angularlock); |
393 | } | 389 | } |
@@ -800,6 +796,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
800 | m_collisionscore = 0; | 796 | m_collisionscore = 0; |
801 | } | 797 | } |
802 | 798 | ||
799 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); | ||
800 | |||
803 | public void setMesh(OdeScene parent_scene, IMesh mesh) | 801 | public void setMesh(OdeScene parent_scene, IMesh mesh) |
804 | { | 802 | { |
805 | // This sleeper is there to moderate how long it takes between | 803 | // This sleeper is there to moderate how long it takes between |
@@ -831,19 +829,24 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
831 | mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage | 829 | mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage |
832 | 830 | ||
833 | mesh.releaseSourceMeshData(); // free up the original mesh data to save memory | 831 | mesh.releaseSourceMeshData(); // free up the original mesh data to save memory |
832 | if (m_MeshToTriMeshMap.ContainsKey(mesh)) | ||
833 | { | ||
834 | _triMeshData = m_MeshToTriMeshMap[mesh]; | ||
835 | } | ||
836 | else | ||
837 | { | ||
838 | _triMeshData = d.GeomTriMeshDataCreate(); | ||
834 | 839 | ||
835 | _triMeshData = d.GeomTriMeshDataCreate(); | 840 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); |
836 | 841 | d.GeomTriMeshDataPreprocess(_triMeshData); | |
837 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); | 842 | m_MeshToTriMeshMap[mesh] = _triMeshData; |
838 | d.GeomTriMeshDataPreprocess(_triMeshData); | 843 | } |
839 | 844 | ||
840 | _parent_scene.waitForSpaceUnlock(m_targetSpace); | 845 | _parent_scene.waitForSpaceUnlock(m_targetSpace); |
841 | |||
842 | try | 846 | try |
843 | { | 847 | { |
844 | if (prim_geom == IntPtr.Zero) | 848 | if (prim_geom == IntPtr.Zero) |
845 | { | 849 | { |
846 | //Console.WriteLine(" setMesh 1"); | ||
847 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); | 850 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); |
848 | } | 851 | } |
849 | } | 852 | } |
@@ -853,6 +856,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
853 | return; | 856 | return; |
854 | } | 857 | } |
855 | 858 | ||
859 | |||
856 | // if (IsPhysical && Body == (IntPtr) 0) | 860 | // if (IsPhysical && Body == (IntPtr) 0) |
857 | // { | 861 | // { |
858 | // Recreate the body | 862 | // Recreate the body |
@@ -873,7 +877,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
873 | 877 | ||
874 | if (prim_geom != IntPtr.Zero) | 878 | if (prim_geom != IntPtr.Zero) |
875 | { | 879 | { |
876 | if (!_position.IsIdentical(m_taintposition,0f)) | 880 | if (!_position.ApproxEquals(m_taintposition, 0f)) |
877 | changemove(timestep); | 881 | changemove(timestep); |
878 | 882 | ||
879 | if (m_taintrot != _orientation) | 883 | if (m_taintrot != _orientation) |
@@ -898,7 +902,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
898 | changePhysicsStatus(timestep); | 902 | changePhysicsStatus(timestep); |
899 | // | 903 | // |
900 | 904 | ||
901 | if (!_size.IsIdentical(m_taintsize,0)) | 905 | if (!_size.ApproxEquals(m_taintsize,0f)) |
902 | changesize(timestep); | 906 | changesize(timestep); |
903 | // | 907 | // |
904 | 908 | ||
@@ -912,7 +916,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
912 | if (m_taintaddangularforce) | 916 | if (m_taintaddangularforce) |
913 | changeAddAngularForce(timestep); | 917 | changeAddAngularForce(timestep); |
914 | 918 | ||
915 | if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f)) | 919 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) |
916 | changeSetTorque(timestep); | 920 | changeSetTorque(timestep); |
917 | 921 | ||
918 | if (m_taintdisable) | 922 | if (m_taintdisable) |
@@ -921,7 +925,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
921 | if (m_taintselected != m_isSelected) | 925 | if (m_taintselected != m_isSelected) |
922 | changeSelectedStatus(timestep); | 926 | changeSelectedStatus(timestep); |
923 | 927 | ||
924 | if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f)) | 928 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) |
925 | changevelocity(timestep); | 929 | changevelocity(timestep); |
926 | 930 | ||
927 | if (m_taintparent != _parent) | 931 | if (m_taintparent != _parent) |
@@ -930,7 +934,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
930 | if (m_taintCollidesWater != m_collidesWater) | 934 | if (m_taintCollidesWater != m_collidesWater) |
931 | changefloatonwater(timestep); | 935 | changefloatonwater(timestep); |
932 | 936 | ||
933 | if (!m_angularlock.IsIdentical(m_taintAngularLock,0)) | 937 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) |
934 | changeAngularLock(timestep); | 938 | changeAngularLock(timestep); |
935 | 939 | ||
936 | } | 940 | } |
@@ -950,7 +954,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
950 | //If we have a parent then we're not authorative here | 954 | //If we have a parent then we're not authorative here |
951 | if (_parent == null) | 955 | if (_parent == null) |
952 | { | 956 | { |
953 | if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f,1f,1f), 0)) | 957 | if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f)) |
954 | { | 958 | { |
955 | //d.BodySetFiniteRotationMode(Body, 0); | 959 | //d.BodySetFiniteRotationMode(Body, 0); |
956 | //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); | 960 | //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); |
@@ -967,7 +971,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
967 | } | 971 | } |
968 | } | 972 | } |
969 | // Store this for later in case we get turned into a separate body | 973 | // Store this for later in case we get turned into a separate body |
970 | m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z); | 974 | m_angularlock = m_taintAngularLock; |
971 | 975 | ||
972 | } | 976 | } |
973 | 977 | ||
@@ -1111,7 +1115,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1111 | prm.m_disabled = false; | 1115 | prm.m_disabled = false; |
1112 | 1116 | ||
1113 | // The body doesn't already have a finite rotation mode set here | 1117 | // The body doesn't already have a finite rotation mode set here |
1114 | if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) | 1118 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) |
1115 | { | 1119 | { |
1116 | prm.createAMotor(m_angularlock); | 1120 | prm.createAMotor(m_angularlock); |
1117 | } | 1121 | } |
@@ -1154,7 +1158,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1154 | m_disabled = false; | 1158 | m_disabled = false; |
1155 | 1159 | ||
1156 | // The body doesn't already have a finite rotation mode set here | 1160 | // The body doesn't already have a finite rotation mode set here |
1157 | if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null) | 1161 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) |
1158 | { | 1162 | { |
1159 | createAMotor(m_angularlock); | 1163 | createAMotor(m_angularlock); |
1160 | } | 1164 | } |
@@ -1338,7 +1342,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1338 | m_taintshape = false; | 1342 | m_taintshape = false; |
1339 | m_taintforce = false; | 1343 | m_taintforce = false; |
1340 | m_taintdisable = false; | 1344 | m_taintdisable = false; |
1341 | m_taintVelocity = PhysicsVector.Zero; | 1345 | m_taintVelocity = Vector3.Zero; |
1342 | } | 1346 | } |
1343 | 1347 | ||
1344 | public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) | 1348 | public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) |
@@ -1567,7 +1571,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1567 | //Console.WriteLine("Move " + m_primName); | 1571 | //Console.WriteLine("Move " + m_primName); |
1568 | if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 | 1572 | if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 |
1569 | // NON-'VEHICLES' are dealt with here | 1573 | // NON-'VEHICLES' are dealt with here |
1570 | if (d.BodyIsEnabled(Body) && !m_angularlock.IsIdentical(PhysicsVector.Zero, 0.003f)) | 1574 | if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) |
1571 | { | 1575 | { |
1572 | d.Vector3 avel2 = d.BodyGetAngularVel(Body); | 1576 | d.Vector3 avel2 = d.BodyGetAngularVel(Body); |
1573 | if (m_angularlock.X == 1) | 1577 | if (m_angularlock.X == 1) |
@@ -1624,7 +1628,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1624 | 1628 | ||
1625 | d.Vector3 pos = d.BodyGetPosition(Body); | 1629 | d.Vector3 pos = d.BodyGetPosition(Body); |
1626 | _target_velocity = | 1630 | _target_velocity = |
1627 | new PhysicsVector( | 1631 | new Vector3( |
1628 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), | 1632 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), |
1629 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), | 1633 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), |
1630 | (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) | 1634 | (m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep) |
@@ -1632,7 +1636,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1632 | 1636 | ||
1633 | // if velocity is zero, use position control; otherwise, velocity control | 1637 | // if velocity is zero, use position control; otherwise, velocity control |
1634 | 1638 | ||
1635 | if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f)) | 1639 | if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f)) |
1636 | { | 1640 | { |
1637 | // keep track of where we stopped. No more slippin' & slidin' | 1641 | // keep track of where we stopped. No more slippin' & slidin' |
1638 | 1642 | ||
@@ -1717,13 +1721,13 @@ Console.WriteLine(" JointCreateFixed"); | |||
1717 | 1721 | ||
1718 | 1722 | ||
1719 | _target_velocity = | 1723 | _target_velocity = |
1720 | new PhysicsVector(0.0f, 0.0f, | 1724 | new Vector3(0.0f, 0.0f, |
1721 | (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) | 1725 | (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) |
1722 | ); | 1726 | ); |
1723 | 1727 | ||
1724 | // if velocity is zero, use position control; otherwise, velocity control | 1728 | // if velocity is zero, use position control; otherwise, velocity control |
1725 | 1729 | ||
1726 | if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f)) | 1730 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) |
1727 | { | 1731 | { |
1728 | // keep track of where we stopped. No more slippin' & slidin' | 1732 | // keep track of where we stopped. No more slippin' & slidin' |
1729 | 1733 | ||
@@ -1812,7 +1816,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1812 | d.BodySetQuaternion(Body, ref myrot); | 1816 | d.BodySetQuaternion(Body, ref myrot); |
1813 | if (m_isphysical) | 1817 | if (m_isphysical) |
1814 | { | 1818 | { |
1815 | if (!m_angularlock.IsIdentical(new PhysicsVector(1, 1, 1), 0)) | 1819 | if (!m_angularlock.ApproxEquals(Vector3.One, 0f)) |
1816 | createAMotor(m_angularlock); | 1820 | createAMotor(m_angularlock); |
1817 | } | 1821 | } |
1818 | } | 1822 | } |
@@ -2121,7 +2125,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2121 | //m_log.Info("[PHYSICS]: dequeing forcelist"); | 2125 | //m_log.Info("[PHYSICS]: dequeing forcelist"); |
2122 | if (IsPhysical) | 2126 | if (IsPhysical) |
2123 | { | 2127 | { |
2124 | PhysicsVector iforce = new PhysicsVector(); | 2128 | Vector3 iforce = Vector3.Zero; |
2125 | for (int i = 0; i < m_forcelist.Count; i++) | 2129 | for (int i = 0; i < m_forcelist.Count; i++) |
2126 | { | 2130 | { |
2127 | iforce = iforce + (m_forcelist[i] * 100); | 2131 | iforce = iforce + (m_forcelist[i] * 100); |
@@ -2151,8 +2155,8 @@ Console.WriteLine(" JointCreateFixed"); | |||
2151 | d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z); | 2155 | d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z); |
2152 | } | 2156 | } |
2153 | } | 2157 | } |
2154 | 2158 | ||
2155 | m_taintTorque = new PhysicsVector(0, 0, 0); | 2159 | m_taintTorque = Vector3.Zero; |
2156 | } | 2160 | } |
2157 | 2161 | ||
2158 | public void changeAddAngularForce(float timestamp) | 2162 | public void changeAddAngularForce(float timestamp) |
@@ -2164,7 +2168,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2164 | //m_log.Info("[PHYSICS]: dequeing forcelist"); | 2168 | //m_log.Info("[PHYSICS]: dequeing forcelist"); |
2165 | if (IsPhysical) | 2169 | if (IsPhysical) |
2166 | { | 2170 | { |
2167 | PhysicsVector iforce = new PhysicsVector(); | 2171 | Vector3 iforce = Vector3.Zero; |
2168 | for (int i = 0; i < m_angularforcelist.Count; i++) | 2172 | for (int i = 0; i < m_angularforcelist.Count; i++) |
2169 | { | 2173 | { |
2170 | iforce = iforce + (m_angularforcelist[i] * 100); | 2174 | iforce = iforce + (m_angularforcelist[i] * 100); |
@@ -2198,7 +2202,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2198 | 2202 | ||
2199 | //resetCollisionAccounting(); | 2203 | //resetCollisionAccounting(); |
2200 | } | 2204 | } |
2201 | m_taintVelocity = PhysicsVector.Zero; | 2205 | m_taintVelocity = Vector3.Zero; |
2202 | } | 2206 | } |
2203 | 2207 | ||
2204 | public override bool IsPhysical | 2208 | public override bool IsPhysical |
@@ -2207,7 +2211,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2207 | set { | 2211 | set { |
2208 | m_isphysical = value; | 2212 | m_isphysical = value; |
2209 | if (!m_isphysical) // Zero the remembered last velocity | 2213 | if (!m_isphysical) // Zero the remembered last velocity |
2210 | m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f); | 2214 | m_lastVelocity = Vector3.Zero; |
2211 | } | 2215 | } |
2212 | } | 2216 | } |
2213 | 2217 | ||
@@ -2252,7 +2256,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2252 | get { return _zeroFlag; } | 2256 | get { return _zeroFlag; } |
2253 | } | 2257 | } |
2254 | 2258 | ||
2255 | public override PhysicsVector Position | 2259 | public override Vector3 Position |
2256 | { | 2260 | { |
2257 | get { return _position; } | 2261 | get { return _position; } |
2258 | 2262 | ||
@@ -2261,12 +2265,12 @@ Console.WriteLine(" JointCreateFixed"); | |||
2261 | } | 2265 | } |
2262 | } | 2266 | } |
2263 | 2267 | ||
2264 | public override PhysicsVector Size | 2268 | public override Vector3 Size |
2265 | { | 2269 | { |
2266 | get { return _size; } | 2270 | get { return _size; } |
2267 | set | 2271 | set |
2268 | { | 2272 | { |
2269 | if (PhysicsVector.isFinite(value)) | 2273 | if (value.IsFinite()) |
2270 | { | 2274 | { |
2271 | _size = value; | 2275 | _size = value; |
2272 | } | 2276 | } |
@@ -2282,13 +2286,13 @@ Console.WriteLine(" JointCreateFixed"); | |||
2282 | get { return CalculateMass(); } | 2286 | get { return CalculateMass(); } |
2283 | } | 2287 | } |
2284 | 2288 | ||
2285 | public override PhysicsVector Force | 2289 | public override Vector3 Force |
2286 | { | 2290 | { |
2287 | //get { return PhysicsVector.Zero; } | 2291 | //get { return Vector3.Zero; } |
2288 | get { return m_force; } | 2292 | get { return m_force; } |
2289 | set | 2293 | set |
2290 | { | 2294 | { |
2291 | if (PhysicsVector.isFinite(value)) | 2295 | if (value.IsFinite()) |
2292 | { | 2296 | { |
2293 | m_force = value; | 2297 | m_force = value; |
2294 | } | 2298 | } |
@@ -2310,7 +2314,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2310 | m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value); | 2314 | m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value); |
2311 | } | 2315 | } |
2312 | 2316 | ||
2313 | public override void VehicleVectorParam(int param, PhysicsVector value) | 2317 | public override void VehicleVectorParam(int param, Vector3 value) |
2314 | { | 2318 | { |
2315 | m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value); | 2319 | m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value); |
2316 | } | 2320 | } |
@@ -2328,14 +2332,14 @@ Console.WriteLine(" JointCreateFixed"); | |||
2328 | } | 2332 | } |
2329 | } | 2333 | } |
2330 | 2334 | ||
2331 | public override PhysicsVector CenterOfMass | 2335 | public override Vector3 CenterOfMass |
2332 | { | 2336 | { |
2333 | get { return PhysicsVector.Zero; } | 2337 | get { return Vector3.Zero; } |
2334 | } | 2338 | } |
2335 | 2339 | ||
2336 | public override PhysicsVector GeometricCenter | 2340 | public override Vector3 GeometricCenter |
2337 | { | 2341 | { |
2338 | get { return PhysicsVector.Zero; } | 2342 | get { return Vector3.Zero; } |
2339 | } | 2343 | } |
2340 | 2344 | ||
2341 | public override PrimitiveBaseShape Shape | 2345 | public override PrimitiveBaseShape Shape |
@@ -2347,13 +2351,13 @@ Console.WriteLine(" JointCreateFixed"); | |||
2347 | } | 2351 | } |
2348 | } | 2352 | } |
2349 | 2353 | ||
2350 | public override PhysicsVector Velocity | 2354 | public override Vector3 Velocity |
2351 | { | 2355 | { |
2352 | get | 2356 | get |
2353 | { | 2357 | { |
2354 | // Averate previous velocity with the new one so | 2358 | // Averate previous velocity with the new one so |
2355 | // client object interpolation works a 'little' better | 2359 | // client object interpolation works a 'little' better |
2356 | PhysicsVector returnVelocity = new PhysicsVector(); | 2360 | Vector3 returnVelocity = Vector3.Zero; |
2357 | returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; | 2361 | returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; |
2358 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2; | 2362 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2; |
2359 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; | 2363 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; |
@@ -2361,7 +2365,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2361 | } | 2365 | } |
2362 | set | 2366 | set |
2363 | { | 2367 | { |
2364 | if (PhysicsVector.isFinite(value)) | 2368 | if (value.IsFinite()) |
2365 | { | 2369 | { |
2366 | _velocity = value; | 2370 | _velocity = value; |
2367 | 2371 | ||
@@ -2376,19 +2380,19 @@ Console.WriteLine(" JointCreateFixed"); | |||
2376 | } | 2380 | } |
2377 | } | 2381 | } |
2378 | 2382 | ||
2379 | public override PhysicsVector Torque | 2383 | public override Vector3 Torque |
2380 | { | 2384 | { |
2381 | get | 2385 | get |
2382 | { | 2386 | { |
2383 | if (!m_isphysical || Body == IntPtr.Zero) | 2387 | if (!m_isphysical || Body == IntPtr.Zero) |
2384 | return new PhysicsVector(0,0,0); | 2388 | return Vector3.Zero; |
2385 | 2389 | ||
2386 | return _torque; | 2390 | return _torque; |
2387 | } | 2391 | } |
2388 | 2392 | ||
2389 | set | 2393 | set |
2390 | { | 2394 | { |
2391 | if (PhysicsVector.isFinite(value)) | 2395 | if (value.IsFinite()) |
2392 | { | 2396 | { |
2393 | m_taintTorque = value; | 2397 | m_taintTorque = value; |
2394 | _parent_scene.AddPhysicsActorTaint(this); | 2398 | _parent_scene.AddPhysicsActorTaint(this); |
@@ -2440,20 +2444,20 @@ Console.WriteLine(" JointCreateFixed"); | |||
2440 | return true; | 2444 | return true; |
2441 | } | 2445 | } |
2442 | 2446 | ||
2443 | public override PhysicsVector Acceleration | 2447 | public override Vector3 Acceleration |
2444 | { | 2448 | { |
2445 | get { return _acceleration; } | 2449 | get { return _acceleration; } |
2446 | } | 2450 | } |
2447 | 2451 | ||
2448 | 2452 | ||
2449 | public void SetAcceleration(PhysicsVector accel) | 2453 | public void SetAcceleration(Vector3 accel) |
2450 | { | 2454 | { |
2451 | _acceleration = accel; | 2455 | _acceleration = accel; |
2452 | } | 2456 | } |
2453 | 2457 | ||
2454 | public override void AddForce(PhysicsVector force, bool pushforce) | 2458 | public override void AddForce(Vector3 force, bool pushforce) |
2455 | { | 2459 | { |
2456 | if (PhysicsVector.isFinite(force)) | 2460 | if (force.IsFinite()) |
2457 | { | 2461 | { |
2458 | m_forcelist.Add(force); | 2462 | m_forcelist.Add(force); |
2459 | m_taintforce = true; | 2463 | m_taintforce = true; |
@@ -2465,9 +2469,9 @@ Console.WriteLine(" JointCreateFixed"); | |||
2465 | //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); | 2469 | //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); |
2466 | } | 2470 | } |
2467 | 2471 | ||
2468 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 2472 | public override void AddAngularForce(Vector3 force, bool pushforce) |
2469 | { | 2473 | { |
2470 | if (PhysicsVector.isFinite(force)) | 2474 | if (force.IsFinite()) |
2471 | { | 2475 | { |
2472 | m_angularforcelist.Add(force); | 2476 | m_angularforcelist.Add(force); |
2473 | m_taintaddangularforce = true; | 2477 | m_taintaddangularforce = true; |
@@ -2478,23 +2482,23 @@ Console.WriteLine(" JointCreateFixed"); | |||
2478 | } | 2482 | } |
2479 | } | 2483 | } |
2480 | 2484 | ||
2481 | public override PhysicsVector RotationalVelocity | 2485 | public override Vector3 RotationalVelocity |
2482 | { | 2486 | { |
2483 | get | 2487 | get |
2484 | { | 2488 | { |
2485 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | 2489 | Vector3 pv = Vector3.Zero; |
2486 | if (_zeroFlag) | 2490 | if (_zeroFlag) |
2487 | return pv; | 2491 | return pv; |
2488 | m_lastUpdateSent = false; | 2492 | m_lastUpdateSent = false; |
2489 | 2493 | ||
2490 | if (m_rotationalVelocity.IsIdentical(pv, 0.2f)) | 2494 | if (m_rotationalVelocity.ApproxEquals(pv, 0.2f)) |
2491 | return pv; | 2495 | return pv; |
2492 | 2496 | ||
2493 | return m_rotationalVelocity; | 2497 | return m_rotationalVelocity; |
2494 | } | 2498 | } |
2495 | set | 2499 | set |
2496 | { | 2500 | { |
2497 | if (PhysicsVector.isFinite(value)) | 2501 | if (value.IsFinite()) |
2498 | { | 2502 | { |
2499 | m_rotationalVelocity = value; | 2503 | m_rotationalVelocity = value; |
2500 | } | 2504 | } |
@@ -2535,16 +2539,16 @@ Console.WriteLine(" JointCreateFixed"); | |||
2535 | m_taintparent = null; | 2539 | m_taintparent = null; |
2536 | } | 2540 | } |
2537 | 2541 | ||
2538 | public override void LockAngularMotion(PhysicsVector axis) | 2542 | public override void LockAngularMotion(Vector3 axis) |
2539 | { | 2543 | { |
2540 | // reverse the zero/non zero values for ODE. | 2544 | // reverse the zero/non zero values for ODE. |
2541 | if (PhysicsVector.isFinite(axis)) | 2545 | if (axis.IsFinite()) |
2542 | { | 2546 | { |
2543 | axis.X = (axis.X > 0) ? 1f : 0f; | 2547 | axis.X = (axis.X > 0) ? 1f : 0f; |
2544 | axis.Y = (axis.Y > 0) ? 1f : 0f; | 2548 | axis.Y = (axis.Y > 0) ? 1f : 0f; |
2545 | axis.Z = (axis.Z > 0) ? 1f : 0f; | 2549 | axis.Z = (axis.Z > 0) ? 1f : 0f; |
2546 | m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); | 2550 | m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); |
2547 | m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z); | 2551 | m_taintAngularLock = axis; |
2548 | } | 2552 | } |
2549 | else | 2553 | else |
2550 | { | 2554 | { |
@@ -2557,7 +2561,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2557 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 2561 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
2558 | if (_parent == null) | 2562 | if (_parent == null) |
2559 | { | 2563 | { |
2560 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | 2564 | Vector3 pv = Vector3.Zero; |
2561 | bool lastZeroFlag = _zeroFlag; | 2565 | bool lastZeroFlag = _zeroFlag; |
2562 | if (Body != (IntPtr)0) // FIXME -> or if it is a joint | 2566 | if (Body != (IntPtr)0) // FIXME -> or if it is a joint |
2563 | { | 2567 | { |
@@ -2566,9 +2570,9 @@ Console.WriteLine(" JointCreateFixed"); | |||
2566 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 2570 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
2567 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); | 2571 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); |
2568 | d.Vector3 torque = d.BodyGetTorque(Body); | 2572 | d.Vector3 torque = d.BodyGetTorque(Body); |
2569 | _torque.setValues(torque.X, torque.Y, torque.Z); | 2573 | _torque = new Vector3(torque.X, torque.Y, torque.Z); |
2570 | PhysicsVector l_position = new PhysicsVector(); | 2574 | Vector3 l_position = Vector3.Zero; |
2571 | Quaternion l_orientation = new Quaternion(); | 2575 | Quaternion l_orientation = Quaternion.Identity; |
2572 | 2576 | ||
2573 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 2577 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
2574 | //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | 2578 | //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } |
@@ -2703,16 +2707,16 @@ Console.WriteLine(" JointCreateFixed"); | |||
2703 | _velocity.Z = vel.Z; | 2707 | _velocity.Z = vel.Z; |
2704 | 2708 | ||
2705 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); | 2709 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); |
2706 | _acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); | 2710 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); |
2707 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); | 2711 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); |
2708 | 2712 | ||
2709 | if (_velocity.IsIdentical(pv, 0.5f)) | 2713 | if (_velocity.ApproxEquals(pv, 0.5f)) |
2710 | { | 2714 | { |
2711 | m_rotationalVelocity = pv; | 2715 | m_rotationalVelocity = pv; |
2712 | } | 2716 | } |
2713 | else | 2717 | else |
2714 | { | 2718 | { |
2715 | m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z); | 2719 | m_rotationalVelocity = new Vector3(rotvel.X, rotvel.Y, rotvel.Z); |
2716 | } | 2720 | } |
2717 | 2721 | ||
2718 | //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); | 2722 | //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); |
@@ -2760,15 +2764,15 @@ Console.WriteLine(" JointCreateFixed"); | |||
2760 | } | 2764 | } |
2761 | } | 2765 | } |
2762 | 2766 | ||
2763 | public override void SetMomentum(PhysicsVector momentum) | 2767 | public override void SetMomentum(Vector3 momentum) |
2764 | { | 2768 | { |
2765 | } | 2769 | } |
2766 | 2770 | ||
2767 | public override PhysicsVector PIDTarget | 2771 | public override Vector3 PIDTarget |
2768 | { | 2772 | { |
2769 | set | 2773 | set |
2770 | { | 2774 | { |
2771 | if (PhysicsVector.isFinite(value)) | 2775 | if (value.IsFinite()) |
2772 | { | 2776 | { |
2773 | m_PIDTarget = value; | 2777 | m_PIDTarget = value; |
2774 | } | 2778 | } |
@@ -2784,7 +2788,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2784 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 2788 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } |
2785 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } | 2789 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } |
2786 | 2790 | ||
2787 | private void createAMotor(PhysicsVector axis) | 2791 | private void createAMotor(Vector3 axis) |
2788 | { | 2792 | { |
2789 | if (Body == IntPtr.Zero) | 2793 | if (Body == IntPtr.Zero) |
2790 | return; | 2794 | 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 35fc616..26cd1dd 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 b50364b..96c3e26 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 e7d989c..8bdb18d 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 | ||
@@ -518,15 +516,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
518 | 516 | ||
519 | public class PhysXPrim : PhysicsActor | 517 | public class PhysXPrim : PhysicsActor |
520 | { | 518 | { |
521 | private PhysicsVector _velocity; | 519 | private Vector3 _velocity; |
522 | private PhysicsVector _acceleration; | 520 | private Vector3 _acceleration; |
523 | private PhysicsVector m_rotationalVelocity; | 521 | private Vector3 m_rotationalVelocity; |
524 | private NxActor _prim; | 522 | private NxActor _prim; |
525 | 523 | ||
526 | public PhysXPrim(NxActor prim) | 524 | public PhysXPrim(NxActor prim) |
527 | { | 525 | { |
528 | _velocity = new PhysicsVector(); | 526 | _velocity = Vector3.Zero; |
529 | _acceleration = new PhysicsVector(); | 527 | _acceleration = Vector3.Zero; |
530 | _prim = prim; | 528 | _prim = prim; |
531 | } | 529 | } |
532 | 530 | ||
@@ -580,7 +578,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
580 | set { return; } | 578 | set { return; } |
581 | } | 579 | } |
582 | 580 | ||
583 | public override PhysicsVector RotationalVelocity | 581 | public override Vector3 RotationalVelocity |
584 | { | 582 | { |
585 | get { return m_rotationalVelocity; } | 583 | get { return m_rotationalVelocity; } |
586 | set { m_rotationalVelocity = value; } | 584 | set { m_rotationalVelocity = value; } |
@@ -616,11 +614,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
616 | get { return false; } | 614 | get { return false; } |
617 | } | 615 | } |
618 | 616 | ||
619 | public override PhysicsVector Position | 617 | public override Vector3 Position |
620 | { | 618 | { |
621 | get | 619 | get |
622 | { | 620 | { |
623 | PhysicsVector pos = new PhysicsVector(); | 621 | Vector3 pos = Vector3.Zero; |
624 | Vec3 vec = _prim.Position; | 622 | Vec3 vec = _prim.Position; |
625 | pos.X = vec.X; | 623 | pos.X = vec.X; |
626 | pos.Y = vec.Y; | 624 | pos.Y = vec.Y; |
@@ -629,7 +627,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
629 | } | 627 | } |
630 | set | 628 | set |
631 | { | 629 | { |
632 | PhysicsVector vec = value; | 630 | Vector3 vec = value; |
633 | Vec3 pos = new Vec3(); | 631 | Vec3 pos = new Vec3(); |
634 | pos.X = vec.X; | 632 | pos.X = vec.X; |
635 | pos.Y = vec.Y; | 633 | pos.Y = vec.Y; |
@@ -643,15 +641,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
643 | set { return; } | 641 | set { return; } |
644 | } | 642 | } |
645 | 643 | ||
646 | public override PhysicsVector Velocity | 644 | public override Vector3 Velocity |
647 | { | 645 | { |
648 | get { return _velocity; } | 646 | get { return _velocity; } |
649 | set { _velocity = value; } | 647 | set { _velocity = value; } |
650 | } | 648 | } |
651 | 649 | ||
652 | public override PhysicsVector Torque | 650 | public override Vector3 Torque |
653 | { | 651 | { |
654 | get { return PhysicsVector.Zero; } | 652 | get { return Vector3.Zero; } |
655 | set { return; } | 653 | set { return; } |
656 | } | 654 | } |
657 | 655 | ||
@@ -682,31 +680,31 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
682 | set { } | 680 | set { } |
683 | } | 681 | } |
684 | 682 | ||
685 | public override PhysicsVector Acceleration | 683 | public override Vector3 Acceleration |
686 | { | 684 | { |
687 | get { return _acceleration; } | 685 | get { return _acceleration; } |
688 | } | 686 | } |
689 | 687 | ||
690 | public void SetAcceleration(PhysicsVector accel) | 688 | public void SetAcceleration(Vector3 accel) |
691 | { | 689 | { |
692 | _acceleration = accel; | 690 | _acceleration = accel; |
693 | } | 691 | } |
694 | 692 | ||
695 | public override void AddForce(PhysicsVector force, bool pushforce) | 693 | public override void AddForce(Vector3 force, bool pushforce) |
696 | { | 694 | { |
697 | } | 695 | } |
698 | 696 | ||
699 | public override void AddAngularForce(PhysicsVector force, bool pushforce) | 697 | public override void AddAngularForce(Vector3 force, bool pushforce) |
700 | { | 698 | { |
701 | } | 699 | } |
702 | 700 | ||
703 | public override void SetMomentum(PhysicsVector momentum) | 701 | public override void SetMomentum(Vector3 momentum) |
704 | { | 702 | { |
705 | } | 703 | } |
706 | 704 | ||
707 | public override PhysicsVector Size | 705 | public override Vector3 Size |
708 | { | 706 | { |
709 | get { return PhysicsVector.Zero; } | 707 | get { return Vector3.Zero; } |
710 | set { } | 708 | set { } |
711 | } | 709 | } |
712 | 710 | ||
@@ -718,7 +716,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
718 | { | 716 | { |
719 | } | 717 | } |
720 | 718 | ||
721 | public override void LockAngularMotion(PhysicsVector axis) | 719 | public override void LockAngularMotion(Vector3 axis) |
722 | { | 720 | { |
723 | 721 | ||
724 | } | 722 | } |
@@ -728,9 +726,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
728 | get { return 0f; } | 726 | get { return 0f; } |
729 | } | 727 | } |
730 | 728 | ||
731 | public override PhysicsVector Force | 729 | public override Vector3 Force |
732 | { | 730 | { |
733 | get { return PhysicsVector.Zero; } | 731 | get { return Vector3.Zero; } |
734 | set { return; } | 732 | set { return; } |
735 | } | 733 | } |
736 | 734 | ||
@@ -745,7 +743,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
745 | 743 | ||
746 | } | 744 | } |
747 | 745 | ||
748 | public override void VehicleVectorParam(int param, PhysicsVector value) | 746 | public override void VehicleVectorParam(int param, Vector3 value) |
749 | { | 747 | { |
750 | 748 | ||
751 | } | 749 | } |
@@ -760,21 +758,21 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
760 | 758 | ||
761 | } | 759 | } |
762 | 760 | ||
763 | public override PhysicsVector CenterOfMass | 761 | public override Vector3 CenterOfMass |
764 | { | 762 | { |
765 | get { return PhysicsVector.Zero; } | 763 | get { return Vector3.Zero; } |
766 | } | 764 | } |
767 | 765 | ||
768 | public override PhysicsVector GeometricCenter | 766 | public override Vector3 GeometricCenter |
769 | { | 767 | { |
770 | get { return PhysicsVector.Zero; } | 768 | get { return Vector3.Zero; } |
771 | } | 769 | } |
772 | 770 | ||
773 | public override void CrossingFailure() | 771 | public override void CrossingFailure() |
774 | { | 772 | { |
775 | } | 773 | } |
776 | 774 | ||
777 | public override PhysicsVector PIDTarget { set { return; } } | 775 | public override Vector3 PIDTarget { set { return; } } |
778 | public override bool PIDActive { set { return; } } | 776 | public override bool PIDActive { set { return; } } |
779 | public override float PIDTau { set { return; } } | 777 | public override float PIDTau { set { return; } } |
780 | 778 | ||