NAP
Public Member Functions | Public Attributes | List of all members
RotateComponentInstance Class Reference

#include <rotatecomponent.h>

Public Member Functions

 RotateComponentInstance (EntityInstance &entity, Component &resource)
 
virtual bool init (utility::ErrorState &errorState) override
 
virtual void update (double deltaTime) override
 
void reset ()
 
void enable (bool enable)
 
bool isEnabled () const
 
void setSpeed (float speed)
 
float getSpeed () const
 
void setAxis (const glm::vec3 &axis)
 
glm::vec3 getAxis () const
 
- Public Member Functions inherited from ComponentInstance
 ComponentInstance (EntityInstance &entity, Component &resource)
 
nap::EntityInstancegetEntityInstance () const
 
nap::ComponentgetComponent () const
 
template<typename T >
T * getComponent () const
 
virtual bool init (utility::ErrorState &errorState)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

RotateProperties mProperties
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

Instance part of the rotate component. Automatically rotates the entity along a certain axis at a certain speed. The initial rotation value after initialization is used to rotate along the specified axis. This component updates (overrides) the rotate value of the transform component. Entities that use this component must have a transform.

Inheritance diagram for RotateComponentInstance:
[legend]
Collaboration diagram for RotateComponentInstance:
[legend]

Constructor & Destructor Documentation

◆ RotateComponentInstance()

RotateComponentInstance ( EntityInstance entity,
Component resource 
)

Member Function Documentation

◆ enable()

void enable ( bool  enable)

Enable or disable the rotation

◆ getAxis()

glm::vec3 getAxis ( ) const
Returns
the rotation axis

◆ getSpeed()

float getSpeed ( ) const
Returns
the rotation speed in seconds

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initialize this rotate component, copies it's members over and validates if a transform component is available that can be rotated.

Parameters
errorStatecontains the error if initialization fails.

Reimplemented from ComponentInstance.

◆ isEnabled()

bool isEnabled ( ) const
Returns
whether the component is enabled

◆ reset()

void reset ( )

Resets rotation to be 0

◆ setAxis()

void setAxis ( const glm::vec3 &  axis)

Sets the rotation axis

Parameters
axisrotation axis

◆ setSpeed()

void setSpeed ( float  speed)

◆ update()

virtual void update ( double  deltaTime)
overridevirtual

Rotates the component based on the current speed and axis

Parameters
deltaTimeframe time in seconds

Reimplemented from ComponentInstance.

Member Data Documentation

◆ mProperties

RotateProperties mProperties