diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 127 |
1 files changed, 61 insertions, 66 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index a0d58d3..542f732 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -95,18 +95,18 @@ public sealed class BSCharacter : BSPhysObject | |||
95 | // the avatar seeking to reach the motor's target speed. | 95 | // the avatar seeking to reach the motor's target speed. |
96 | // This motor runs as a prestep action for the avatar so it will keep the avatar | 96 | // This motor runs as a prestep action for the avatar so it will keep the avatar |
97 | // standing as well as moving. Destruction of the avatar will destroy the pre-step action. | 97 | // standing as well as moving. Destruction of the avatar will destroy the pre-step action. |
98 | m_moveActor = new BSActorAvatarMove(PhysicsScene, this, AvatarMoveActorName); | 98 | m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName); |
99 | PhysicalActors.Add(AvatarMoveActorName, m_moveActor); | 99 | PhysicalActors.Add(AvatarMoveActorName, m_moveActor); |
100 | 100 | ||
101 | DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", | 101 | DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", |
102 | LocalID, _size, Scale, Density, _avatarVolume, RawMass); | 102 | LocalID, _size, Scale, Density, _avatarVolume, RawMass); |
103 | 103 | ||
104 | // do actual creation in taint time | 104 | // do actual creation in taint time |
105 | PhysicsScene.TaintedObject("BSCharacter.create", delegate() | 105 | PhysScene.TaintedObject("BSCharacter.create", delegate() |
106 | { | 106 | { |
107 | DetailLog("{0},BSCharacter.create,taint", LocalID); | 107 | DetailLog("{0},BSCharacter.create,taint", LocalID); |
108 | // New body and shape into PhysBody and PhysShape | 108 | // New body and shape into PhysBody and PhysShape |
109 | PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this); | 109 | PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this); |
110 | 110 | ||
111 | SetPhysicalProperties(); | 111 | SetPhysicalProperties(); |
112 | }); | 112 | }); |
@@ -119,18 +119,18 @@ public sealed class BSCharacter : BSPhysObject | |||
119 | base.Destroy(); | 119 | base.Destroy(); |
120 | 120 | ||
121 | DetailLog("{0},BSCharacter.Destroy", LocalID); | 121 | DetailLog("{0},BSCharacter.Destroy", LocalID); |
122 | PhysicsScene.TaintedObject("BSCharacter.destroy", delegate() | 122 | PhysScene.TaintedObject("BSCharacter.destroy", delegate() |
123 | { | 123 | { |
124 | PhysicsScene.Shapes.DereferenceBody(PhysBody, null /* bodyCallback */); | 124 | PhysScene.Shapes.DereferenceBody(PhysBody, null /* bodyCallback */); |
125 | PhysBody.Clear(); | 125 | PhysBody.Clear(); |
126 | PhysicsScene.Shapes.DereferenceShape(PhysShape, null /* bodyCallback */); | 126 | PhysShape.Dereference(PhysScene); |
127 | PhysShape.Clear(); | 127 | PhysShape = new BSShapeNull(); |
128 | }); | 128 | }); |
129 | } | 129 | } |
130 | 130 | ||
131 | private void SetPhysicalProperties() | 131 | private void SetPhysicalProperties() |
132 | { | 132 | { |
133 | PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody); | 133 | PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody); |
134 | 134 | ||
135 | ZeroMotion(true); | 135 | ZeroMotion(true); |
136 | ForcePosition = _position; | 136 | ForcePosition = _position; |
@@ -145,35 +145,35 @@ public sealed class BSCharacter : BSPhysObject | |||
145 | // Needs to be reset especially when an avatar is recreated after crossing a region boundry. | 145 | // Needs to be reset especially when an avatar is recreated after crossing a region boundry. |
146 | Flying = _flying; | 146 | Flying = _flying; |
147 | 147 | ||
148 | PhysicsScene.PE.SetRestitution(PhysBody, BSParam.AvatarRestitution); | 148 | PhysScene.PE.SetRestitution(PhysBody, BSParam.AvatarRestitution); |
149 | PhysicsScene.PE.SetMargin(PhysShape, PhysicsScene.Params.collisionMargin); | 149 | PhysScene.PE.SetMargin(PhysShape.physShapeInfo, PhysScene.Params.collisionMargin); |
150 | PhysicsScene.PE.SetLocalScaling(PhysShape, Scale); | 150 | PhysScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale); |
151 | PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold); | 151 | PhysScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold); |
152 | if (BSParam.CcdMotionThreshold > 0f) | 152 | if (BSParam.CcdMotionThreshold > 0f) |
153 | { | 153 | { |
154 | PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold); | 154 | PhysScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold); |
155 | PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius); | 155 | PhysScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius); |
156 | } | 156 | } |
157 | 157 | ||
158 | UpdatePhysicalMassProperties(RawMass, false); | 158 | UpdatePhysicalMassProperties(RawMass, false); |
159 | 159 | ||
160 | // Make so capsule does not fall over | 160 | // Make so capsule does not fall over |
161 | PhysicsScene.PE.SetAngularFactorV(PhysBody, OMV.Vector3.Zero); | 161 | PhysScene.PE.SetAngularFactorV(PhysBody, OMV.Vector3.Zero); |
162 | 162 | ||
163 | // The avatar mover sets some parameters. | 163 | // The avatar mover sets some parameters. |
164 | PhysicalActors.Refresh(); | 164 | PhysicalActors.Refresh(); |
165 | 165 | ||
166 | PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_CHARACTER_OBJECT); | 166 | PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_CHARACTER_OBJECT); |
167 | 167 | ||
168 | PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody); | 168 | PhysScene.PE.AddObjectToWorld(PhysScene.World, PhysBody); |
169 | 169 | ||
170 | // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG); | 170 | // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG); |
171 | PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_DEACTIVATION); | 171 | PhysScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_DEACTIVATION); |
172 | PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, PhysBody); | 172 | PhysScene.PE.UpdateSingleAabb(PhysScene.World, PhysBody); |
173 | 173 | ||
174 | // Do this after the object has been added to the world | 174 | // Do this after the object has been added to the world |
175 | PhysBody.collisionType = CollisionType.Avatar; | 175 | PhysBody.collisionType = CollisionType.Avatar; |
176 | PhysBody.ApplyCollisionMask(PhysicsScene); | 176 | PhysBody.ApplyCollisionMask(PhysScene); |
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
@@ -203,14 +203,14 @@ public sealed class BSCharacter : BSPhysObject | |||
203 | DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}", | 203 | DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}", |
204 | LocalID, _size, Scale, Density, _avatarVolume, RawMass); | 204 | LocalID, _size, Scale, Density, _avatarVolume, RawMass); |
205 | 205 | ||
206 | PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() | 206 | PhysScene.TaintedObject("BSCharacter.setSize", delegate() |
207 | { | 207 | { |
208 | if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) | 208 | if (PhysBody.HasPhysicalBody && PhysShape.physShapeInfo.HasPhysicalShape) |
209 | { | 209 | { |
210 | PhysicsScene.PE.SetLocalScaling(PhysShape, Scale); | 210 | PhysScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale); |
211 | UpdatePhysicalMassProperties(RawMass, true); | 211 | UpdatePhysicalMassProperties(RawMass, true); |
212 | // Make sure this change appears as a property update event | 212 | // Make sure this change appears as a property update event |
213 | PhysicsScene.PE.PushUpdate(PhysBody); | 213 | PhysScene.PE.PushUpdate(PhysBody); |
214 | } | 214 | } |
215 | }); | 215 | }); |
216 | 216 | ||
@@ -221,11 +221,6 @@ public sealed class BSCharacter : BSPhysObject | |||
221 | { | 221 | { |
222 | set { BaseShape = value; } | 222 | set { BaseShape = value; } |
223 | } | 223 | } |
224 | // I want the physics engine to make an avatar capsule | ||
225 | public override BSPhysicsShapeType PreferredPhysicalShape | ||
226 | { | ||
227 | get {return BSPhysicsShapeType.SHAPE_CAPSULE; } | ||
228 | } | ||
229 | 224 | ||
230 | public override bool Grabbed { | 225 | public override bool Grabbed { |
231 | set { _grabbed = value; } | 226 | set { _grabbed = value; } |
@@ -252,24 +247,24 @@ public sealed class BSCharacter : BSPhysObject | |||
252 | _rotationalVelocity = OMV.Vector3.Zero; | 247 | _rotationalVelocity = OMV.Vector3.Zero; |
253 | 248 | ||
254 | // Zero some other properties directly into the physics engine | 249 | // Zero some other properties directly into the physics engine |
255 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate() | 250 | PhysScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate() |
256 | { | 251 | { |
257 | if (PhysBody.HasPhysicalBody) | 252 | if (PhysBody.HasPhysicalBody) |
258 | PhysicsScene.PE.ClearAllForces(PhysBody); | 253 | PhysScene.PE.ClearAllForces(PhysBody); |
259 | }); | 254 | }); |
260 | } | 255 | } |
261 | public override void ZeroAngularMotion(bool inTaintTime) | 256 | public override void ZeroAngularMotion(bool inTaintTime) |
262 | { | 257 | { |
263 | _rotationalVelocity = OMV.Vector3.Zero; | 258 | _rotationalVelocity = OMV.Vector3.Zero; |
264 | 259 | ||
265 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate() | 260 | PhysScene.TaintedObject(inTaintTime, "BSCharacter.ZeroMotion", delegate() |
266 | { | 261 | { |
267 | if (PhysBody.HasPhysicalBody) | 262 | if (PhysBody.HasPhysicalBody) |
268 | { | 263 | { |
269 | PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, OMV.Vector3.Zero); | 264 | PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, OMV.Vector3.Zero); |
270 | PhysicsScene.PE.SetAngularVelocity(PhysBody, OMV.Vector3.Zero); | 265 | PhysScene.PE.SetAngularVelocity(PhysBody, OMV.Vector3.Zero); |
271 | // The next also get rid of applied linear force but the linear velocity is untouched. | 266 | // The next also get rid of applied linear force but the linear velocity is untouched. |
272 | PhysicsScene.PE.ClearForces(PhysBody); | 267 | PhysScene.PE.ClearForces(PhysBody); |
273 | } | 268 | } |
274 | }); | 269 | }); |
275 | } | 270 | } |
@@ -291,7 +286,7 @@ public sealed class BSCharacter : BSPhysObject | |||
291 | set { | 286 | set { |
292 | _position = value; | 287 | _position = value; |
293 | 288 | ||
294 | PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() | 289 | PhysScene.TaintedObject("BSCharacter.setPosition", delegate() |
295 | { | 290 | { |
296 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 291 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
297 | PositionSanityCheck(); | 292 | PositionSanityCheck(); |
@@ -301,14 +296,14 @@ public sealed class BSCharacter : BSPhysObject | |||
301 | } | 296 | } |
302 | public override OMV.Vector3 ForcePosition { | 297 | public override OMV.Vector3 ForcePosition { |
303 | get { | 298 | get { |
304 | _position = PhysicsScene.PE.GetPosition(PhysBody); | 299 | _position = PhysScene.PE.GetPosition(PhysBody); |
305 | return _position; | 300 | return _position; |
306 | } | 301 | } |
307 | set { | 302 | set { |
308 | _position = value; | 303 | _position = value; |
309 | if (PhysBody.HasPhysicalBody) | 304 | if (PhysBody.HasPhysicalBody) |
310 | { | 305 | { |
311 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); | 306 | PhysScene.PE.SetTranslation(PhysBody, _position, _orientation); |
312 | } | 307 | } |
313 | } | 308 | } |
314 | } | 309 | } |
@@ -322,18 +317,18 @@ public sealed class BSCharacter : BSPhysObject | |||
322 | bool ret = false; | 317 | bool ret = false; |
323 | 318 | ||
324 | // TODO: check for out of bounds | 319 | // TODO: check for out of bounds |
325 | if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition)) | 320 | if (!PhysScene.TerrainManager.IsWithinKnownTerrain(RawPosition)) |
326 | { | 321 | { |
327 | // The character is out of the known/simulated area. | 322 | // The character is out of the known/simulated area. |
328 | // Force the avatar position to be within known. ScenePresence will use the position | 323 | // Force the avatar position to be within known. ScenePresence will use the position |
329 | // plus the velocity to decide if the avatar is moving out of the region. | 324 | // plus the velocity to decide if the avatar is moving out of the region. |
330 | RawPosition = PhysicsScene.TerrainManager.ClampPositionIntoKnownTerrain(RawPosition); | 325 | RawPosition = PhysScene.TerrainManager.ClampPositionIntoKnownTerrain(RawPosition); |
331 | DetailLog("{0},BSCharacter.PositionSanityCheck,notWithinKnownTerrain,clampedPos={1}", LocalID, RawPosition); | 326 | DetailLog("{0},BSCharacter.PositionSanityCheck,notWithinKnownTerrain,clampedPos={1}", LocalID, RawPosition); |
332 | return true; | 327 | return true; |
333 | } | 328 | } |
334 | 329 | ||
335 | // If below the ground, move the avatar up | 330 | // If below the ground, move the avatar up |
336 | float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition); | 331 | float terrainHeight = PhysScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition); |
337 | if (Position.Z < terrainHeight) | 332 | if (Position.Z < terrainHeight) |
338 | { | 333 | { |
339 | DetailLog("{0},BSCharacter.PositionSanityCheck,adjustForUnderGround,pos={1},terrain={2}", LocalID, _position, terrainHeight); | 334 | DetailLog("{0},BSCharacter.PositionSanityCheck,adjustForUnderGround,pos={1},terrain={2}", LocalID, _position, terrainHeight); |
@@ -342,7 +337,7 @@ public sealed class BSCharacter : BSPhysObject | |||
342 | } | 337 | } |
343 | if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0) | 338 | if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0) |
344 | { | 339 | { |
345 | float waterHeight = PhysicsScene.TerrainManager.GetWaterLevelAtXYZ(_position); | 340 | float waterHeight = PhysScene.TerrainManager.GetWaterLevelAtXYZ(_position); |
346 | if (Position.Z < waterHeight) | 341 | if (Position.Z < waterHeight) |
347 | { | 342 | { |
348 | _position.Z = waterHeight; | 343 | _position.Z = waterHeight; |
@@ -363,7 +358,7 @@ public sealed class BSCharacter : BSPhysObject | |||
363 | { | 358 | { |
364 | // The new position value must be pushed into the physics engine but we can't | 359 | // The new position value must be pushed into the physics engine but we can't |
365 | // just assign to "Position" because of potential call loops. | 360 | // just assign to "Position" because of potential call loops. |
366 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() | 361 | PhysScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() |
367 | { | 362 | { |
368 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 363 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
369 | ForcePosition = _position; | 364 | ForcePosition = _position; |
@@ -376,13 +371,13 @@ public sealed class BSCharacter : BSPhysObject | |||
376 | public override float Mass { get { return _mass; } } | 371 | public override float Mass { get { return _mass; } } |
377 | 372 | ||
378 | // used when we only want this prim's mass and not the linkset thing | 373 | // used when we only want this prim's mass and not the linkset thing |
379 | public override float RawMass { | 374 | public override float RawMass { |
380 | get {return _mass; } | 375 | get {return _mass; } |
381 | } | 376 | } |
382 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) | 377 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) |
383 | { | 378 | { |
384 | OMV.Vector3 localInertia = PhysicsScene.PE.CalculateLocalInertia(PhysShape, physMass); | 379 | OMV.Vector3 localInertia = PhysScene.PE.CalculateLocalInertia(PhysShape.physShapeInfo, physMass); |
385 | PhysicsScene.PE.SetMassProps(PhysBody, physMass, localInertia); | 380 | PhysScene.PE.SetMassProps(PhysBody, physMass, localInertia); |
386 | } | 381 | } |
387 | 382 | ||
388 | public override OMV.Vector3 Force { | 383 | public override OMV.Vector3 Force { |
@@ -390,11 +385,11 @@ public sealed class BSCharacter : BSPhysObject | |||
390 | set { | 385 | set { |
391 | RawForce = value; | 386 | RawForce = value; |
392 | // m_log.DebugFormat("{0}: Force = {1}", LogHeader, _force); | 387 | // m_log.DebugFormat("{0}: Force = {1}", LogHeader, _force); |
393 | PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate() | 388 | PhysScene.TaintedObject("BSCharacter.SetForce", delegate() |
394 | { | 389 | { |
395 | DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, RawForce); | 390 | DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, RawForce); |
396 | if (PhysBody.HasPhysicalBody) | 391 | if (PhysBody.HasPhysicalBody) |
397 | PhysicsScene.PE.SetObjectForce(PhysBody, RawForce); | 392 | PhysScene.PE.SetObjectForce(PhysBody, RawForce); |
398 | }); | 393 | }); |
399 | } | 394 | } |
400 | } | 395 | } |
@@ -437,7 +432,7 @@ public sealed class BSCharacter : BSPhysObject | |||
437 | set { | 432 | set { |
438 | RawVelocity = value; | 433 | RawVelocity = value; |
439 | // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, RawVelocity); | 434 | // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, RawVelocity); |
440 | PhysicsScene.TaintedObject("BSCharacter.setVelocity", delegate() | 435 | PhysScene.TaintedObject("BSCharacter.setVelocity", delegate() |
441 | { | 436 | { |
442 | if (m_moveActor != null) | 437 | if (m_moveActor != null) |
443 | m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, true /* inTaintTime */); | 438 | m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, true /* inTaintTime */); |
@@ -450,11 +445,11 @@ public sealed class BSCharacter : BSPhysObject | |||
450 | public override OMV.Vector3 ForceVelocity { | 445 | public override OMV.Vector3 ForceVelocity { |
451 | get { return RawVelocity; } | 446 | get { return RawVelocity; } |
452 | set { | 447 | set { |
453 | PhysicsScene.AssertInTaintTime("BSCharacter.ForceVelocity"); | 448 | PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity"); |
454 | 449 | ||
455 | RawVelocity = value; | 450 | RawVelocity = value; |
456 | PhysicsScene.PE.SetLinearVelocity(PhysBody, RawVelocity); | 451 | PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity); |
457 | PhysicsScene.PE.Activate(PhysBody, true); | 452 | PhysScene.PE.Activate(PhysBody, true); |
458 | } | 453 | } |
459 | } | 454 | } |
460 | public override OMV.Vector3 Torque { | 455 | public override OMV.Vector3 Torque { |
@@ -484,7 +479,7 @@ public sealed class BSCharacter : BSPhysObject | |||
484 | if (_orientation != value) | 479 | if (_orientation != value) |
485 | { | 480 | { |
486 | _orientation = value; | 481 | _orientation = value; |
487 | PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate() | 482 | PhysScene.TaintedObject("BSCharacter.setOrientation", delegate() |
488 | { | 483 | { |
489 | ForceOrientation = _orientation; | 484 | ForceOrientation = _orientation; |
490 | }); | 485 | }); |
@@ -496,7 +491,7 @@ public sealed class BSCharacter : BSPhysObject | |||
496 | { | 491 | { |
497 | get | 492 | get |
498 | { | 493 | { |
499 | _orientation = PhysicsScene.PE.GetOrientation(PhysBody); | 494 | _orientation = PhysScene.PE.GetOrientation(PhysBody); |
500 | return _orientation; | 495 | return _orientation; |
501 | } | 496 | } |
502 | set | 497 | set |
@@ -505,7 +500,7 @@ public sealed class BSCharacter : BSPhysObject | |||
505 | if (PhysBody.HasPhysicalBody) | 500 | if (PhysBody.HasPhysicalBody) |
506 | { | 501 | { |
507 | // _position = PhysicsScene.PE.GetPosition(BSBody); | 502 | // _position = PhysicsScene.PE.GetPosition(BSBody); |
508 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); | 503 | PhysScene.PE.SetTranslation(PhysBody, _position, _orientation); |
509 | } | 504 | } |
510 | } | 505 | } |
511 | } | 506 | } |
@@ -554,14 +549,14 @@ public sealed class BSCharacter : BSPhysObject | |||
554 | public override bool FloatOnWater { | 549 | public override bool FloatOnWater { |
555 | set { | 550 | set { |
556 | _floatOnWater = value; | 551 | _floatOnWater = value; |
557 | PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate() | 552 | PhysScene.TaintedObject("BSCharacter.setFloatOnWater", delegate() |
558 | { | 553 | { |
559 | if (PhysBody.HasPhysicalBody) | 554 | if (PhysBody.HasPhysicalBody) |
560 | { | 555 | { |
561 | if (_floatOnWater) | 556 | if (_floatOnWater) |
562 | CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER); | 557 | CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER); |
563 | else | 558 | else |
564 | CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER); | 559 | CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER); |
565 | } | 560 | } |
566 | }); | 561 | }); |
567 | } | 562 | } |
@@ -582,7 +577,7 @@ public sealed class BSCharacter : BSPhysObject | |||
582 | public override float Buoyancy { | 577 | public override float Buoyancy { |
583 | get { return _buoyancy; } | 578 | get { return _buoyancy; } |
584 | set { _buoyancy = value; | 579 | set { _buoyancy = value; |
585 | PhysicsScene.TaintedObject("BSCharacter.setBuoyancy", delegate() | 580 | PhysScene.TaintedObject("BSCharacter.setBuoyancy", delegate() |
586 | { | 581 | { |
587 | DetailLog("{0},BSCharacter.setBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 582 | DetailLog("{0},BSCharacter.setBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
588 | ForceBuoyancy = _buoyancy; | 583 | ForceBuoyancy = _buoyancy; |
@@ -591,8 +586,8 @@ public sealed class BSCharacter : BSPhysObject | |||
591 | } | 586 | } |
592 | public override float ForceBuoyancy { | 587 | public override float ForceBuoyancy { |
593 | get { return _buoyancy; } | 588 | get { return _buoyancy; } |
594 | set { | 589 | set { |
595 | PhysicsScene.AssertInTaintTime("BSCharacter.ForceBuoyancy"); | 590 | PhysScene.AssertInTaintTime("BSCharacter.ForceBuoyancy"); |
596 | 591 | ||
597 | _buoyancy = value; | 592 | _buoyancy = value; |
598 | DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 593 | DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
@@ -600,7 +595,7 @@ public sealed class BSCharacter : BSPhysObject | |||
600 | float grav = BSParam.Gravity * (1f - _buoyancy); | 595 | float grav = BSParam.Gravity * (1f - _buoyancy); |
601 | Gravity = new OMV.Vector3(0f, 0f, grav); | 596 | Gravity = new OMV.Vector3(0f, 0f, grav); |
602 | if (PhysBody.HasPhysicalBody) | 597 | if (PhysBody.HasPhysicalBody) |
603 | PhysicsScene.PE.SetGravity(PhysBody, Gravity); | 598 | PhysScene.PE.SetGravity(PhysBody, Gravity); |
604 | } | 599 | } |
605 | } | 600 | } |
606 | 601 | ||
@@ -618,7 +613,7 @@ public sealed class BSCharacter : BSPhysObject | |||
618 | public override void AddForce(OMV.Vector3 force, bool pushforce) | 613 | public override void AddForce(OMV.Vector3 force, bool pushforce) |
619 | { | 614 | { |
620 | // Since this force is being applied in only one step, make this a force per second. | 615 | // Since this force is being applied in only one step, make this a force per second. |
621 | OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep; | 616 | OMV.Vector3 addForce = force / PhysScene.LastTimeStep; |
622 | AddForce(addForce, pushforce, false); | 617 | AddForce(addForce, pushforce, false); |
623 | } | 618 | } |
624 | private void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { | 619 | private void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { |
@@ -627,13 +622,13 @@ public sealed class BSCharacter : BSPhysObject | |||
627 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); | 622 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); |
628 | // DetailLog("{0},BSCharacter.addForce,call,force={1}", LocalID, addForce); | 623 | // DetailLog("{0},BSCharacter.addForce,call,force={1}", LocalID, addForce); |
629 | 624 | ||
630 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.AddForce", delegate() | 625 | PhysScene.TaintedObject(inTaintTime, "BSCharacter.AddForce", delegate() |
631 | { | 626 | { |
632 | // Bullet adds this central force to the total force for this tick | 627 | // Bullet adds this central force to the total force for this tick |
633 | // DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce); | 628 | // DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce); |
634 | if (PhysBody.HasPhysicalBody) | 629 | if (PhysBody.HasPhysicalBody) |
635 | { | 630 | { |
636 | PhysicsScene.PE.ApplyCentralForce(PhysBody, addForce); | 631 | PhysScene.PE.ApplyCentralForce(PhysBody, addForce); |
637 | } | 632 | } |
638 | }); | 633 | }); |
639 | } | 634 | } |
@@ -652,7 +647,7 @@ public sealed class BSCharacter : BSPhysObject | |||
652 | private OMV.Vector3 ComputeAvatarScale(OMV.Vector3 size) | 647 | private OMV.Vector3 ComputeAvatarScale(OMV.Vector3 size) |
653 | { | 648 | { |
654 | OMV.Vector3 newScale; | 649 | OMV.Vector3 newScale; |
655 | 650 | ||
656 | // Bullet's capsule total height is the "passed height + radius * 2"; | 651 | // Bullet's capsule total height is the "passed height + radius * 2"; |
657 | // The base capsule is 1 diameter and 2 height (passed radius=0.5, passed height = 1) | 652 | // The base capsule is 1 diameter and 2 height (passed radius=0.5, passed height = 1) |
658 | // The number we pass in for 'scaling' is the multiplier to get that base | 653 | // The number we pass in for 'scaling' is the multiplier to get that base |