GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::physics::ObjectOptions< N > Struct Template Reference

Configuration options for an object. More...

#include <GREM/physics/objects.hpp>

Public Member Functions

bool operator== (const ObjectOptions &other) const =default
 Compare this set of options to another set for equality.

Public Attributes

Position< N > position {}
 Initial position of the object's center of mass in the world.
Orientation< N > orientation {}
 Initial orientation of the object in the world.
Scale< N > scale {Scalar{1}}
 Initial scale of the object in shape-local space.
LinearVelocity< N > linearVelocity {}
 Initial linear velocity of the object's center of mass.
AngularVelocity< N > angularVelocity {}
 Initial angular velocity of the object.
LinearAcceleration< N > gravityAcceleration = -Y_AXIS<N> * static_cast<Scalar>(9.82) * METERS_PER_SECOND_SQUARED
 Gravity acceleration that will be applied to the object on every simulation step.
Density surroundingFluidDensity = static_cast<Scalar>(1.2041) * KILOGRAMS_PER_CUBIC_METER
 Effective fluid density of the object's surroundings, which will be used to calculate the drag to apply to the object at every simulation step.
Length< N > centerOfBuoyancy {}
 World-space offset of the center of buoyancy of the object relative to its center of mass.
Mass mass {}
 Mass of the object.
PrincipalMomentsOfInertia< N > principalMomentsOfInertia {}
 Principal moments of inertia of the object.
LocalInertiaOrientation< N > localInertiaOrientation {}
 Rotation from inertia major axis space to local space.
Collider< N > collider {.shape = PointShape<N>{}}
 Collider of the object.
Material material {}
 Dynamics-related properties of the object.
bool emitsCollisionEvents = false
 Whether the object should emit collision events or not.
bool emitsSeparationEvents = false
 Whether the object should emit separation events or not.
bool enableResting = true
 Whether the object should enter a resting state on inactivity or not.

Detailed Description

template<size_t N>
struct grem::physics::ObjectOptions< N >

Configuration options for an object.

Template Parameters
Nnumber of dimensions of the world space (must be 2 or 3).

Member Function Documentation

◆ operator==()

template<size_t N>
bool grem::physics::ObjectOptions< N >::operator== ( const ObjectOptions< N > & other) const
nodiscarddefault

Compare this set of options to another set for equality.

Parameters
otherthe options to compare these to.
Returns
true if the options are equal, false otherwise.

Member Data Documentation

◆ position

template<size_t N>
Position<N> grem::physics::ObjectOptions< N >::position {}

Initial position of the object's center of mass in the world.

◆ orientation

template<size_t N>
Orientation<N> grem::physics::ObjectOptions< N >::orientation {}

Initial orientation of the object in the world.

◆ scale

template<size_t N>
Scale<N> grem::physics::ObjectOptions< N >::scale {Scalar{1}}

Initial scale of the object in shape-local space.

◆ linearVelocity

template<size_t N>
LinearVelocity<N> grem::physics::ObjectOptions< N >::linearVelocity {}

Initial linear velocity of the object's center of mass.

◆ angularVelocity

template<size_t N>
AngularVelocity<N> grem::physics::ObjectOptions< N >::angularVelocity {}

Initial angular velocity of the object.

◆ gravityAcceleration

template<size_t N>
LinearAcceleration<N> grem::physics::ObjectOptions< N >::gravityAcceleration = -Y_AXIS<N> * static_cast<Scalar>(9.82) * METERS_PER_SECOND_SQUARED

Gravity acceleration that will be applied to the object on every simulation step.

◆ surroundingFluidDensity

template<size_t N>
Density grem::physics::ObjectOptions< N >::surroundingFluidDensity = static_cast<Scalar>(1.2041) * KILOGRAMS_PER_CUBIC_METER

Effective fluid density of the object's surroundings, which will be used to calculate the drag to apply to the object at every simulation step.

See also
Material::linearDrag
Material::angularDrag

◆ centerOfBuoyancy

template<size_t N>
Length<N> grem::physics::ObjectOptions< N >::centerOfBuoyancy {}

World-space offset of the center of buoyancy of the object relative to its center of mass.

◆ mass

template<size_t N>
Mass grem::physics::ObjectOptions< N >::mass {}

Mass of the object.

Must be positive or 0. If set to 0, an estimate of the mass will be calculated automatically based on the shape's volume and an assumed density of 0.5 g/cm^3. If set to infinity, the object's linear velocity will be constant (except for gravity, if gravityAcceleration is non-zero).

Note
If both mass and principalMomentsOfInertia are infinite, the object will be considered immovable for the rest of its lifetime unless its ObjectActivity::isCorrectable field is manually set to true.

◆ principalMomentsOfInertia

template<size_t N>
PrincipalMomentsOfInertia<N> grem::physics::ObjectOptions< N >::principalMomentsOfInertia {}

Principal moments of inertia of the object.

Each component must be positive or 0. If set to 0, an estimate of the moment of inertia will be calculated automatically based on the object's shape and mass. The estimate will assume that localInertiaOrientation is the identity orientation. If set to infinity, the object's angular velocity will be constant.

Note
If both mass and principalMomentsOfInertia are infinite, the object will be considered immovable for the rest of its lifetime unless its ObjectActivity::isCorrectable field is manually set to true.

◆ localInertiaOrientation

template<size_t N>
LocalInertiaOrientation<N> grem::physics::ObjectOptions< N >::localInertiaOrientation {}

Rotation from inertia major axis space to local space.

◆ collider

template<size_t N>
Collider<N> grem::physics::ObjectOptions< N >::collider {.shape = PointShape<N>{}}

Collider of the object.

◆ material

template<size_t N>
Material grem::physics::ObjectOptions< N >::material {}

Dynamics-related properties of the object.

◆ emitsCollisionEvents

template<size_t N>
bool grem::physics::ObjectOptions< N >::emitsCollisionEvents = false

Whether the object should emit collision events or not.

◆ emitsSeparationEvents

template<size_t N>
bool grem::physics::ObjectOptions< N >::emitsSeparationEvents = false

Whether the object should emit separation events or not.

◆ enableResting

template<size_t N>
bool grem::physics::ObjectOptions< N >::enableResting = true

Whether the object should enter a resting state on inactivity or not.

Set to false to make sure the object is always simulated regardless of its speed.


The documentation for this struct was generated from the following file: