aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs18
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs12
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs14
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs6
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs98
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs8
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs450
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
13 files changed, 580 insertions, 77 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d94d5ef..3af1060 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -123,6 +123,11 @@ namespace OpenSim.Region.Framework.Scenes
123 /// </summary> 123 /// </summary>
124 public float m_maxPhys = 10; 124 public float m_maxPhys = 10;
125 125
126 /// <summary>
127 /// Max prims an object will hold
128 /// </summary>
129 public int m_linksetCapacity = 0;
130
126 public bool m_clampPrimSize; 131 public bool m_clampPrimSize;
127 public bool m_trustBinaries; 132 public bool m_trustBinaries;
128 public bool m_allowScriptCrossings; 133 public bool m_allowScriptCrossings;
@@ -789,6 +794,12 @@ namespace OpenSim.Region.Framework.Scenes
789 m_maxPhys = RegionInfo.PhysPrimMax; 794 m_maxPhys = RegionInfo.PhysPrimMax;
790 } 795 }
791 796
797 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
798 if (RegionInfo.LinksetCapacity > 0)
799 {
800 m_linksetCapacity = RegionInfo.LinksetCapacity;
801 }
802
792 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); 803 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
793 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); 804 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
794 805
@@ -4563,6 +4574,16 @@ namespace OpenSim.Region.Framework.Scenes
4563 return LandChannel.GetLandObject(x, y).LandData; 4574 return LandChannel.GetLandObject(x, y).LandData;
4564 } 4575 }
4565 4576
4577 /// <summary>
4578 /// Get LandData by position.
4579 /// </summary>
4580 /// <param name="pos"></param>
4581 /// <returns></returns>
4582 public LandData GetLandData(Vector3 pos)
4583 {
4584 return GetLandData(pos.X, pos.Y);
4585 }
4586
4566 public LandData GetLandData(uint x, uint y) 4587 public LandData GetLandData(uint x, uint y)
4567 { 4588 {
4568 m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); 4589 m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0448c25..38dbaa9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2738,6 +2738,24 @@ namespace OpenSim.Region.Framework.Scenes
2738 if (objectGroup == this) 2738 if (objectGroup == this)
2739 return; 2739 return;
2740 2740
2741 // If the configured linkset capacity is greater than zero,
2742 // and the new linkset would have a prim count higher than this
2743 // value, do not link it.
2744 if (m_scene.m_linksetCapacity > 0 &&
2745 (PrimCount + objectGroup.PrimCount) >
2746 m_scene.m_linksetCapacity)
2747 {
2748 m_log.DebugFormat(
2749 "[SCENE OBJECT GROUP]: Cannot link group with root" +
2750 " part {0}, {1} ({2} prims) to group with root part" +
2751 " {3}, {4} ({5} prims) because the new linkset" +
2752 " would exceed the configured maximum of {6}",
2753 objectGroup.RootPart.Name, objectGroup.RootPart.UUID,
2754 objectGroup.PrimCount, RootPart.Name, RootPart.UUID,
2755 PrimCount, m_scene.m_linksetCapacity);
2756 return;
2757 }
2758
2741 // 'linkPart' == the root of the group being linked into this group 2759 // 'linkPart' == the root of the group being linked into this group
2742 SceneObjectPart linkPart = objectGroup.m_rootPart; 2760 SceneObjectPart linkPart = objectGroup.m_rootPart;
2743 2761
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 7b20446..f292a75 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -447,7 +447,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
447 // settings allow voice, then whether parcel allows 447 // settings allow voice, then whether parcel allows
448 // voice, if all do retrieve or obtain the parcel 448 // voice, if all do retrieve or obtain the parcel
449 // voice channel 449 // voice channel
450 LandData land = scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 450 LandData land = scene.GetLandData(avatar.AbsolutePosition);
451 451
452 //m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}", 452 //m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}",
453 // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param); 453 // scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param);
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
index a30a38d..8a8a31c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
@@ -623,7 +623,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
623 // settings allow voice, then whether parcel allows 623 // settings allow voice, then whether parcel allows
624 // voice, if all do retrieve or obtain the parcel 624 // voice, if all do retrieve or obtain the parcel
625 // voice channel 625 // voice channel
626 LandData land = scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 626 LandData land = scene.GetLandData(avatar.AbsolutePosition);
627 627
628// m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}", 628// m_log.DebugFormat("[VivoxVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": request: {4}, path: {5}, param: {6}",
629// scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param); 629// scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, request, path, param);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 747ae71..fa22c78 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -73,7 +73,8 @@ public class BSCharacter : BSPhysObject
73 private bool _kinematic; 73 private bool _kinematic;
74 private float _buoyancy; 74 private float _buoyancy;
75 75
76 public override BulletBody Body { get; set; } 76 public override BulletBody BSBody { get; set; }
77 public override BulletShape BSShape { get; set; }
77 public override BSLinkset Linkset { get; set; } 78 public override BSLinkset Linkset { get; set; }
78 79
79 private int _subscribedEventsMs = 0; 80 private int _subscribedEventsMs = 0;
@@ -92,6 +93,7 @@ public class BSCharacter : BSPhysObject
92 _localID = localID; 93 _localID = localID;
93 _avName = avName; 94 _avName = avName;
94 Scene = parent_scene; 95 Scene = parent_scene;
96 _physicsActorType = (int)ActorTypes.Agent;
95 _position = pos; 97 _position = pos;
96 _size = size; 98 _size = size;
97 _flying = isFlying; 99 _flying = isFlying;
@@ -128,9 +130,9 @@ public class BSCharacter : BSPhysObject
128 // Set the buoyancy for flying. This will be refactored when all the settings happen in C# 130 // Set the buoyancy for flying. This will be refactored when all the settings happen in C#
129 BulletSimAPI.SetObjectBuoyancy(Scene.WorldID, LocalID, _buoyancy); 131 BulletSimAPI.SetObjectBuoyancy(Scene.WorldID, LocalID, _buoyancy);
130 132
131 Body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(Scene.World.Ptr, LocalID)); 133 BSBody = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(Scene.World.Ptr, LocalID));
132 // avatars get all collisions no matter what (makes walking on ground and such work) 134 // avatars get all collisions no matter what (makes walking on ground and such work)
133 BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 135 BulletSimAPI.AddToCollisionFlags2(BSBody.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
134 }); 136 });
135 137
136 return; 138 return;
@@ -440,7 +442,7 @@ public class BSCharacter : BSPhysObject
440 Scene.TaintedObject("BSCharacter.AddForce", delegate() 442 Scene.TaintedObject("BSCharacter.AddForce", delegate()
441 { 443 {
442 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force); 444 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force);
443 BulletSimAPI.AddObjectForce2(Body.Ptr, _force); 445 BulletSimAPI.SetObjectForce2(BSBody.Ptr, _force);
444 }); 446 });
445 } 447 }
446 else 448 else
@@ -465,7 +467,7 @@ public class BSCharacter : BSPhysObject
465 467
466 Scene.TaintedObject("BSCharacter.SubscribeEvents", delegate() 468 Scene.TaintedObject("BSCharacter.SubscribeEvents", delegate()
467 { 469 {
468 BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 470 BulletSimAPI.AddToCollisionFlags2(BSBody.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
469 }); 471 });
470 } 472 }
471 } 473 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs
index d9270d1..2e15ced 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs
@@ -98,6 +98,10 @@ public abstract class BSConstraint : IDisposable
98 { 98 {
99 // m_world.scene.PhysicsLogging.Write("{0},BSConstraint.RecomputeConstraintVariables,taint,enabling,A={1},B={2}", 99 // m_world.scene.PhysicsLogging.Write("{0},BSConstraint.RecomputeConstraintVariables,taint,enabling,A={1},B={2}",
100 // BSScene.DetailLogZero, Body1.ID, Body2.ID); 100 // BSScene.DetailLogZero, Body1.ID, Body2.ID);
101
102 // Setting an object's mass to zero (making it static like when it's selected)
103 // automatically disables the constraints.
104 // If enabled, be sure to set the constraint itself to enabled.
101 BulletSimAPI.SetConstraintEnable2(m_constraint.Ptr, m_world.scene.NumericBool(true)); 105 BulletSimAPI.SetConstraintEnable2(m_constraint.Ptr, m_world.scene.NumericBool(true));
102 } 106 }
103 else 107 else
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index b04e1b6..5f6601d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -233,7 +233,7 @@ public class BSLinkset
233 foreach (BSPhysObject child in m_children) 233 foreach (BSPhysObject child in m_children)
234 { 234 {
235 BSConstraint constrain; 235 BSConstraint constrain;
236 if (m_physicsScene.Constraints.TryGetConstraint(LinksetRoot.Body, child.Body, out constrain)) 236 if (m_physicsScene.Constraints.TryGetConstraint(LinksetRoot.BSBody, child.BSBody, out constrain))
237 { 237 {
238 // DetailLog("{0},BSLinkset.RecomputeLinksetConstraintVariables,taint,child={1},mass={2},A={3},B={4}", 238 // DetailLog("{0},BSLinkset.RecomputeLinksetConstraintVariables,taint,child={1},mass={2},A={3},B={4}",
239 // LinksetRoot.LocalID, child.LocalID, linksetMass, constrain.Body1.ID, constrain.Body2.ID); 239 // LinksetRoot.LocalID, child.LocalID, linksetMass, constrain.Body1.ID, constrain.Body2.ID);
@@ -245,8 +245,8 @@ public class BSLinkset
245 // their constraints have not been created yet. 245 // their constraints have not been created yet.
246 // Caused by the fact that m_children is built at run time but building constraints 246 // Caused by the fact that m_children is built at run time but building constraints
247 // happens at taint time. 247 // happens at taint time.
248 // m_physicsScene.Logger.ErrorFormat("[BULLETSIM LINKSET] RecomputeLinksetConstraintVariables: constraint not found for root={0}, child={1}", 248 // m_physicsScene.Logger.ErrorFormat("{0} RecomputeLinksetConstraintVariables: constraint not found for root={1}, child={2}",
249 // m_linksetRoot.Body.ID, child.Body.ID); 249 // LogHeader, m_linksetRoot.Body.ID, child.Body.ID);
250 } 250 }
251 } 251 }
252 } 252 }
@@ -327,7 +327,7 @@ public class BSLinkset
327 DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},child={2},rLoc={3},cLoc={4},midLoc={5}", 327 DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},child={2},rLoc={3},cLoc={4},midLoc={5}",
328 rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID, rootPrim.Position, childPrim.Position, midPoint); 328 rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID, rootPrim.Position, childPrim.Position, midPoint);
329 BS6DofConstraint constrain = new BS6DofConstraint( 329 BS6DofConstraint constrain = new BS6DofConstraint(
330 m_physicsScene.World, rootPrim.Body, childPrim.Body, 330 m_physicsScene.World, rootPrim.BSBody, childPrim.BSBody,
331 midPoint, 331 midPoint,
332 true, 332 true,
333 true 333 true
@@ -388,10 +388,10 @@ public class BSLinkset
388 DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID); 388 DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID);
389 389
390 // Find the constraint for this link and get rid of it from the overall collection and from my list 390 // Find the constraint for this link and get rid of it from the overall collection and from my list
391 m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.Body, childPrim.Body); 391 m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.BSBody, childPrim.BSBody);
392 392
393 // Make the child refresh its location 393 // Make the child refresh its location
394 BulletSimAPI.PushUpdate2(childPrim.Body.Ptr); 394 BulletSimAPI.PushUpdate2(childPrim.BSBody.Ptr);
395 } 395 }
396 396
397 // Remove linkage between myself and any possible children I might have 397 // Remove linkage between myself and any possible children I might have
@@ -400,7 +400,7 @@ public class BSLinkset
400 { 400 {
401 DetailLog("{0},PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID); 401 DetailLog("{0},PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID);
402 402
403 m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.Body); 403 m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.BSBody);
404 } 404 }
405 405
406 // Invoke the detailed logger and output something if it's enabled. 406 // Invoke the detailed logger and output something if it's enabled.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index ef463ca..e411fcb 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -48,7 +48,11 @@ public abstract class BSPhysObject : PhysicsActor
48 // Return the object mass without calculating it or side effects 48 // Return the object mass without calculating it or side effects
49 public abstract float MassRaw { get; } 49 public abstract float MassRaw { get; }
50 50
51 public abstract BulletBody Body { get; set; } 51 // Reference to the physical body (btCollisionObject) of this object
52 public abstract BulletBody BSBody { get; set; }
53 // Reference to the physical shape (btCollisionShape) of this object
54 public abstract BulletShape BSShape { get; set; }
55
52 public abstract void ZeroMotion(); 56 public abstract void ZeroMotion();
53 57
54 public virtual void StepVehicle(float timeStep) { } 58 public virtual void StepVehicle(float timeStep) { }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 6bfce5c..6d0af63 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -94,8 +94,10 @@ public sealed class BSPrim : BSPhysObject
94 private int _nextCollisionOkTime = 0; 94 private int _nextCollisionOkTime = 0;
95 long _collidingStep; 95 long _collidingStep;
96 long _collidingGroundStep; 96 long _collidingGroundStep;
97 CollisionFlags m_currentCollisionFlags = 0;
97 98
98 public override BulletBody Body { get; set; } 99 public override BulletBody BSBody { get; set; }
100 public override BulletShape BSShape { get; set; }
99 101
100 private BSDynamics _vehicle; 102 private BSDynamics _vehicle;
101 103
@@ -113,6 +115,7 @@ public sealed class BSPrim : BSPhysObject
113 // m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID); 115 // m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID);
114 _localID = localID; 116 _localID = localID;
115 _avName = primName; 117 _avName = primName;
118 _physicsActorType = (int)ActorTypes.Prim;
116 _scene = parent_scene; 119 _scene = parent_scene;
117 _position = pos; 120 _position = pos;
118 _size = size; 121 _size = size;
@@ -142,7 +145,9 @@ public sealed class BSPrim : BSPhysObject
142 // Get the pointer to the physical body for this object. 145 // Get the pointer to the physical body for this object.
143 // At the moment, we're still letting BulletSim manage the creation and destruction 146 // At the moment, we're still letting BulletSim manage the creation and destruction
144 // of the object. Someday we'll move that into the C# code. 147 // of the object. Someday we'll move that into the C# code.
145 Body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID)); 148 BSBody = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID));
149 BSShape = new BulletShape(BulletSimAPI.GetCollisionShape2(BSBody.Ptr));
150 m_currentCollisionFlags = BulletSimAPI.GetCollisionFlags2(BSBody.Ptr);
146 }); 151 });
147 } 152 }
148 153
@@ -258,10 +263,10 @@ public sealed class BSPrim : BSPhysObject
258 _rotationalVelocity = OMV.Vector3.Zero; 263 _rotationalVelocity = OMV.Vector3.Zero;
259 264
260 // Zero some other properties directly into the physics engine 265 // Zero some other properties directly into the physics engine
261 BulletSimAPI.SetVelocity2(Body.Ptr, OMV.Vector3.Zero); 266 BulletSimAPI.SetLinearVelocity2(BSBody.Ptr, OMV.Vector3.Zero);
262 BulletSimAPI.SetAngularVelocity2(Body.Ptr, OMV.Vector3.Zero); 267 BulletSimAPI.SetAngularVelocity2(BSBody.Ptr, OMV.Vector3.Zero);
263 BulletSimAPI.SetInterpolation2(Body.Ptr, OMV.Vector3.Zero, OMV.Vector3.Zero); 268 BulletSimAPI.SetInterpolationVelocity2(BSBody.Ptr, OMV.Vector3.Zero, OMV.Vector3.Zero);
264 BulletSimAPI.ClearForces2(Body.Ptr); 269 BulletSimAPI.ClearForces2(BSBody.Ptr);
265 } 270 }
266 271
267 public override void LockAngularMotion(OMV.Vector3 axis) 272 public override void LockAngularMotion(OMV.Vector3 axis)
@@ -324,7 +329,7 @@ public sealed class BSPrim : BSPhysObject
324 { 329 {
325 DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); 330 DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force);
326 // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force); 331 // BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force);
327 BulletSimAPI.SetObjectForce2(Body.Ptr, _force); 332 BulletSimAPI.SetObjectForce2(BSBody.Ptr, _force);
328 }); 333 });
329 } 334 }
330 } 335 }
@@ -442,8 +447,7 @@ public sealed class BSPrim : BSPhysObject
442 } 447 }
443 public override int PhysicsActorType { 448 public override int PhysicsActorType {
444 get { return _physicsActorType; } 449 get { return _physicsActorType; }
445 set { _physicsActorType = value; 450 set { _physicsActorType = value; }
446 }
447 } 451 }
448 public override bool IsPhysical { 452 public override bool IsPhysical {
449 get { return _isPhysical; } 453 get { return _isPhysical; }
@@ -470,6 +474,11 @@ public sealed class BSPrim : BSPhysObject
470 474
471 // Make gravity work if the object is physical and not selected 475 // Make gravity work if the object is physical and not selected
472 // No locking here because only called when it is safe 476 // No locking here because only called when it is safe
477 // There are four flags we're interested in:
478 // IsStatic: Object does not move, otherwise the object has mass and moves
479 // isSolid: other objects bounce off of this object
480 // isVolumeDetect: other objects pass through but can generate collisions
481 // collisionEvents: whether this object returns collision events
473 private void SetObjectDynamic() 482 private void SetObjectDynamic()
474 { 483 {
475 // If it's becoming dynamic, it will need hullness 484 // If it's becoming dynamic, it will need hullness
@@ -479,12 +488,66 @@ public sealed class BSPrim : BSPhysObject
479 float mass = IsStatic ? 0f : _mass; 488 float mass = IsStatic ? 0f : _mass;
480 489
481 BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass); 490 BulletSimAPI.SetObjectProperties(_scene.WorldID, LocalID, IsStatic, IsSolid, SubscribedEvents(), mass);
491 /*
492 BulletSimAPI.RemoveObjectFromWorld2(Scene.World.Ptr, BSBody.Ptr);
493
494 // Set up the object physicalness (static or dynamic)
495 MakeDynamic();
496
497 // Make solid or not and arrange for collisions, etc
498 MakeSolid();
499
500 m_currentCollisionFlags = BulletSimAPI.GetCollisionFlags2(BSBody.Ptr);
482 501
483 // recompute any linkset parameters 502 BulletSimAPI.AddObjectToWorld2(Scene.World.Ptr, BSBody.Ptr);
503 */
504
505 // Recompute any linkset parameters.
506 // When going from non-physical to physical, this re-enables the constraints that
507 // had been automatically disabled when the mass was set to zero.
484 Linkset.Refresh(this); 508 Linkset.Refresh(this);
485 509
486 CollisionFlags cf = BulletSimAPI.GetCollisionFlags2(Body.Ptr); 510 DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, m_currentCollisionFlags);
487 DetailLog("{0},BSPrim.SetObjectDynamic,taint,static={1},solid={2},mass={3}, cf={4}", LocalID, IsStatic, IsSolid, mass, cf); 511 }
512
513 // "Making dynamic" means changing to and from static.
514 // When static, gravity does not effect the object and it is fixed in space.
515 // When dynamic, the object can fall and be pushed by others.
516 // This is independent of its 'solidness' which controls what passes through
517 // this object and what interacts with it.
518 private void MakeDynamic()
519 {
520 if (IsStatic)
521 {
522 // Become a Bullet 'static' object type
523 BulletSimAPI.AddToCollisionFlags2(BSBody.Ptr, CollisionFlags.CF_STATIC_OBJECT);
524 // Stop all movement
525 BulletSimAPI.ClearAllForces2(BSBody.Ptr);
526 // Mass is zero which disables a bunch of physics stuff in Bullet
527 BulletSimAPI.SetMassProps2(BSBody.Ptr, 0f, OMV.Vector3.Zero);
528 // There is no inertia in a static object
529 BulletSimAPI.UpdateInertiaTensor2(BSBody.Ptr);
530 // The activation state is 'sleeping' so Bullet will not try to act on it
531 BulletSimAPI.ForceActivationState2(BSBody.Ptr, ActivationState.ISLAND_SLEEPING);
532 }
533 else
534 {
535 // Not a Bullet static object
536 BulletSimAPI.RemoveFromCollisionFlags2(BSBody.Ptr, CollisionFlags.CF_STATIC_OBJECT);
537 // A dynamic object has mass
538 BulletSimAPI.SetMassProps2(BSBody.Ptr, _mass, OMV.Vector3.Zero);
539 // The shape is interesting and has mass and a center of gravity
540 IntPtr collisionShapePtr = BulletSimAPI.GetCollisionShape2(BSBody.Ptr);
541 BulletSimAPI.CalculateLocalInertia2(collisionShapePtr, _mass, OMV.Vector3.Zero);
542 // Inertia is based on our new mass
543 BulletSimAPI.UpdateInertiaTensor2(BSBody.Ptr);
544 // Force activation of the object so Bullet will act on it.
545 BulletSimAPI.Activate2(BSBody.Ptr, true);
546 }
547 }
548
549 private void MakeSolid()
550 {
488 } 551 }
489 552
490 // prims don't fly 553 // prims don't fly
@@ -609,7 +672,7 @@ public sealed class BSPrim : BSPhysObject
609 } 672 }
610 else 673 else
611 { 674 {
612 m_log.WarnFormat("{0}: Got a NaN force applied to a Character", LogHeader); 675 m_log.WarnFormat("{0}: Got a NaN force applied to a prim. LocalID={1}", LogHeader, LocalID);
613 return; 676 return;
614 } 677 }
615 _scene.TaintedObject("BSPrim.AddForce", delegate() 678 _scene.TaintedObject("BSPrim.AddForce", delegate()
@@ -624,7 +687,8 @@ public sealed class BSPrim : BSPhysObject
624 m_accumulatedForces.Clear(); 687 m_accumulatedForces.Clear();
625 } 688 }
626 DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force); 689 DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, _force);
627 BulletSimAPI.AddObjectForce2(Body.Ptr, fSum); 690 // For unknown reason, "ApplyCentralForce" is really additive.
691 BulletSimAPI.ApplyCentralForce2(BSBody.Ptr, fSum);
628 }); 692 });
629 } 693 }
630 694
@@ -644,7 +708,7 @@ public sealed class BSPrim : BSPhysObject
644 708
645 Scene.TaintedObject("BSPrim.SubscribeEvents", delegate() 709 Scene.TaintedObject("BSPrim.SubscribeEvents", delegate()
646 { 710 {
647 BulletSimAPI.AddToCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 711 m_currentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
648 }); 712 });
649 } 713 }
650 } 714 }
@@ -652,7 +716,7 @@ public sealed class BSPrim : BSPhysObject
652 _subscribedEventsMs = 0; 716 _subscribedEventsMs = 0;
653 Scene.TaintedObject("BSPrim.UnSubscribeEvents", delegate() 717 Scene.TaintedObject("BSPrim.UnSubscribeEvents", delegate()
654 { 718 {
655 BulletSimAPI.RemoveFromCollisionFlags2(Body.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 719 m_currentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.Ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
656 }); 720 });
657 } 721 }
658 public override bool SubscribedEvents() { 722 public override bool SubscribedEvents() {
@@ -1237,7 +1301,7 @@ public sealed class BSPrim : BSPhysObject
1237 bool ret = BulletSimAPI.CreateObject(_scene.WorldID, shape); 1301 bool ret = BulletSimAPI.CreateObject(_scene.WorldID, shape);
1238 1302
1239 // the CreateObject() may have recreated the rigid body. Make sure we have the latest. 1303 // the CreateObject() may have recreated the rigid body. Make sure we have the latest.
1240 Body = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID)); 1304 BSBody = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID));
1241 1305
1242 return ret; 1306 return ret;
1243 } 1307 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index ab45f8f..47d7199 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -403,13 +403,13 @@ public class BSTerrainManager
403 { 403 {
404 float regionX = tX - offsetX; 404 float regionX = tX - offsetX;
405 float regionY = tY - offsetY; 405 float regionY = tY - offsetY;
406 if (regionX > mapInfo.sizeX) regionX = 0; 406 if (regionX >= mapInfo.sizeX || regionX < 0f) regionX = 0;
407 if (regionY > mapInfo.sizeY) regionY = 0; 407 if (regionY >= mapInfo.sizeY || regionY < 0f) regionY = 0;
408 int mapIndex = (int)regionY * (int)mapInfo.sizeY + (int)regionX; 408 int mapIndex = (int)regionY * (int)mapInfo.sizeY + (int)regionX;
409 ret = mapInfo.heightMap[mapIndex]; 409 ret = mapInfo.heightMap[mapIndex];
410 m_terrainModified = false; 410 m_terrainModified = false;
411 DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXY,bX={1},baseY={2},szX={3},szY={4},regX={5},regY={6},index={7},ht={8}", 411 // DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXY,bX={1},baseY={2},szX={3},szY={4},regX={5},regY={6},index={7},ht={8}",
412 BSScene.DetailLogZero, offsetX, offsetY, mapInfo.sizeX, mapInfo.sizeY, regionX, regionY, mapIndex, ret); 412 // BSScene.DetailLogZero, offsetX, offsetY, mapInfo.sizeX, mapInfo.sizeY, regionX, regionY, mapIndex, ret);
413 } 413 }
414 else 414 else
415 { 415 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index a0bad3a..e579cf2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -218,7 +218,20 @@ public struct ConfigurationParameters
218 public const float numericFalse = 0f; 218 public const float numericFalse = 0f;
219} 219}
220 220
221// Values used by Bullet and BulletSim to control collisions 221
222// The states a bullet collision object can have
223public enum ActivationState : uint
224{
225 ACTIVE_TAG = 1,
226 ISLAND_SLEEPING,
227 WANTS_DEACTIVATION,
228 DISABLE_DEACTIVATION,
229 DISABLE_SIMULATION
230}
231
232// Values used by Bullet and BulletSim to control object properties.
233// Bullet's "CollisionFlags" has more to do with operations on the
234// object (if collisions happen, if gravity effects it, ...).
222public enum CollisionFlags : uint 235public enum CollisionFlags : uint
223{ 236{
224 CF_STATIC_OBJECT = 1 << 0, 237 CF_STATIC_OBJECT = 1 << 0,
@@ -233,8 +246,75 @@ public enum CollisionFlags : uint
233 BS_VOLUME_DETECT_OBJECT = 1 << 11, 246 BS_VOLUME_DETECT_OBJECT = 1 << 11,
234 BS_PHANTOM_OBJECT = 1 << 12, 247 BS_PHANTOM_OBJECT = 1 << 12,
235 BS_PHYSICAL_OBJECT = 1 << 13, 248 BS_PHYSICAL_OBJECT = 1 << 13,
249 BS_TERRAIN_OBJECT = 1 << 14,
250 BS_NONE = 0,
251 BS_ALL = 0xFFFFFFFF
252};
253
254// Values for collisions groups and masks
255public enum CollisionFilterGroups : uint
256{
257 NoneFilter = 0,
258 DefaultFilter = 1 << 0,
259 StaticFilter = 1 << 1,
260 KinematicFilter = 1 << 2,
261 DebrisFilter = 1 << 3,
262 SensorTrigger = 1 << 4,
263 CharacterFilter = 1 << 5,
264 AllFilter = 0xFFFFFFFF,
265 // Filter groups defined by BulletSim
266 GroundPlaneFilter = 1 << 10,
267 TerrainFilter = 1 << 11,
268 RaycastFilter = 1 << 12,
269 SolidFilter = 1 << 13,
236}; 270};
237 271
272 // For each type, we first clear and then set the collision flags
273public enum ClearCollisionFlag : uint
274{
275 Terrain = CollisionFlags.BS_ALL,
276 Phantom = CollisionFlags.BS_ALL,
277 VolumeDetect = CollisionFlags.BS_ALL,
278 PhysicalObject = CollisionFlags.BS_ALL,
279 StaticObject = CollisionFlags.BS_ALL
280}
281
282public enum SetCollisionFlag : uint
283{
284 Terrain = CollisionFlags.CF_STATIC_OBJECT
285 | CollisionFlags.BS_TERRAIN_OBJECT,
286 Phantom = CollisionFlags.CF_STATIC_OBJECT
287 | CollisionFlags.BS_PHANTOM_OBJECT
288 | CollisionFlags.CF_NO_CONTACT_RESPONSE,
289 VolumeDetect = CollisionFlags.CF_STATIC_OBJECT
290 | CollisionFlags.BS_VOLUME_DETECT_OBJECT
291 | CollisionFlags.CF_NO_CONTACT_RESPONSE,
292 PhysicalObject = CollisionFlags.BS_PHYSICAL_OBJECT,
293 StaticObject = CollisionFlags.CF_STATIC_OBJECT,
294}
295
296// Collision filters used for different types of objects
297public enum SetCollisionFilter : uint
298{
299 Terrain = CollisionFilterGroups.AllFilter,
300 Phantom = CollisionFilterGroups.GroundPlaneFilter
301 | CollisionFilterGroups.TerrainFilter,
302 VolumeDetect = CollisionFilterGroups.AllFilter,
303 PhysicalObject = CollisionFilterGroups.AllFilter,
304 StaticObject = CollisionFilterGroups.AllFilter,
305}
306
307// Collision masks used for different types of objects
308public enum SetCollisionMask : uint
309{
310 Terrain = CollisionFilterGroups.AllFilter,
311 Phantom = CollisionFilterGroups.GroundPlaneFilter
312 | CollisionFilterGroups.TerrainFilter,
313 VolumeDetect = CollisionFilterGroups.AllFilter,
314 PhysicalObject = CollisionFilterGroups.AllFilter,
315 StaticObject = CollisionFilterGroups.AllFilter
316}
317
238// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0 318// CFM controls the 'hardness' of the constraint. 0=fixed, 0..1=violatable. Default=0
239// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2. 319// ERP controls amount of correction per tick. Usable range=0.1..0.8. Default=0.2.
240public enum ConstraintParams : int 320public enum ConstraintParams : int
@@ -347,6 +427,7 @@ public static extern bool SetObjectVelocity(uint worldID, uint id, Vector3 veloc
347[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 427[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
348public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity); 428public static extern bool SetObjectAngularVelocity(uint worldID, uint id, Vector3 angularVelocity);
349 429
430// Set the current force acting on the object
350[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 431[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
351public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force); 432public static extern bool SetObjectForce(uint worldID, uint id, Vector3 force);
352 433
@@ -403,6 +484,7 @@ public static extern void SetDebugLogCallback(DebugLogCallback callback);
403// The names have a "2" tacked on. This will be removed as the C# code gets rebuilt 484// The names have a "2" tacked on. This will be removed as the C# code gets rebuilt
404// and the old code is removed. 485// and the old code is removed.
405 486
487// Functions use while converting from API1 to API2. Can be removed when totally converted.
406[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 488[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
407public static extern IntPtr GetSimHandle2(uint worldID); 489public static extern IntPtr GetSimHandle2(uint worldID);
408 490
@@ -413,6 +495,7 @@ public static extern IntPtr GetBodyHandleWorldID2(uint worldID, uint id);
413public static extern IntPtr GetBodyHandle2(IntPtr world, uint id); 495public static extern IntPtr GetBodyHandle2(IntPtr world, uint id);
414 496
415// =============================================================================== 497// ===============================================================================
498// Initialization and simulation
416[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 499[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
417public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, 500public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
418 int maxCollisions, IntPtr collisionArray, 501 int maxCollisions, IntPtr collisionArray,
@@ -438,6 +521,7 @@ public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSt
438public static extern bool PushUpdate2(IntPtr obj); 521public static extern bool PushUpdate2(IntPtr obj);
439 522
440// ===================================================================================== 523// =====================================================================================
524// Mesh, hull, shape and body creation helper routines
441[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 525[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
442public static extern IntPtr CreateMeshShape2(IntPtr world, 526public static extern IntPtr CreateMeshShape2(IntPtr world,
443 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 527 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
@@ -461,11 +545,25 @@ public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
461public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, Vector3 pos, Quaternion rot); 545public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, Vector3 pos, Quaternion rot);
462 546
463[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 547[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
548public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, IntPtr constructionInfo);
549
550[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
464public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot); 551public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot);
465 552
466[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 553[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
467public static extern bool SetBodyShape2(IntPtr sim, IntPtr obj, IntPtr shape); 554public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
555
556[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
557public static extern void ReleaseBodyInfo2(IntPtr obj);
558
559[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
560public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
561
468// ===================================================================================== 562// =====================================================================================
563// Terrain creation and helper routines
564[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
565public static extern void DumpMapInfo(IntPtr sim, IntPtr manInfo);
566
469[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 567[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
470public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, 568public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
471 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 569 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
@@ -484,6 +582,7 @@ public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float
484public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo); 582public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo);
485 583
486// ===================================================================================== 584// =====================================================================================
585// Constraint creation and helper routines
487[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 586[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
488public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, 587public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
489 Vector3 frame1loc, Quaternion frame1rot, 588 Vector3 frame1loc, Quaternion frame1rot,
@@ -536,107 +635,398 @@ public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams
536public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); 635public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain);
537 636
538// ===================================================================================== 637// =====================================================================================
638// btCollisionWorld entries
639[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
640public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj);
641
642[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
643public static extern void UpdateAabbs2(IntPtr world);
644
645[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
646public static extern bool GetForceUpdateAllAabbs2(IntPtr world);
647
648[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
649public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force);
650
651// =====================================================================================
652// btDynamicsWorld entries
539[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 653[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
540public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); 654public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj);
541 655
542[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 656[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
543public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); 657public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj);
544 658
659[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
660public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects);
661
662[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
663public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain);
545// ===================================================================================== 664// =====================================================================================
665// btCollisionObject entries
666[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
667public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain);
668
669[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
670public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict);
671
672[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
673public static extern bool HasAnisotripicFriction2(IntPtr constrain);
674
675[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
676public static extern void SetContactProcessingThreshold2(IntPtr obj, float val);
677
678[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
679public static extern float GetContactProcessingThreshold2(IntPtr obj);
680
681[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
682public static extern bool IsStaticObject2(IntPtr obj);
683
684[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
685public static extern bool IsKinematicObject2(IntPtr obj);
686
687[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
688public static extern bool IsStaticOrKinematicObject2(IntPtr obj);
689
690[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
691public static extern bool HasContactResponse2(IntPtr obj);
692
693[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
694public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape);
695
696[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
697public static extern IntPtr GetCollisionShape2(IntPtr obj);
698
699[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
700public static extern int GetActivationState2(IntPtr obj);
701
702[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
703public static extern void SetActivationState2(IntPtr obj, int state);
704
705[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
706public static extern void SetDeactivationTime2(IntPtr obj, float dtime);
707
708[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
709public static extern float GetDeactivationTime2(IntPtr obj);
710
711[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
712public static extern void ForceActivationState2(IntPtr obj, ActivationState state);
713
546[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 714[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
547public static extern void Activate2(IntPtr obj, bool forceActivation); 715public static extern void Activate2(IntPtr obj, bool forceActivation);
548 716
549[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 717[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
718public static extern bool IsActive2(IntPtr obj);
719
720[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
721public static extern void SetRestitution2(IntPtr obj, float val);
722
723[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
724public static extern float GetRestitution2(IntPtr obj);
725
726[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
727public static extern void SetFriction2(IntPtr obj, float val);
728
729[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
730public static extern float GetFriction2(IntPtr obj);
731
732 /* Haven't defined the type 'Transform'
733[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
734public static extern Transform GetWorldTransform2(IntPtr obj);
735
736[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
737public static extern void setWorldTransform2(IntPtr obj, Transform trans);
738 */
739
740[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
550public static extern Vector3 GetPosition2(IntPtr obj); 741public static extern Vector3 GetPosition2(IntPtr obj);
551 742
552[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 743[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
553public static extern Quaternion GetOrientation2(IntPtr obj); 744public static extern Quaternion GetOrientation2(IntPtr obj);
554 745
555[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 746[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
556public static extern bool SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); 747public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation);
557 748
558[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 749[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
559public static extern bool SetVelocity2(IntPtr obj, Vector3 velocity); 750public static extern IntPtr GetBroadphaseHandle2(IntPtr obj);
560 751
561[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 752[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
562public static extern bool SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); 753public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle);
563 754
755 /*
564[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 756[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
565public static extern bool SetObjectForce2(IntPtr obj, Vector3 force); 757public static extern Transform GetInterpolationWorldTransform2(IntPtr obj);
566 758
567[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 759[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
568public static extern bool AddObjectForce2(IntPtr obj, Vector3 force); 760public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
761 */
569 762
570[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 763[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
571public static extern bool SetCcdMotionThreshold2(IntPtr obj, float val); 764public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel);
572 765
573[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 766[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
574public static extern bool SetCcdSweepSphereRadius2(IntPtr obj, float val); 767public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel);
575 768
576[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 769[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
577public static extern bool SetDamping2(IntPtr obj, float lin_damping, float ang_damping); 770public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel);
578 771
579[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 772[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
580public static extern bool SetDeactivationTime2(IntPtr obj, float val); 773public static extern float GetHitFraction2(IntPtr obj);
581 774
582[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 775[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
583public static extern bool SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); 776public static extern void SetHitFraction2(IntPtr obj, float val);
584 777
585[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 778[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
586public static extern bool SetContactProcessingThreshold2(IntPtr obj, float val); 779public static extern CollisionFlags GetCollisionFlags2(IntPtr obj);
587 780
588[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 781[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
589public static extern bool SetFriction2(IntPtr obj, float val); 782public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags);
590 783
591[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 784[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
592public static extern bool SetHitFraction2(IntPtr obj, float val); 785public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags);
593 786
594[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 787[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
595public static extern bool SetRestitution2(IntPtr obj, float val); 788public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags);
596 789
597[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 790[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
598public static extern bool SetLinearVelocity2(IntPtr obj, Vector3 val); 791public static extern float GetCcdMotionThreshold2(IntPtr obj);
599 792
600[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 793[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
601public static extern bool SetInterpolation2(IntPtr obj, Vector3 lin, Vector3 ang); 794public static extern void SetCcdMotionThreshold2(IntPtr obj, float val);
602 795
603[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 796[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
604public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); 797public static extern float GetCcdSweepSphereRadius2(IntPtr obj);
798
799[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
800public static extern void SetCcdSweepSphereRadius2(IntPtr obj, float val);
801
802[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
803public static extern IntPtr GetUserPointer2(IntPtr obj);
804
805[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
806public static extern void SetUserPointer2(IntPtr obj, IntPtr val);
807
808// =====================================================================================
809// btRigidBody entries
810[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
811public static extern void ApplyGravity2(IntPtr obj);
812
813[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
814public static extern void SetGravity2(IntPtr obj, Vector3 val);
815
816[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
817public static extern Vector3 GetGravity2(IntPtr obj);
818
819[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
820public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping);
821
822[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
823public static extern float GetLinearDamping2(IntPtr obj);
824
825[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
826public static extern float GetAngularDamping2(IntPtr obj);
827
828[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
829public static extern float GetLinearSleepingThreshold2(IntPtr obj);
830
831[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
832public static extern float GetAngularSleepingThreshold2(IntPtr obj);
833
834[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
835public static extern void ApplyDamping2(IntPtr obj, float timeStep);
836
837[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
838public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia);
839
840[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
841public static extern Vector3 GetLinearFactor2(IntPtr obj);
842
843[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
844public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor);
845
846 /*
847[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
848public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans);
849 */
850
851[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
852public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot);
853
854// Add a force to the object as if its mass is one.
855[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
856public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force);
857
858// Set the force being applied to the object as if its mass is one.
859[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
860public static extern void SetObjectForce2(IntPtr obj, Vector3 force);
861
862[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
863public static extern Vector3 GetTotalForce2(IntPtr obj);
864
865[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
866public static extern Vector3 GetTotalTorque2(IntPtr obj);
867
868[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
869public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj);
870
871[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
872public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert);
873
874[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
875public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold);
876
877[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
878public static extern void ApplyTorque2(IntPtr obj, Vector3 torque);
879
880// Apply force at the given point. Will add torque to the object.
881[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
882public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos);
883
884// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
885[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
886public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp);
887
888// Apply impulse to the object's torque. Force is scaled by object's mass.
889[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
890public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp);
891
892// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
893[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
894public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos);
895
896[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
897public static extern void ClearForces2(IntPtr obj);
898
899[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
900public static extern void ClearAllForces2(IntPtr obj);
901
902[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
903public static extern void UpdateInertiaTensor2(IntPtr obj);
904
905[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
906public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj);
907
908 /*
909[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
910public static extern Transform GetCenterOfMassTransform2(IntPtr obj);
911 */
912
913[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
914public static extern Vector3 GetLinearVelocity2(IntPtr obj);
605 915
606[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 916[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
607public static extern IntPtr SetCollisionFlags2(IntPtr obj, CollisionFlags flags); 917public static extern Vector3 GetAngularVelocity2(IntPtr obj);
608 918
609[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 919[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
610public static extern IntPtr AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); 920public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val);
611 921
612[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 922[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
613public static extern IntPtr RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); 923public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity);
614 924
615[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 925[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
616public static extern bool SetMassProps2(IntPtr obj, float mass, Vector3 inertia); 926public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos);
617 927
618[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 928[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
619public static extern bool UpdateInertiaTensor2(IntPtr obj); 929public static extern void Translate2(IntPtr obj, Vector3 trans);
620 930
621[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 931[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
622public static extern bool SetGravity2(IntPtr obj, Vector3 val); 932public static extern void UpdateDeactivation2(IntPtr obj, float timeStep);
623 933
624[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 934[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
625public static extern IntPtr ClearForces2(IntPtr obj); 935public static extern bool WantsSleeping2(IntPtr obj);
626 936
627[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 937[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
628public static extern IntPtr ClearAllForces2(IntPtr obj); 938public static extern void SetAngularFactor2(IntPtr obj, float factor);
629 939
630[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 940[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
631public static extern bool SetMargin2(IntPtr obj, float val); 941public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor);
632 942
633[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 943[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
634public static extern bool UpdateSingleAabb2(IntPtr world, IntPtr obj); 944public static extern Vector3 GetAngularFactor2(IntPtr obj);
635 945
636[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 946[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
637public static extern bool DestroyObject2(IntPtr world, IntPtr obj); 947public static extern bool IsInWorld2(IntPtr obj);
638 948
639[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 949[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
950public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain);
951
952[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
953public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain);
954
955[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
956public static extern IntPtr GetConstraintRef2(IntPtr obj, int index);
957
958[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
959public static extern int GetNumConstraintRefs2(IntPtr obj);
960
961[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
962public static extern Vector3 GetDeltaLinearVelocity2(IntPtr obj);
963
964[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
965public static extern Vector3 GetDeltaAngularVelocity2(IntPtr obj);
966
967[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
968public static extern Vector3 GetPushVelocity2(IntPtr obj);
969
970[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
971public static extern Vector3 GetTurnVelocity2(IntPtr obj);
972
973// =====================================================================================
974// btCollisionShape entries
975
976[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
977public static extern float GetAngularMotionDisc2(IntPtr shape);
978
979[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
980public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor);
981
982[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
983public static extern bool IsPolyhedral2(IntPtr shape);
984
985[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
986public static extern bool IsConvex2d2(IntPtr shape);
987
988[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
989public static extern bool IsConvex2(IntPtr shape);
990
991[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
992public static extern bool IsNonMoving2(IntPtr shape);
993
994[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
995public static extern bool IsConcave2(IntPtr shape);
996
997[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
998public static extern bool IsCompound2(IntPtr shape);
999
1000[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1001public static extern bool IsSoftBody2(IntPtr shape);
1002
1003[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1004public static extern bool IsInfinite2(IntPtr shape);
1005
1006[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1007public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale);
1008
1009[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1010public static extern Vector3 GetLocalScaling2(IntPtr shape);
1011
1012[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1013public static extern void CalculateLocalInertia2(IntPtr shape, float mass, Vector3 inertia);
1014
1015[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1016public static extern int GetShapeType2(IntPtr shape);
1017
1018[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1019public static extern void SetMargin2(IntPtr shape, float val);
1020
1021[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1022public static extern float GetMargin2(IntPtr shape);
1023
1024[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1025public static extern void SetCollisionFilterMask(IntPtr shape, uint filter, uint mask);
1026
1027// =====================================================================================
1028// Debugging
1029[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
640public static extern void DumpPhysicsStatistics2(IntPtr sim); 1030public static extern void DumpPhysicsStatistics2(IntPtr sim);
641 1031
642} 1032}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index efeca26..1969492 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2182,7 +2182,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2182 pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region. 2182 pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region.
2183 pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. 2183 pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region.
2184 pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region. 2184 pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region.
2185 pos.z > 4096 // return FALSE if altitude than 4096m 2185 pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m
2186 ) 2186 )
2187 ) 2187 )
2188 { 2188 {
@@ -2193,8 +2193,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2193 // this could possibly be done in the above else-if block, but we're doing the check here to keep the code easier to read. 2193 // this could possibly be done in the above else-if block, but we're doing the check here to keep the code easier to read.
2194 2194
2195 Vector3 objectPos = m_host.ParentGroup.RootPart.AbsolutePosition; 2195 Vector3 objectPos = m_host.ParentGroup.RootPart.AbsolutePosition;
2196 LandData here = World.GetLandData((float)objectPos.X, (float)objectPos.Y); 2196 LandData here = World.GetLandData(objectPos);
2197 LandData there = World.GetLandData((float)pos.x, (float)pos.y); 2197 LandData there = World.GetLandData(pos);
2198 2198
2199 // we're only checking prim limits if it's moving to a different parcel under the assumption that if the object got onto the parcel without exceeding the prim limits. 2199 // we're only checking prim limits if it's moving to a different parcel under the assumption that if the object got onto the parcel without exceeding the prim limits.
2200 2200
@@ -10525,20 +10525,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10525 switch ((ParcelMediaCommandEnum) Convert.ToInt32(aList.Data[i].ToString())) 10525 switch ((ParcelMediaCommandEnum) Convert.ToInt32(aList.Data[i].ToString()))
10526 { 10526 {
10527 case ParcelMediaCommandEnum.Url: 10527 case ParcelMediaCommandEnum.Url:
10528 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL)); 10528 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaURL));
10529 break; 10529 break;
10530 case ParcelMediaCommandEnum.Desc: 10530 case ParcelMediaCommandEnum.Desc:
10531 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).Description)); 10531 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).Description));
10532 break; 10532 break;
10533 case ParcelMediaCommandEnum.Texture: 10533 case ParcelMediaCommandEnum.Texture:
10534 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString())); 10534 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaID.ToString()));
10535 break; 10535 break;
10536 case ParcelMediaCommandEnum.Type: 10536 case ParcelMediaCommandEnum.Type:
10537 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); 10537 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaType));
10538 break; 10538 break;
10539 case ParcelMediaCommandEnum.Size: 10539 case ParcelMediaCommandEnum.Size:
10540 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaWidth)); 10540 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaWidth));
10541 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaHeight)); 10541 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaHeight));
10542 break; 10542 break;
10543 default: 10543 default:
10544 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; 10544 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
@@ -11275,7 +11275,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11275 public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param) 11275 public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param)
11276 { 11276 {
11277 m_host.AddScriptLPS(1); 11277 m_host.AddScriptLPS(1);
11278 LandData land = World.GetLandData((float)pos.x, (float)pos.y); 11278 LandData land = World.GetLandData(pos);
11279 if (land == null) 11279 if (land == null)
11280 { 11280 {
11281 return new LSL_List(0); 11281 return new LSL_List(0);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a44ced4..160e2df 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2989,7 +2989,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2989 ScenePresence presence = World.GetScenePresence(avatarId); 2989 ScenePresence presence = World.GetScenePresence(avatarId);
2990 if (presence != null) 2990 if (presence != null)
2991 { 2991 {
2992 LandData land = World.GetLandData((float)pos.X, (float)pos.Y); 2992 LandData land = World.GetLandData(pos);
2993 if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) 2993 if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
2994 { 2994 {
2995 float health = presence.Health; 2995 float health = presence.Health;