MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SetPhysicalMaterials

Method SetPhysicalMaterials

Source/Engine/Terrain/Terrain.cpp:293–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293void Terrain::SetPhysicalMaterials(const Array<JsonAssetReference<PhysicalMaterial>, FixedAllocation<8>>& value)
294{
295 PROFILE_MEM(LevelTerrain);
296 _physicalMaterials = value;
297 _physicalMaterials.Resize(8);
298 JsonAsset* materials[8];
299 for (int32 i = 0; i < 8; i++)
300 materials[i] = _physicalMaterials[i];
301 for (int32 pathIndex = 0; pathIndex < _patches.Count(); pathIndex++)
302 {
303 const auto patch = _patches.Get()[pathIndex];
304 if (patch->HasCollision())
305 PhysicsBackend::SetShapeMaterials(patch->_physicsShape, ToSpan(materials, 8));
306 }
307}
308
309int32 Terrain::GetHeightmapSize() const
310{

Callers

nothing calls this directly

Calls 4

ToSpanFunction · 0.50
ResizeMethod · 0.45
CountMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected