aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-30 10:21:47 -0800
committerRobert Adams2012-12-31 19:57:22 -0800
commit9218748321519ed04da5cdffa1f29e69030171b5 (patch)
tree7516cfbea32d716651430bc3124dbdd4cb772105 /OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
parentBulletSim: add the implementation files for the two versions of Bullet: (diff)
downloadopensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.zip
opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.tar.gz
opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.tar.bz2
opensim-SC_OLD-9218748321519ed04da5cdffa1f29e69030171b5.tar.xz
BulletSim: another round of conversion: dynamics world and collision object functions.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs23
1 files changed, 11 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
index a2c085e..01966c0 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
@@ -91,13 +91,12 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
91 // Using the information in m_mapInfo, create the physical representation of the heightmap. 91 // Using the information in m_mapInfo, create the physical representation of the heightmap.
92 private void BuildHeightmapTerrain() 92 private void BuildHeightmapTerrain()
93 { 93 {
94 m_mapInfo.Ptr = BulletSimAPI.CreateHeightMapInfo2(PhysicsScene.World.ptr, m_mapInfo.ID, 94 m_mapInfo.Ptr = PhysicsScene.PE.CreateHeightMapInfo(PhysicsScene.World, m_mapInfo.ID,
95 m_mapInfo.minCoords, m_mapInfo.maxCoords, 95 m_mapInfo.minCoords, m_mapInfo.maxCoords,
96 m_mapInfo.heightMap, BSParam.TerrainCollisionMargin); 96 m_mapInfo.heightMap, BSParam.TerrainCollisionMargin);
97 97
98 // Create the terrain shape from the mapInfo 98 // Create the terrain shape from the mapInfo
99 m_mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(m_mapInfo.Ptr), 99 m_mapInfo.terrainShape = PhysicsScene.PE.CreateTerrainShape(m_mapInfo.Ptr);
100 BSPhysicsShapeType.SHAPE_TERRAIN);
101 100
102 // The terrain object initial position is at the center of the object 101 // The terrain object initial position is at the center of the object
103 Vector3 centerPos; 102 Vector3 centerPos;
@@ -109,22 +108,22 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
109 m_mapInfo.ID, centerPos, Quaternion.Identity); 108 m_mapInfo.ID, centerPos, Quaternion.Identity);
110 109
111 // Set current terrain attributes 110 // Set current terrain attributes
112 BulletSimAPI.SetFriction2(m_mapInfo.terrainBody.ptr, BSParam.TerrainFriction); 111 PhysicsScene.PE.SetFriction(m_mapInfo.terrainBody, BSParam.TerrainFriction);
113 BulletSimAPI.SetHitFraction2(m_mapInfo.terrainBody.ptr, BSParam.TerrainHitFraction); 112 PhysicsScene.PE.SetHitFraction(m_mapInfo.terrainBody, BSParam.TerrainHitFraction);
114 BulletSimAPI.SetRestitution2(m_mapInfo.terrainBody.ptr, BSParam.TerrainRestitution); 113 PhysicsScene.PE.SetRestitution(m_mapInfo.terrainBody, BSParam.TerrainRestitution);
115 BulletSimAPI.SetCollisionFlags2(m_mapInfo.terrainBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 114 PhysicsScene.PE.SetCollisionFlags(m_mapInfo.terrainBody, CollisionFlags.CF_STATIC_OBJECT);
116 115
117 // Return the new terrain to the world of physical objects 116 // Return the new terrain to the world of physical objects
118 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_mapInfo.terrainBody.ptr); 117 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_mapInfo.terrainBody);
119 118
120 // redo its bounding box now that it is in the world 119 // redo its bounding box now that it is in the world
121 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, m_mapInfo.terrainBody.ptr); 120 PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_mapInfo.terrainBody);
122 121
123 m_mapInfo.terrainBody.collisionType = CollisionType.Terrain; 122 m_mapInfo.terrainBody.collisionType = CollisionType.Terrain;
124 m_mapInfo.terrainBody.ApplyCollisionMask(); 123 m_mapInfo.terrainBody.ApplyCollisionMask();
125 124
126 // Make it so the terrain will not move or be considered for movement. 125 // Make it so the terrain will not move or be considered for movement.
127 BulletSimAPI.ForceActivationState2(m_mapInfo.terrainBody.ptr, ActivationState.DISABLE_SIMULATION); 126 PhysicsScene.PE.ForceActivationState(m_mapInfo.terrainBody, ActivationState.DISABLE_SIMULATION);
128 127
129 return; 128 return;
130 } 129 }
@@ -136,10 +135,10 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
136 { 135 {
137 if (m_mapInfo.terrainBody.HasPhysicalBody) 136 if (m_mapInfo.terrainBody.HasPhysicalBody)
138 { 137 {
139 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_mapInfo.terrainBody.ptr); 138 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_mapInfo.terrainBody);
140 // Frees both the body and the shape. 139 // Frees both the body and the shape.
141 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_mapInfo.terrainBody); 140 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_mapInfo.terrainBody);
142 BulletSimAPI.ReleaseHeightMapInfo2(m_mapInfo.Ptr); 141 PhysicsScene.PE.ReleaseHeightMapInfo(m_mapInfo.Ptr);
143 } 142 }
144 } 143 }
145 m_mapInfo = null; 144 m_mapInfo = null;