diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 9ced61fa..8dd48ca 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -111,8 +111,8 @@ public sealed class BSPrim : BSPhysObject | |||
111 | _mass = CalculateMass(); | 111 | _mass = CalculateMass(); |
112 | 112 | ||
113 | // No body or shape yet | 113 | // No body or shape yet |
114 | BSBody = new BulletBody(LocalID, IntPtr.Zero); | 114 | PhysBody = new BulletBody(LocalID, IntPtr.Zero); |
115 | BSShape = new BulletShape(IntPtr.Zero); | 115 | PhysShape = new BulletShape(IntPtr.Zero); |
116 | 116 | ||
117 | DetailLog("{0},BSPrim.constructor,call", LocalID); | 117 | DetailLog("{0},BSPrim.constructor,call", LocalID); |
118 | // do the actual object creation at taint time | 118 | // do the actual object creation at taint time |
@@ -120,7 +120,7 @@ public sealed class BSPrim : BSPhysObject | |||
120 | { | 120 | { |
121 | CreateGeomAndObject(true); | 121 | CreateGeomAndObject(true); |
122 | 122 | ||
123 | CurrentCollisionFlags = BulletSimAPI.GetCollisionFlags2(BSBody.ptr); | 123 | CurrentCollisionFlags = BulletSimAPI.GetCollisionFlags2(PhysBody.ptr); |
124 | }); | 124 | }); |
125 | } | 125 | } |
126 | 126 | ||
@@ -145,8 +145,8 @@ public sealed class BSPrim : BSPhysObject | |||
145 | { | 145 | { |
146 | DetailLog("{0},BSPrim.Destroy,taint,", LocalID); | 146 | DetailLog("{0},BSPrim.Destroy,taint,", LocalID); |
147 | // If there are physical body and shape, release my use of same. | 147 | // If there are physical body and shape, release my use of same. |
148 | PhysicsScene.Shapes.DereferenceBody(BSBody, true, null); | 148 | PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null); |
149 | PhysicsScene.Shapes.DereferenceShape(BSShape, true, null); | 149 | PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null); |
150 | }); | 150 | }); |
151 | } | 151 | } |
152 | 152 | ||
@@ -243,7 +243,7 @@ public sealed class BSPrim : BSPhysObject | |||
243 | _rotationalVelocity = OMV.Vector3.Zero; | 243 | _rotationalVelocity = OMV.Vector3.Zero; |
244 | 244 | ||
245 | // Zero some other properties in the physics engine | 245 | // Zero some other properties in the physics engine |
246 | BulletSimAPI.ClearAllForces2(BSBody.ptr); | 246 | BulletSimAPI.ClearAllForces2(PhysBody.ptr); |
247 | } | 247 | } |
248 | 248 | ||
249 | public override void LockAngularMotion(OMV.Vector3 axis) | 249 | public override void LockAngularMotion(OMV.Vector3 axis) |
@@ -256,7 +256,7 @@ public sealed class BSPrim : BSPhysObject | |||
256 | get { | 256 | get { |
257 | if (!Linkset.IsRoot(this)) | 257 | if (!Linkset.IsRoot(this)) |
258 | // child prims move around based on their parent. Need to get the latest location | 258 | // child prims move around based on their parent. Need to get the latest location |
259 | _position = BulletSimAPI.GetPosition2(BSBody.ptr); | 259 | _position = BulletSimAPI.GetPosition2(PhysBody.ptr); |
260 | 260 | ||
261 | // don't do the GetObjectPosition for root elements because this function is called a zillion times | 261 | // don't do the GetObjectPosition for root elements because this function is called a zillion times |
262 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); | 262 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); |
@@ -274,20 +274,20 @@ public sealed class BSPrim : BSPhysObject | |||
274 | PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() | 274 | PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() |
275 | { | 275 | { |
276 | // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 276 | // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
277 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 277 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
278 | ActivateIfPhysical(false); | 278 | ActivateIfPhysical(false); |
279 | }); | 279 | }); |
280 | } | 280 | } |
281 | } | 281 | } |
282 | public override OMV.Vector3 ForcePosition { | 282 | public override OMV.Vector3 ForcePosition { |
283 | get { | 283 | get { |
284 | _position = BulletSimAPI.GetPosition2(BSBody.ptr); | 284 | _position = BulletSimAPI.GetPosition2(PhysBody.ptr); |
285 | return _position; | 285 | return _position; |
286 | } | 286 | } |
287 | set { | 287 | set { |
288 | _position = value; | 288 | _position = value; |
289 | PositionSanityCheck(); | 289 | PositionSanityCheck(); |
290 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 290 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
291 | ActivateIfPhysical(false); | 291 | ActivateIfPhysical(false); |
292 | } | 292 | } |
293 | } | 293 | } |
@@ -371,15 +371,15 @@ public sealed class BSPrim : BSPhysObject | |||
371 | { | 371 | { |
372 | if (IsStatic) | 372 | if (IsStatic) |
373 | { | 373 | { |
374 | BulletSimAPI.SetMassProps2(BSBody.ptr, 0f, OMV.Vector3.Zero); | 374 | BulletSimAPI.SetMassProps2(PhysBody.ptr, 0f, OMV.Vector3.Zero); |
375 | BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr); | 375 | BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); |
376 | } | 376 | } |
377 | else | 377 | else |
378 | { | 378 | { |
379 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, physMass); | 379 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); |
380 | BulletSimAPI.SetMassProps2(BSBody.ptr, physMass, localInertia); | 380 | BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia); |
381 | // center of mass is at the zero of the object | 381 | // center of mass is at the zero of the object |
382 | BulletSimAPI.SetCenterOfMassByPosRot2(BSBody.ptr, ForcePosition, ForceOrientation); | 382 | BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation); |
383 | // BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr); | 383 | // BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr); |
384 | DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, localInertia); | 384 | DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, localInertia); |
385 | } | 385 | } |
@@ -404,7 +404,7 @@ public sealed class BSPrim : BSPhysObject | |||
404 | PhysicsScene.TaintedObject("BSPrim.setForce", delegate() | 404 | PhysicsScene.TaintedObject("BSPrim.setForce", delegate() |
405 | { | 405 | { |
406 | // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); | 406 | // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); |
407 | BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); | 407 | BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); |
408 | }); | 408 | }); |
409 | } | 409 | } |
410 | } | 410 | } |
@@ -498,7 +498,7 @@ public sealed class BSPrim : BSPhysObject | |||
498 | PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate() | 498 | PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate() |
499 | { | 499 | { |
500 | // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); | 500 | // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); |
501 | BulletSimAPI.SetLinearVelocity2(BSBody.ptr, _velocity); | 501 | BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); |
502 | }); | 502 | }); |
503 | } | 503 | } |
504 | } | 504 | } |
@@ -506,7 +506,7 @@ public sealed class BSPrim : BSPhysObject | |||
506 | get { return _velocity; } | 506 | get { return _velocity; } |
507 | set { | 507 | set { |
508 | _velocity = value; | 508 | _velocity = value; |
509 | BulletSimAPI.SetLinearVelocity2(BSBody.ptr, _velocity); | 509 | BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | public override OMV.Vector3 Torque { | 512 | public override OMV.Vector3 Torque { |
@@ -531,7 +531,7 @@ public sealed class BSPrim : BSPhysObject | |||
531 | if (!Linkset.IsRoot(this)) | 531 | if (!Linkset.IsRoot(this)) |
532 | { | 532 | { |
533 | // Children move around because tied to parent. Get a fresh value. | 533 | // Children move around because tied to parent. Get a fresh value. |
534 | _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr); | 534 | _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr); |
535 | } | 535 | } |
536 | return _orientation; | 536 | return _orientation; |
537 | } | 537 | } |
@@ -544,7 +544,7 @@ public sealed class BSPrim : BSPhysObject | |||
544 | { | 544 | { |
545 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); | 545 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); |
546 | // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 546 | // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
547 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 547 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
548 | }); | 548 | }); |
549 | } | 549 | } |
550 | } | 550 | } |
@@ -553,13 +553,13 @@ public sealed class BSPrim : BSPhysObject | |||
553 | { | 553 | { |
554 | get | 554 | get |
555 | { | 555 | { |
556 | _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr); | 556 | _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr); |
557 | return _orientation; | 557 | return _orientation; |
558 | } | 558 | } |
559 | set | 559 | set |
560 | { | 560 | { |
561 | _orientation = value; | 561 | _orientation = value; |
562 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 562 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
563 | } | 563 | } |
564 | } | 564 | } |
565 | public override int PhysicsActorType { | 565 | public override int PhysicsActorType { |
@@ -615,7 +615,7 @@ public sealed class BSPrim : BSPhysObject | |||
615 | 615 | ||
616 | // Mangling all the physical properties requires the object not be in the physical world. | 616 | // Mangling all the physical properties requires the object not be in the physical world. |
617 | // This is a NOOP if the object is not in the world (BulletSim and Bullet ignore objects not found). | 617 | // This is a NOOP if the object is not in the world (BulletSim and Bullet ignore objects not found). |
618 | BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, BSBody.ptr); | 618 | BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); |
619 | 619 | ||
620 | // Set up the object physicalness (does gravity and collisions move this object) | 620 | // Set up the object physicalness (does gravity and collisions move this object) |
621 | MakeDynamic(IsStatic); | 621 | MakeDynamic(IsStatic); |
@@ -629,15 +629,15 @@ public sealed class BSPrim : BSPhysObject | |||
629 | // Make solid or not (do things bounce off or pass through this object). | 629 | // Make solid or not (do things bounce off or pass through this object). |
630 | MakeSolid(IsSolid); | 630 | MakeSolid(IsSolid); |
631 | 631 | ||
632 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr); | 632 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); |
633 | 633 | ||
634 | // Rebuild its shape | 634 | // Rebuild its shape |
635 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr); | 635 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); |
636 | 636 | ||
637 | // Collision filter can be set only when the object is in the world | 637 | // Collision filter can be set only when the object is in the world |
638 | if (BSBody.collisionFilter != 0 || BSBody.collisionMask != 0) | 638 | if (PhysBody.collisionFilter != 0 || PhysBody.collisionMask != 0) |
639 | { | 639 | { |
640 | BulletSimAPI.SetCollisionFilterMask2(BSBody.ptr, (uint)BSBody.collisionFilter, (uint)BSBody.collisionMask); | 640 | BulletSimAPI.SetCollisionFilterMask2(PhysBody.ptr, (uint)PhysBody.collisionFilter, (uint)PhysBody.collisionMask); |
641 | } | 641 | } |
642 | 642 | ||
643 | // Recompute any linkset parameters. | 643 | // Recompute any linkset parameters. |
@@ -646,7 +646,7 @@ public sealed class BSPrim : BSPhysObject | |||
646 | Linkset.Refresh(this); | 646 | Linkset.Refresh(this); |
647 | 647 | ||
648 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", | 648 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", |
649 | LocalID, IsStatic, IsSolid, _mass, SubscribedEvents(), CurrentCollisionFlags, BSBody, BSShape); | 649 | LocalID, IsStatic, IsSolid, _mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody, PhysShape); |
650 | } | 650 | } |
651 | 651 | ||
652 | // "Making dynamic" means changing to and from static. | 652 | // "Making dynamic" means changing to and from static. |
@@ -659,44 +659,44 @@ public sealed class BSPrim : BSPhysObject | |||
659 | if (makeStatic) | 659 | if (makeStatic) |
660 | { | 660 | { |
661 | // Become a Bullet 'static' object type | 661 | // Become a Bullet 'static' object type |
662 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_STATIC_OBJECT); | 662 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT); |
663 | // Stop all movement | 663 | // Stop all movement |
664 | ZeroMotion(); | 664 | ZeroMotion(); |
665 | // Center of mass is at the center of the object | 665 | // Center of mass is at the center of the object |
666 | BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.BSBody.ptr, _position, _orientation); | 666 | BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody.ptr, _position, _orientation); |
667 | // Mass is zero which disables a bunch of physics stuff in Bullet | 667 | // Mass is zero which disables a bunch of physics stuff in Bullet |
668 | UpdatePhysicalMassProperties(0f); | 668 | UpdatePhysicalMassProperties(0f); |
669 | // Set collision detection parameters | 669 | // Set collision detection parameters |
670 | if (PhysicsScene.Params.ccdMotionThreshold > 0f) | 670 | if (PhysicsScene.Params.ccdMotionThreshold > 0f) |
671 | { | 671 | { |
672 | BulletSimAPI.SetCcdMotionThreshold2(BSBody.ptr, PhysicsScene.Params.ccdMotionThreshold); | 672 | BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, PhysicsScene.Params.ccdMotionThreshold); |
673 | BulletSimAPI.SetCcdSweptSphereRadius2(BSBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); | 673 | BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); |
674 | } | 674 | } |
675 | // There can be special things needed for implementing linksets | 675 | // There can be special things needed for implementing linksets |
676 | Linkset.MakeStatic(this); | 676 | Linkset.MakeStatic(this); |
677 | // The activation state is 'disabled' so Bullet will not try to act on it. | 677 | // The activation state is 'disabled' so Bullet will not try to act on it. |
678 | BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_SIMULATION); | 678 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_SIMULATION); |
679 | // Start it out sleeping and physical actions could wake it up. | 679 | // Start it out sleeping and physical actions could wake it up. |
680 | // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ISLAND_SLEEPING); | 680 | // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ISLAND_SLEEPING); |
681 | 681 | ||
682 | BSBody.collisionFilter = CollisionFilterGroups.StaticObjectFilter; | 682 | PhysBody.collisionFilter = CollisionFilterGroups.StaticObjectFilter; |
683 | BSBody.collisionMask = CollisionFilterGroups.StaticObjectMask; | 683 | PhysBody.collisionMask = CollisionFilterGroups.StaticObjectMask; |
684 | } | 684 | } |
685 | else | 685 | else |
686 | { | 686 | { |
687 | // Not a Bullet static object | 687 | // Not a Bullet static object |
688 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.CF_STATIC_OBJECT); | 688 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT); |
689 | 689 | ||
690 | // Set various physical properties so internal dynamic properties will get computed correctly as they are set | 690 | // Set various physical properties so internal dynamic properties will get computed correctly as they are set |
691 | BulletSimAPI.SetFriction2(BSBody.ptr, PhysicsScene.Params.defaultFriction); | 691 | BulletSimAPI.SetFriction2(PhysBody.ptr, PhysicsScene.Params.defaultFriction); |
692 | BulletSimAPI.SetRestitution2(BSBody.ptr, PhysicsScene.Params.defaultRestitution); | 692 | BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.defaultRestitution); |
693 | 693 | ||
694 | // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382 | 694 | // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382 |
695 | // Since this can be called multiple times, only zero forces when becoming physical | 695 | // Since this can be called multiple times, only zero forces when becoming physical |
696 | // BulletSimAPI.ClearAllForces2(BSBody.ptr); | 696 | // BulletSimAPI.ClearAllForces2(BSBody.ptr); |
697 | 697 | ||
698 | // For good measure, make sure the transform is set through to the motion state | 698 | // For good measure, make sure the transform is set through to the motion state |
699 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 699 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
700 | 700 | ||
701 | // A dynamic object has mass | 701 | // A dynamic object has mass |
702 | UpdatePhysicalMassProperties(MassRaw); | 702 | UpdatePhysicalMassProperties(MassRaw); |
@@ -704,26 +704,26 @@ public sealed class BSPrim : BSPhysObject | |||
704 | // Set collision detection parameters | 704 | // Set collision detection parameters |
705 | if (PhysicsScene.Params.ccdMotionThreshold > 0f) | 705 | if (PhysicsScene.Params.ccdMotionThreshold > 0f) |
706 | { | 706 | { |
707 | BulletSimAPI.SetCcdMotionThreshold2(BSBody.ptr, PhysicsScene.Params.ccdMotionThreshold); | 707 | BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, PhysicsScene.Params.ccdMotionThreshold); |
708 | BulletSimAPI.SetCcdSweptSphereRadius2(BSBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); | 708 | BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); |
709 | } | 709 | } |
710 | 710 | ||
711 | // Various values for simulation limits | 711 | // Various values for simulation limits |
712 | BulletSimAPI.SetDamping2(BSBody.ptr, PhysicsScene.Params.linearDamping, PhysicsScene.Params.angularDamping); | 712 | BulletSimAPI.SetDamping2(PhysBody.ptr, PhysicsScene.Params.linearDamping, PhysicsScene.Params.angularDamping); |
713 | BulletSimAPI.SetDeactivationTime2(BSBody.ptr, PhysicsScene.Params.deactivationTime); | 713 | BulletSimAPI.SetDeactivationTime2(PhysBody.ptr, PhysicsScene.Params.deactivationTime); |
714 | BulletSimAPI.SetSleepingThresholds2(BSBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold); | 714 | BulletSimAPI.SetSleepingThresholds2(PhysBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold); |
715 | BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold); | 715 | BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, PhysicsScene.Params.contactProcessingThreshold); |
716 | 716 | ||
717 | // There might be special things needed for implementing linksets. | 717 | // There might be special things needed for implementing linksets. |
718 | Linkset.MakeDynamic(this); | 718 | Linkset.MakeDynamic(this); |
719 | 719 | ||
720 | // Force activation of the object so Bullet will act on it. | 720 | // Force activation of the object so Bullet will act on it. |
721 | // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects. | 721 | // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects. |
722 | BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); | 722 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ACTIVE_TAG); |
723 | // BulletSimAPI.Activate2(BSBody.ptr, true); | 723 | // BulletSimAPI.Activate2(BSBody.ptr, true); |
724 | 724 | ||
725 | BSBody.collisionFilter = CollisionFilterGroups.ObjectFilter; | 725 | PhysBody.collisionFilter = CollisionFilterGroups.ObjectFilter; |
726 | BSBody.collisionMask = CollisionFilterGroups.ObjectMask; | 726 | PhysBody.collisionMask = CollisionFilterGroups.ObjectMask; |
727 | } | 727 | } |
728 | } | 728 | } |
729 | 729 | ||
@@ -733,7 +733,7 @@ public sealed class BSPrim : BSPhysObject | |||
733 | // the functions after this one set up the state of a possibly newly created collision body. | 733 | // the functions after this one set up the state of a possibly newly created collision body. |
734 | private void MakeSolid(bool makeSolid) | 734 | private void MakeSolid(bool makeSolid) |
735 | { | 735 | { |
736 | CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(BSBody.ptr); | 736 | CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(PhysBody.ptr); |
737 | if (makeSolid) | 737 | if (makeSolid) |
738 | { | 738 | { |
739 | // Verify the previous code created the correct shape for this type of thing. | 739 | // Verify the previous code created the correct shape for this type of thing. |
@@ -741,7 +741,7 @@ public sealed class BSPrim : BSPhysObject | |||
741 | { | 741 | { |
742 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for solidity. id={1}, type={2}", LogHeader, LocalID, bodyType); | 742 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for solidity. id={1}, type={2}", LogHeader, LocalID, bodyType); |
743 | } | 743 | } |
744 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); | 744 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); |
745 | } | 745 | } |
746 | else | 746 | else |
747 | { | 747 | { |
@@ -749,9 +749,9 @@ public sealed class BSPrim : BSPhysObject | |||
749 | { | 749 | { |
750 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); | 750 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); |
751 | } | 751 | } |
752 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); | 752 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); |
753 | BSBody.collisionFilter = CollisionFilterGroups.VolumeDetectFilter; | 753 | PhysBody.collisionFilter = CollisionFilterGroups.VolumeDetectFilter; |
754 | BSBody.collisionMask = CollisionFilterGroups.VolumeDetectMask; | 754 | PhysBody.collisionMask = CollisionFilterGroups.VolumeDetectMask; |
755 | } | 755 | } |
756 | } | 756 | } |
757 | 757 | ||
@@ -761,7 +761,7 @@ public sealed class BSPrim : BSPhysObject | |||
761 | private void ActivateIfPhysical(bool forceIt) | 761 | private void ActivateIfPhysical(bool forceIt) |
762 | { | 762 | { |
763 | if (IsPhysical) | 763 | if (IsPhysical) |
764 | BulletSimAPI.Activate2(BSBody.ptr, forceIt); | 764 | BulletSimAPI.Activate2(PhysBody.ptr, forceIt); |
765 | } | 765 | } |
766 | 766 | ||
767 | // Turn on or off the flag controlling whether collision events are returned to the simulator. | 767 | // Turn on or off the flag controlling whether collision events are returned to the simulator. |
@@ -769,11 +769,11 @@ public sealed class BSPrim : BSPhysObject | |||
769 | { | 769 | { |
770 | if (wantsCollisionEvents) | 770 | if (wantsCollisionEvents) |
771 | { | 771 | { |
772 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | 772 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); |
773 | } | 773 | } |
774 | else | 774 | else |
775 | { | 775 | { |
776 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | 776 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); |
777 | } | 777 | } |
778 | } | 778 | } |
779 | 779 | ||
@@ -818,9 +818,9 @@ public sealed class BSPrim : BSPhysObject | |||
818 | PhysicsScene.TaintedObject("BSPrim.setFloatOnWater", delegate() | 818 | PhysicsScene.TaintedObject("BSPrim.setFloatOnWater", delegate() |
819 | { | 819 | { |
820 | if (_floatOnWater) | 820 | if (_floatOnWater) |
821 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); | 821 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); |
822 | else | 822 | else |
823 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); | 823 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); |
824 | }); | 824 | }); |
825 | } | 825 | } |
826 | } | 826 | } |
@@ -843,7 +843,7 @@ public sealed class BSPrim : BSPhysObject | |||
843 | PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() | 843 | PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() |
844 | { | 844 | { |
845 | DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); | 845 | DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); |
846 | BulletSimAPI.SetAngularVelocity2(BSBody.ptr, _rotationalVelocity); | 846 | BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); |
847 | }); | 847 | }); |
848 | } | 848 | } |
849 | } | 849 | } |
@@ -853,7 +853,7 @@ public sealed class BSPrim : BSPhysObject | |||
853 | } | 853 | } |
854 | set { | 854 | set { |
855 | _rotationalVelocity = value; | 855 | _rotationalVelocity = value; |
856 | BulletSimAPI.SetAngularVelocity2(BSBody.ptr, _rotationalVelocity); | 856 | BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); |
857 | } | 857 | } |
858 | } | 858 | } |
859 | public override bool Kinematic { | 859 | public override bool Kinematic { |
@@ -879,7 +879,7 @@ public sealed class BSPrim : BSPhysObject | |||
879 | // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 879 | // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
880 | // Buoyancy is faked by changing the gravity applied to the object | 880 | // Buoyancy is faked by changing the gravity applied to the object |
881 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); | 881 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); |
882 | BulletSimAPI.SetGravity2(BSBody.ptr, new OMV.Vector3(0f, 0f, grav)); | 882 | BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); |
883 | } | 883 | } |
884 | } | 884 | } |
885 | 885 | ||
@@ -946,7 +946,7 @@ public sealed class BSPrim : BSPhysObject | |||
946 | } | 946 | } |
947 | DetailLog("{0},BSPrim.AddForce,taint,force={1}", LocalID, fSum); | 947 | DetailLog("{0},BSPrim.AddForce,taint,force={1}", LocalID, fSum); |
948 | if (fSum != OMV.Vector3.Zero) | 948 | if (fSum != OMV.Vector3.Zero) |
949 | BulletSimAPI.ApplyCentralForce2(BSBody.ptr, fSum); | 949 | BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, fSum); |
950 | }; | 950 | }; |
951 | if (inTaintTime) | 951 | if (inTaintTime) |
952 | addForceOperation(); | 952 | addForceOperation(); |
@@ -986,7 +986,7 @@ public sealed class BSPrim : BSPhysObject | |||
986 | DetailLog("{0},BSPrim.AddAngularForce,taint,aForce={1}", LocalID, fSum); | 986 | DetailLog("{0},BSPrim.AddAngularForce,taint,aForce={1}", LocalID, fSum); |
987 | if (fSum != OMV.Vector3.Zero) | 987 | if (fSum != OMV.Vector3.Zero) |
988 | { | 988 | { |
989 | BulletSimAPI.ApplyTorque2(BSBody.ptr, fSum); | 989 | BulletSimAPI.ApplyTorque2(PhysBody.ptr, fSum); |
990 | _torque = fSum; | 990 | _torque = fSum; |
991 | } | 991 | } |
992 | }; | 992 | }; |
@@ -1002,7 +1002,7 @@ public sealed class BSPrim : BSPhysObject | |||
1002 | BSScene.TaintCallback applyTorqueImpulseOperation = delegate() | 1002 | BSScene.TaintCallback applyTorqueImpulseOperation = delegate() |
1003 | { | 1003 | { |
1004 | DetailLog("{0},BSPrim.ApplyTorqueImpulse,taint,tImpulse={1}", LocalID, applyImpulse); | 1004 | DetailLog("{0},BSPrim.ApplyTorqueImpulse,taint,tImpulse={1}", LocalID, applyImpulse); |
1005 | BulletSimAPI.ApplyTorqueImpulse2(BSBody.ptr, applyImpulse); | 1005 | BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse); |
1006 | }; | 1006 | }; |
1007 | if (inTaintTime) | 1007 | if (inTaintTime) |
1008 | applyTorqueImpulseOperation(); | 1008 | applyTorqueImpulseOperation(); |