-
-
Notifications
You must be signed in to change notification settings - Fork 29
Collider
A Collider is a component containing a shape of any type, to perform collision tests with. Entities without a collider will not be able to react to collisions.
Important note: the shape's arguments must be given relatively to the transform's position, not in world's coordinates. For example, this sphere collider will always be located above the object:
entity.addComponent<Raz::Collider>(Raz::Sphere(Raz::Vec3f(0.f, 1.f, 0.f), // RELATIVE center
1.f)); // Radius
Therefore, to have a shape centered on your object, you should match its centroid to [0; 0; 0]. In the above example, giving the sphere a center to 0 will keep it at the same position as the Transform component. In world's coordinates, this means that the collider's centroid will always be considered to be at transform.getPosition() + collider.getShape().computeCentroid()
. Always keep that in mind!
- Home
- How to build RaZ
- Getting started
- General usage knowledge
- Some examples...
- Playground
- Tutorials
- File formats
- Modules
- Debug