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 24 of file PhysicsBody.h.

Constructor & Destructor Documentation

◆ ~PhysicsPositionProvider()

DLLEXPORT PhysicsPositionProvider::~PhysicsPositionProvider ( )

Definition at line 302 of file PhysicsBody.cpp.

303 {
304  _OnAttachBridge(nullptr);
305 }
DLLEXPORT void _OnAttachBridge(PhysicsDataBridge *bridge)

Member Function Documentation

◆ _OnAttachBridge()

DLLEXPORT void PhysicsPositionProvider::_OnAttachBridge ( PhysicsDataBridge bridge)
protected

Definition at line 307 of file PhysicsBody.cpp.

308 {
309  if(AttachedBridge)
310  AttachedBridge->_OnDetachBridge(this);
311  AttachedBridge = bridge;
312 }
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 314 of file PhysicsBody.cpp.

315 {
316  const Float3* position;
317  const Float4* orientation;
318 
319  GetPositionDataForPhysics(position, orientation);
320 
321  worldTrans.setRotation(*orientation);
322  worldTrans.setOrigin(*position);
323 }
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 325 of file PhysicsBody.cpp.

326 {
327  const Float3 position = worldTrans.getOrigin();
328  const Float4 orientation = worldTrans.getRotation();
329 
330  SetPositionDataFromPhysics(position, orientation);
331 }
virtual void SetPositionDataFromPhysics(const Float3 &position, const Float4 &orientation)=0

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