Classes

Physics/Collision

Brief descriptions

Structures

nau::physics::ICollisionShape

Provides generic interface for collision shape access.

nau::physics::ISphereCollision

Provides generic interface for sphere collision shape access.

nau::physics::IBoxCollision

Provides generic interface for box collision shape access.

nau::physics::ICapsuleCollision

Provides generic interface for capsule collision shape access.

nau::physics::ICylinderCollision

Provides generic interface for cylinder collision shape access.

nau::physics::IConvexHullCollision

Provides a generic interface for convex hull collision shape access.

nau::physics::IMeshCollision

Provides a generic interface for mesh collision shape access.

nau::physics::IPhysicsContactListener

Provides interface for accessing information about physical bodies contacts.

nau::physics::ColliderBase

nau::physics::SphereCollider

nau::physics::BoxCollider

nau::physics::CapsuleCollider

nau::physics::CylinderCollider

nau::physics::CollisionDescription

Classes

nau::physics::ICollisionShapesFactory

Provides interface for collider shape creation.

Detailed information

physics::ICollisionShape

engine/core/modules/physics/include/nau/physics/physics_collider.h

struct ICollisionShape : public virtual IRttiObject

Provides generic interface for collision shape access.

Subclassed by nau::physics::IBoxCollision, nau::physics::ICapsuleCollision, nau::physics::IConvexHullCollision, nau::physics::ICylinderCollision, nau::physics::IMeshCollision, nau::physics::ISphereCollision

Public Types

using Ptr = eastl::unique_ptr<ICollisionShape>

Pointer type used to reference a collision shape.

Public Functions

virtual IRttiObject void setShapeTransform (math::Transform localTransform)=0
virtual math::Transform getShapeTransform() const = 0

physics::ISphereCollision

engine/core/modules/physics/include/nau/physics/physics_collider.h

struct ISphereCollision : public virtual nau::physics::ICollisionShape

Provides generic interface for sphere collision shape access.

Public Functions

virtual ICollisionShape TFloat getRadius () const =0

Retrieves the sphere radius.

Returns:

Radius of the sphere

virtual void setRadius(TFloat) = 0

Sets the sphere radius.

Parameters:

radius[in] Radius value to assign.


physics::IBoxCollision

engine/core/modules/physics/include/nau/physics/physics_collider.h

struct IBoxCollision : public virtual nau::physics::ICollisionShape

Provides generic interface for box collision shape access.


physics::ICapsuleCollision

engine/core/modules/physics/include/nau/physics/physics_collider.h

struct ICapsuleCollision : public virtual nau::physics::ICollisionShape

Provides generic interface for capsule collision shape access.

struct ConstructionData

Encapsulates capsule geometry data.

Public Members

TFloat height = 1.0f

Height of the cylindric part of the capsule shape.

TFloat radius = 0.5f
height

physics::ICylinderCollision

engine/core/modules/physics/include/nau/physics/physics_collider.h

struct ICylinderCollision : public virtual nau::physics::ICollisionShape

Provides generic interface for cylinder collision shape access.

struct ConstructionData

Encapsulates cylinder geometry data.

Public Members

TFloat height = 1.0f
TFloat radius = 0.5f
height

physics::IConvexHullCollision

engine/core/modules/physics/include/nau/physics/physics_collider.h

struct IConvexHullCollision : public virtual nau::physics::ICollisionShape

Provides a generic interface for convex hull collision shape access.

struct ConstructionData

Encapsulates convex hull geometry data.

Public Members

eastl::vector<nau::math::vec3> points

Vertices of the convex hull.


physics::IMeshCollision

engine/core/modules/physics/include/nau/physics/physics_collider.h

struct IMeshCollision : public virtual nau::physics::ICollisionShape

Provides a generic interface for mesh collision shape access.

struct ConstructionData

Encapsulates mesh geometry data.

Public Members

eastl::vector<Triangle> triangles

List of triangles making up the mesh.

eastl::vector<nau::physics::IPhysicsMaterial*> materials

List of materials which triangles in the mesh can reference via nau::physics::IMeshCollision::Triangle::materialIndex.

struct Triangle

Encapsulates mesh triangle geometry data.

Public Members

nau::math::vec3 p1
nau::math::vec3 p2
nau::math::vec3 p3
uint32_t materialIndex = {}

Index of the triangle material in nau::physics::IMeshCollision::ConstructionData::materials.

p1
p2

physics::IPhysicsContactListener

engine/core/modules/physics/include/nau/physics/physics_contact_listener.h

struct IPhysicsContactListener : public virtual IRefCounted

Provides interface for accessing information about physical bodies contacts.

Public Types

using Ptr = Ptr<IPhysicsContactListener>

Pointer type used to reference a IPhysicsContactListener objects.

Public Functions

virtual void onContactAdded(const ContactManifold &data1, const ContactManifold &data2, const eastl::vector<math::vec3> &collisionWorldPoints) = 0

Called when a contact between two bodies begins.

Parameters:
  • data1, data2[in] Keep information about the contacting bodies.

  • collisionWorldPoints[in] Array of contact points (in world coordinates).

virtual void onContactContinued(const ContactManifold &data1, const ContactManifold &data2, const eastl::vector<math::vec3> &collisionWorldPoints) = 0

Called each frame while two bodies continue contacting.

Parameters:
  • data1, data2[in] Keep information about the contacting bodies.

  • collisionWorldPoints[in] Array of contact points (in world coordinates).

virtual void onContactRemovedCompletely(const ContactManifold &data1, const ContactManifold &data2) = 0

Called when a contact between two bodies ceases.

Parameters:

data1, data2[in] Keep information about the bodies that stopped contacting.

struct ContactManifold

Encapsulates the data that is passed to the listener from each of the contacting bodies.

Public Members

physics::RigidBodyComponent &rigidBody

Component which the contacting body is attached to.

nau::physics::IPhysicsMaterial::Ptr material

Contacting body material.

Note

material is NULL when a ContactManifold instance is passed to onContactRemovedCompletely.


physics::ColliderBase

engine/core/modules/physics/include/nau/physics/components/colliders.h

struct ColliderBase

Subclassed by nau::physics::BoxCollider, nau::physics::CapsuleCollider, nau::physics::CylinderCollider, nau::physics::SphereCollider

Public Members

isTrigger
materialAsset
localTransform bool isTrigger   = false
AssetRef materialAsset
math::Transform localTransform

physics::SphereCollider

engine/core/modules/physics/include/nau/physics/components/colliders.h

struct SphereCollider : public nau::physics::ColliderBase

Public Members

radius float radius   = 1.0f

physics::BoxCollider

engine/core/modules/physics/include/nau/physics/components/colliders.h

struct BoxCollider : public nau::physics::ColliderBase

Public Members

extent math::vec3 extent   = math::vec3::one()

physics::CapsuleCollider

engine/core/modules/physics/include/nau/physics/components/colliders.h

struct CapsuleCollider : public nau::physics::ColliderBase

Public Members

height
radius float height   = 1.0f
float radius = 0.5f

physics::CylinderCollider

engine/core/modules/physics/include/nau/physics/components/colliders.h

struct CylinderCollider : public nau::physics::ColliderBase

Public Members

height
radius float height   = 1.0f
float radius = 0.5f

physics::CollisionDescription

engine/core/modules/physics/include/nau/physics/components/colliders.h

struct CollisionDescription

Public Functions

inline cylinders decltype(auto) addSphere(float r)
inline decltype(auto) addBox(math::vec3 extent)
inline decltype(auto) addCapsule(float height, float radius)
inline decltype(auto) addCylinder(float height, float radius)

Public Members

eastl::vector<SphereCollider> spheres
eastl::vector<BoxCollider> boxes
eastl::vector<CapsuleCollider> capsules
eastl::vector<CylinderCollider> cylinders
spheres
boxes
capsules
cylinders

physics::ICollisionShapesFactory

engine/core/modules/physics/include/nau/physics/physics_collision_shapes_factory.h

class ICollisionShapesFactory : public virtual IRefCounted

Provides interface for collider shape creation.

Private Functions

virtual IRefCounted ICollisionShape::Ptr createGenericCollisionShape (const rtti::TypeInfo &colliderType, const RuntimeValue::Ptr &constructionData=nullptr, nau::physics::IPhysicsMaterial *material=nullptr) const =0

Creates a collider shape.

Parameters:
  • colliderType[in] Contains information about the actual collider type to create.

  • constructionData[in] Generic container for shape geometry.

  • material[in] Material to apply to the collider.

Returns:

A pointer to the created shape.

inline eastl::unique_ptr<ISphereCollision> createSphereCollision(TFloat radius, nau::physics::IPhysicsMaterial *material = nullptr) const

Creates a sphere collider shape.

Parameters:
  • radius[in] Sphere radius.

  • material[in] Material to apply to the collider.

Returns:

A pointer to the created sphere shape.

inline eastl::unique_ptr<IBoxCollision> createBoxCollision(math::vec3 extent, nau::physics::IPhysicsMaterial *material = nullptr) const

Creates a box collider shape.

Parameters:
  • extent[in] Box half-size.

  • material[in] Material to apply to the collider.

Returns:

A pointer to the created box shape.

inline eastl::unique_ptr<ICapsuleCollision> createCapsuleCollision(const ICapsuleCollision::ConstructionData &constructionData, nau::physics::IPhysicsMaterial *material = nullptr) const

Creates a capsule collider shape.

Parameters:
  • constructionData[in] Capsule geometry.

  • material[in] Material to apply to the collider.

Returns:

A pointer to the created capsule shape.

inline eastl::unique_ptr<ICylinderCollision> createCylinderCollision(const ICylinderCollision::ConstructionData &constructionData, nau::physics::IPhysicsMaterial *material = nullptr) const

Creates a cylinder collider shape.

Parameters:
  • constructionData[in] Cylinder geometry.

  • material[in] Material to apply to the collider.

Returns:

A pointer to the created cylinder shape.

virtual IConvexHullCollision::Ptr createConvexHullCollision(const IConvexHullCollision::ConstructionData &constructionData, nau::physics::IPhysicsMaterial *material = nullptr) const = 0

Creates a convex hull collider shape.

Parameters:
  • constructionData[in] Convex hull geometry.

  • material[in] Material to apply to the collider.

Returns:

A pointer to the created convex hull shape.

virtual IMeshCollision::Ptr createMeshCollision(const IMeshCollision::ConstructionData &constructionData) const = 0

Creates a mesh collider shape.

Parameters:

constructionData[in] Mesh geometry.

Returns:

A pointer to the created mesh shape.

virtual ICollisionShape::Ptr createMeshCollisionFromAsset(nau::Ptr<physics::TriMeshAssetView> asset) const = 0
virtual ICollisionShape::Ptr createConvexHullCollisionFromAsset(nau::Ptr<physics::ConvexHullAssetView> asset) const = 0
template<std::derived_from<ICollisionShape> CollisionShapeType, typename Argument>
eastl::unique_ptr<CollisionShapeType> createGenericCollisionShapeTyped(const Argument &constructionData, nau::physics::IPhysicsMaterial *material = nullptr) const

Creates a collider shape.

Template Parameters:
  • CollisionShapeType – Output shape type. In has to be a subclass of ICollisionShape.

  • Argument – Type of shape geometry data.

Parameters:
  • constructionData[in] Generic container for shape geometry.

  • material[in] A pointer to the material to apply to the collider.

Returns:

A pointer to the created shape.