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

Method CreateShape

Source/Engine/Physics/Colliders/Collider.cpp:200–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void Collider::CreateShape()
201{
202 ASSERT(_shape == nullptr);
203
204 // Setup shape geometry
205 _cachedScale = GetScale().GetAbsolute().MaxValue();
206 CollisionShape shape;
207 GetGeometry(shape);
208
209 // Create shape
210 const bool isTrigger = _isTrigger && CanBeTrigger();
211 _shape = PhysicsBackend::CreateShape(this, shape, Material, IsActiveInHierarchy(), isTrigger);
212 if (!_shape)
213 {
214 LOG(Error, "Failed to create physics shape for actor '{}'", GetNamePath());
215 if (shape.Type == CollisionShape::Types::ConvexMesh && Float3(shape.ConvexMesh.Scale).MinValue() <= 0)
216 LOG(Warning, "Convex Mesh colliders cannot have negative scale");
217 return;
218 }
219 PhysicsBackend::SetShapeContactOffset(_shape, _contactOffset);
220 UpdateLayerBits();
221}
222
223void Collider::UpdateGeometry()
224{

Callers

nothing calls this directly

Calls 7

GetScaleFunction · 0.85
CreateShapeFunction · 0.85
IsActiveInHierarchyFunction · 0.85
Float3Class · 0.85
MaxValueMethod · 0.45
GetAbsoluteMethod · 0.45
MinValueMethod · 0.45

Tested by

no test coverage detected