Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Ndk::PhysicsComponent2D Class Reference

NDK class that represents a physics point, without any collision. More...

Inherits Ndk::Component< ComponentType >.

Public Member Functions

 PhysicsComponent2D (const PhysicsComponent2D &physics)
 Constructs a PhysicsComponent2D object by copy semantic. More...
 
void AddForce (const Nz::Vector2f &force, Nz::CoordSys coordSys=Nz::CoordSys_Global)
 Applies a physics force to the entity. More...
 
void AddForce (const Nz::Vector2f &force, const Nz::Vector2f &point, Nz::CoordSys coordSys=Nz::CoordSys_Global)
 Applies a physics force to the entity. More...
 
void AddTorque (float torque)
 Applies a torque to the entity. More...
 
Nz::Rectf GetAABB () const
 Gets the AABB of the physics object. More...
 
float GetAngularVelocity () const
 Gets the angular velocity of the physics object. More...
 
Nz::Vector2f GetCenterOfGravity (Nz::CoordSys coordSys=Nz::CoordSys_Local) const
 Gets the gravity center of the physics object. More...
 
float GetMass () const
 Gets the mass of the physics object. More...
 
Nz::Vector2f GetPosition () const
 Gets the position of the physics object. More...
 
float GetRotation () const
 Gets the rotation of the physics object. More...
 
Nz::Vector2f GetVelocity () const
 Gets the velocity of the physics object. More...
 
bool IsSleeping () const
 Checks whether the entity is currently sleeping. More...
 
void SetAngularVelocity (float angularVelocity)
 Sets the angular velocity of the physics object. More...
 
void SetMass (float mass)
 Sets the mass of the physics object. More...
 
void SetMassCenter (const Nz::Vector2f &center)
 Sets the gravity center of the physics object. More...
 
void SetPosition (const Nz::Vector2f &position)
 Sets the position of the physics object. More...
 
void SetRotation (float rotation)
 Sets the rotation of the physics object. More...
 
void SetVelocity (const Nz::Vector2f &velocity)
 Sets the velocity of the physics object. More...
 

Static Public Attributes

static ComponentIndex componentIndex
 

Friends

class CollisionComponent2D
 
class PhysicsSystem2D
 

Detailed Description

NDK class that represents a physics point, without any collision.

Constructor & Destructor Documentation

◆ PhysicsComponent2D()

Ndk::PhysicsComponent2D::PhysicsComponent2D ( const PhysicsComponent2D physics)
inline

Constructs a PhysicsComponent2D object by copy semantic.

Parameters
physicsPhysicsComponent2D to copy

Member Function Documentation

◆ AddForce() [1/2]

void Ndk::PhysicsComponent2D::AddForce ( const Nz::Vector2f force,
Nz::CoordSys  coordSys = Nz::CoordSys_Global 
)
inline

Applies a physics force to the entity.

Parameters
forceForce to apply on the entity
coordSysSystem coordinates to consider
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ AddForce() [2/2]

void Ndk::PhysicsComponent2D::AddForce ( const Nz::Vector2f force,
const Nz::Vector2f point,
Nz::CoordSys  coordSys = Nz::CoordSys_Global 
)
inline

Applies a physics force to the entity.

Parameters
forceForce to apply on the entity
pointPoint where to apply the force
coordSysSystem coordinates to consider
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ AddTorque()

void Ndk::PhysicsComponent2D::AddTorque ( float  torque)
inline

Applies a torque to the entity.

Parameters
torqueTorque to apply on the entity
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ GetAABB()

Nz::Rectf Ndk::PhysicsComponent2D::GetAABB ( ) const
inline

Gets the AABB of the physics object.

Returns
AABB of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ GetAngularVelocity()

float Ndk::PhysicsComponent2D::GetAngularVelocity ( ) const
inline

Gets the angular velocity of the physics object.

Returns
Angular velocity of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ GetCenterOfGravity()

Nz::Vector2f Ndk::PhysicsComponent2D::GetCenterOfGravity ( Nz::CoordSys  coordSys = Nz::CoordSys_Local) const
inline

Gets the gravity center of the physics object.

Returns
Gravity center of the object
Parameters
coordSysSystem coordinates to consider
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ GetMass()

float Ndk::PhysicsComponent2D::GetMass ( ) const
inline

Gets the mass of the physics object.

Returns
Mass of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ GetPosition()

Nz::Vector2f Ndk::PhysicsComponent2D::GetPosition ( ) const
inline

Gets the position of the physics object.

Returns
Position of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ GetRotation()

float Ndk::PhysicsComponent2D::GetRotation ( ) const
inline

Gets the rotation of the physics object.

Returns
Rotation of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ GetVelocity()

Nz::Vector2f Ndk::PhysicsComponent2D::GetVelocity ( ) const
inline

Gets the velocity of the physics object.

Returns
Velocity of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ IsSleeping()

bool Ndk::PhysicsComponent2D::IsSleeping ( ) const
inline

Checks whether the entity is currently sleeping.

Returns
true If it is the case
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ SetAngularVelocity()

void Ndk::PhysicsComponent2D::SetAngularVelocity ( float  angularVelocity)
inline

Sets the angular velocity of the physics object.

Parameters
angularVelocityAngular velocity of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ SetMass()

void Ndk::PhysicsComponent2D::SetMass ( float  mass)
inline

Sets the mass of the physics object.

Parameters
massMass of the object
Remarks
Produces a NazaraAssert if the physics object is invalid
Produces a NazaraAssert if the mass is negative

◆ SetMassCenter()

void Ndk::PhysicsComponent2D::SetMassCenter ( const Nz::Vector2f center)
inline

Sets the gravity center of the physics object.

Parameters
centerGravity center of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ SetPosition()

void Ndk::PhysicsComponent2D::SetPosition ( const Nz::Vector2f position)
inline

Sets the position of the physics object.

Parameters
positionPosition of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ SetRotation()

void Ndk::PhysicsComponent2D::SetRotation ( float  rotation)
inline

Sets the rotation of the physics object.

Parameters
rotationRotation of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

◆ SetVelocity()

void Ndk::PhysicsComponent2D::SetVelocity ( const Nz::Vector2f velocity)
inline

Sets the velocity of the physics object.

Parameters
velocityVelocity of the object
Remarks
Produces a NazaraAssert if the physics object is invalid

The documentation for this class was generated from the following files: