diff options
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs index 061e232..1d55ce3 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs | |||
@@ -91,9 +91,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys | |||
91 | PhysicsScene.DetailLog("{0},BSTerrainMesh.create,meshed,indices={1},indSz={2},vertices={3},vertSz={4}", | 91 | PhysicsScene.DetailLog("{0},BSTerrainMesh.create,meshed,indices={1},indSz={2},vertices={3},vertSz={4}", |
92 | ID, indicesCount, indices.Length, verticesCount, vertices.Length); | 92 | ID, indicesCount, indices.Length, verticesCount, vertices.Length); |
93 | 93 | ||
94 | m_terrainShape = new BulletShape(BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, | 94 | m_terrainShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, indicesCount, indices, verticesCount, vertices); |
95 | indicesCount, indices, verticesCount, vertices), | ||
96 | BSPhysicsShapeType.SHAPE_MESH); | ||
97 | if (!m_terrainShape.HasPhysicalShape) | 95 | if (!m_terrainShape.HasPhysicalShape) |
98 | { | 96 | { |
99 | // DISASTER!! | 97 | // DISASTER!! |
@@ -106,7 +104,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys | |||
106 | Vector3 pos = regionBase; | 104 | Vector3 pos = regionBase; |
107 | Quaternion rot = Quaternion.Identity; | 105 | Quaternion rot = Quaternion.Identity; |
108 | 106 | ||
109 | m_terrainBody = new BulletBody(id, BulletSimAPI.CreateBodyWithDefaultMotionState2( m_terrainShape.ptr, ID, pos, rot)); | 107 | m_terrainBody = PhysicsScene.PE.CreateBodyWithDefaultMotionState(m_terrainShape, ID, pos, rot); |
110 | if (!m_terrainBody.HasPhysicalBody) | 108 | if (!m_terrainBody.HasPhysicalBody) |
111 | { | 109 | { |
112 | // DISASTER!! | 110 | // DISASTER!! |
@@ -116,34 +114,34 @@ public sealed class BSTerrainMesh : BSTerrainPhys | |||
116 | } | 114 | } |
117 | 115 | ||
118 | // Set current terrain attributes | 116 | // Set current terrain attributes |
119 | BulletSimAPI.SetFriction2(m_terrainBody.ptr, BSParam.TerrainFriction); | 117 | PhysicsScene.PE.SetFriction(m_terrainBody, BSParam.TerrainFriction); |
120 | BulletSimAPI.SetHitFraction2(m_terrainBody.ptr, BSParam.TerrainHitFraction); | 118 | PhysicsScene.PE.SetHitFraction(m_terrainBody, BSParam.TerrainHitFraction); |
121 | BulletSimAPI.SetRestitution2(m_terrainBody.ptr, BSParam.TerrainRestitution); | 119 | PhysicsScene.PE.SetRestitution(m_terrainBody, BSParam.TerrainRestitution); |
122 | BulletSimAPI.SetCollisionFlags2(m_terrainBody.ptr, CollisionFlags.CF_STATIC_OBJECT); | 120 | PhysicsScene.PE.SetCollisionFlags(m_terrainBody, CollisionFlags.CF_STATIC_OBJECT); |
123 | 121 | ||
124 | // Static objects are not very massive. | 122 | // Static objects are not very massive. |
125 | BulletSimAPI.SetMassProps2(m_terrainBody.ptr, 0f, Vector3.Zero); | 123 | PhysicsScene.PE.SetMassProps(m_terrainBody, 0f, Vector3.Zero); |
126 | 124 | ||
127 | // Put the new terrain to the world of physical objects | 125 | // Put the new terrain to the world of physical objects |
128 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_terrainBody.ptr); | 126 | PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_terrainBody); |
129 | 127 | ||
130 | // Redo its bounding box now that it is in the world | 128 | // Redo its bounding box now that it is in the world |
131 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, m_terrainBody.ptr); | 129 | PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_terrainBody); |
132 | 130 | ||
133 | m_terrainBody.collisionType = CollisionType.Terrain; | 131 | m_terrainBody.collisionType = CollisionType.Terrain; |
134 | m_terrainBody.ApplyCollisionMask(); | 132 | m_terrainBody.ApplyCollisionMask(PhysicsScene); |
135 | 133 | ||
136 | // Make it so the terrain will not move or be considered for movement. | 134 | // Make it so the terrain will not move or be considered for movement. |
137 | BulletSimAPI.ForceActivationState2(m_terrainBody.ptr, ActivationState.DISABLE_SIMULATION); | 135 | PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION); |
138 | } | 136 | } |
139 | 137 | ||
140 | public override void Dispose() | 138 | public override void Dispose() |
141 | { | 139 | { |
142 | if (m_terrainBody.HasPhysicalBody) | 140 | if (m_terrainBody.HasPhysicalBody) |
143 | { | 141 | { |
144 | BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_terrainBody.ptr); | 142 | PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_terrainBody); |
145 | // Frees both the body and the shape. | 143 | // Frees both the body and the shape. |
146 | BulletSimAPI.DestroyObject2(PhysicsScene.World.ptr, m_terrainBody.ptr); | 144 | PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_terrainBody); |
147 | } | 145 | } |
148 | } | 146 | } |
149 | 147 | ||