Leviathan  0.8.0.0
Leviathan game engine
Leviathan::PhysicsPositionProvider Class Referenceabstract

This acts as a bridge between Leviathan positions and physics engine positions. More...

#include <PhysicsBody.h>

+ Inheritance diagram for Leviathan::PhysicsPositionProvider:

Public Member Functions

DLLEXPORT ~PhysicsPositionProvider ()
 
virtual void GetPositionDataForPhysics (const Float3 *&position, const Float4 *&orientation) const =0
 
virtual void SetPositionDataFromPhysics (const Float3 &position, const Float4 &orientation)=0
 
DLLEXPORT void getWorldTransform (btTransform &worldTrans) const override final
 
DLLEXPORT void setWorldTransform (const btTransform &worldTrans) override final
 

Protected Member Functions

DLLEXPORT void _OnAttachBridge (PhysicsDataBridge *bridge)
 

Detailed Description

This acts as a bridge between Leviathan positions and physics engine positions.

Todo:
This should have a property for the object deriving from this to be able to tell that it has destructed

Definition at line 26 of file PhysicsBody.h.

Constructor & Destructor Documentation

◆ ~PhysicsPositionProvider()

DLLEXPORT PhysicsPositionProvider::~PhysicsPositionProvider ( )

Definition at line 321 of file PhysicsBody.cpp.

322 {
323  _OnAttachBridge(nullptr);
324 }
DLLEXPORT void _OnAttachBridge(PhysicsDataBridge *bridge)

Member Function Documentation

◆ _OnAttachBridge()

DLLEXPORT void PhysicsPositionProvider::_OnAttachBridge ( PhysicsDataBridge bridge)
protected

Definition at line 326 of file PhysicsBody.cpp.

327 {
328  if(AttachedBridge)
329  AttachedBridge->_OnDetachBridge(this);
330  AttachedBridge = bridge;
331 }
DLLEXPORT void _OnDetachBridge(PhysicsPositionProvider *provider)

◆ GetPositionDataForPhysics()

virtual void Leviathan::PhysicsPositionProvider::GetPositionDataForPhysics ( const Float3 *&  position,
const Float4 *&  orientation 
) const
pure virtual

Implemented in Leviathan::Position.

◆ getWorldTransform()

DLLEXPORT void PhysicsPositionProvider::getWorldTransform ( btTransform &  worldTrans) const
finaloverride

Definition at line 333 of file PhysicsBody.cpp.

334 {
335  const Float3* position;
336  const Float4* orientation;
337 
338  GetPositionDataForPhysics(position, orientation);
339 
340  worldTrans.setRotation(*orientation);
341  worldTrans.setOrigin(*position);
342 }
virtual void GetPositionDataForPhysics(const Float3 *&position, const Float4 *&orientation) const =0

◆ SetPositionDataFromPhysics()

virtual void Leviathan::PhysicsPositionProvider::SetPositionDataFromPhysics ( const Float3 position,
const Float4 orientation 
)
pure virtual

Implemented in Leviathan::Position.

◆ setWorldTransform()

DLLEXPORT void PhysicsPositionProvider::setWorldTransform ( const btTransform &  worldTrans)
finaloverride

Definition at line 344 of file PhysicsBody.cpp.

345 {
346  const Float3 position = worldTrans.getOrigin();
347  const Float4 orientation = worldTrans.getRotation();
348 
349  SetPositionDataFromPhysics(position, orientation);
350 }
virtual void SetPositionDataFromPhysics(const Float3 &position, const Float4 &orientation)=0

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