| 2208 | } |
| 2209 | |
| 2210 | void TerrainPatch::UpdateCollisionScale() const |
| 2211 | { |
| 2212 | PROFILE_CPU(); |
| 2213 | ASSERT(HasCollision()); |
| 2214 | |
| 2215 | // Create geometry |
| 2216 | const Transform terrainTransform = _terrain->_transform; |
| 2217 | CollisionShape geometry; |
| 2218 | const float rowScale = Math::Abs(terrainTransform.Scale.X) * _collisionScaleXZ; |
| 2219 | const float heightScale = Math::Abs(terrainTransform.Scale.Y) * _yHeight / TERRAIN_PATCH_COLLISION_QUANTIZATION; |
| 2220 | const float columnScale = Math::Abs(terrainTransform.Scale.Z) * _collisionScaleXZ; |
| 2221 | geometry.SetHeightField(_physicsHeightField, heightScale, rowScale, columnScale); |
| 2222 | |
| 2223 | // Update shape |
| 2224 | PhysicsBackend::SetShapeGeometry(_physicsShape, geometry); |
| 2225 | PhysicsBackend::SetShapeLocalPose(_physicsShape, Vector3(0, _yOffset * terrainTransform.Scale.Y, 0), Quaternion::Identity); |
| 2226 | } |
| 2227 | |
| 2228 | void TerrainPatch::DestroyCollision() |
| 2229 | { |
no test coverage detected