Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Basic usage for a sphere with radius 0.5

Sphere-shaped collider.

Sphere-shaped colliderExplicit sphere collider that users can add to customize collision shape. If present on an entity with RigidBody, overrides the automatic mesh-based collision.

Spheres are the most efficient collision shape and should be preferred when the object's shape can be approximated as a sphere.

Common uses:

  • Balls, projectiles
  • Spherical triggers
  • Particle systems
  • Simplified character collision
Note
Spheres have uniform collision response in all directions
Most efficient primitive for broad phase and narrow phase collision detection
The offset member is applied to the created physics shape when building the collision shape.
collider.radius = 0.5f;
entity.AddComponent<Physics::Component::SphereCollider>(core, collider);
Definition SphereCollider.hpp:56
float radius
Radius of the sphere in world units.
Definition SphereCollider.hpp:58

usage for a sphere with radius 0.5