PixelLightAPI  .
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
PLPhysics::SNMPhysicsBody Class Reference

Abstract physics body scene node modifier. More...

#include <SNMPhysicsBody.h>

Inheritance diagram for PLPhysics::SNMPhysicsBody:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EFlags { InitUnfrozen = 1<<2, NoAutoFreeze = 1<<3, NoGravity = 1<<4, NoRotation = 1<<5 }
 Scene node modifier flags (PLScene::SceneNodeModifier flags extension) More...

Public Member Functions

PLPHYSICS_API const
PLMath::Vector3
GetCenterOfMass () const
PLPHYSICS_API void SetCenterOfMass (const PLMath::Vector3 &vValue)
PLPHYSICS_API const
PLMath::Vector3
GetPositionOffset () const
PLPHYSICS_API void SetPositionOffset (const PLMath::Vector3 &vValue)
PLPHYSICS_API PLCore::uint8 GetCollisionGroup () const
PLPHYSICS_API void SetCollisionGroup (PLCore::uint8 nValue)
virtual PLPHYSICS_API void SetFlags (PLCore::uint32 nValue) override
PLPHYSICS_API SCPhysicsWorldGetWorldContainer () const
 Returns the PL physics world scene node container the physics body is in.
PLPHYSICS_API BodyGetBody () const
 Returns the PL physics body.

Protected Member Functions

PLPHYSICS_API SNMPhysicsBody (PLScene::SceneNode &cSceneNode)
 Constructor.
virtual PLPHYSICS_API ~SNMPhysicsBody ()
 Destructor.
PLPHYSICS_API void RecreatePhysicsBody ()
 Recreates the PL physics body.
virtual PLPHYSICS_API void OnActivate (bool bActivate) override
 Called when the scene node modifier has been activated or deactivated.
virtual PLPHYSICS_API void CreatePhysicsBody ()
 Creates the PL physics body.
virtual PLPHYSICS_API void InformedOnInit ()
 Informed on scene node modifier initialization.

Protected Attributes

float m_fMass
PLMath::Vector3 m_vCenterOfMass
PLMath::Vector3 m_vPositionOffset
PLCore::uint8 m_nCollisionGroup
SCPhysicsWorldm_pWorldContainer
ElementHandlerm_pBodyHandler
bool m_bListening

Detailed Description

Abstract physics body scene node modifier.

Note:
  • During runtime, do NOT change the scale of the body scene node itself!
  • This scene container MUST be within a SCPhysicsWorld scene container - else this physics body will have no physics behavior at all
  • If there's no mass, the body is static

Member Enumeration Documentation

Scene node modifier flags (PLScene::SceneNodeModifier flags extension)

Enumerator:
InitUnfrozen 

The body is not frozen on initialization

NoAutoFreeze 

Do not freeze the body automatically

NoGravity 

The body is not influenced by gravity

NoRotation 

Rotation is not used

Reimplemented from PLScene::SceneNodeModifier.


Constructor & Destructor Documentation

PLPHYSICS_API PLPhysics::SNMPhysicsBody::SNMPhysicsBody ( PLScene::SceneNode cSceneNode) [protected]

Constructor.

Parameters:
[in]cSceneNodeOwner scene node
virtual PLPHYSICS_API PLPhysics::SNMPhysicsBody::~SNMPhysicsBody ( ) [protected, virtual]

Destructor.


Member Function Documentation

PLPHYSICS_API void PLPhysics::SNMPhysicsBody::SetCenterOfMass ( const PLMath::Vector3 vValue)
PLPHYSICS_API void PLPhysics::SNMPhysicsBody::SetPositionOffset ( const PLMath::Vector3 vValue)
PLPHYSICS_API PLCore::uint8 PLPhysics::SNMPhysicsBody::GetCollisionGroup ( ) const
PLPHYSICS_API void PLPhysics::SNMPhysicsBody::SetCollisionGroup ( PLCore::uint8  nValue)
virtual PLPHYSICS_API void PLPhysics::SNMPhysicsBody::SetFlags ( PLCore::uint32  nValue) [override, virtual]

Reimplemented from PLScene::SceneNodeModifier.

Returns the PL physics world scene node container the physics body is in.

Returns:
The PL physics world scene node container the physics body is in, a null pointer on error (if that's the case, something went totally wrong :)
Note:
  • This PL physics world scene node container can be another as the scene node container this scene node is in
PLPHYSICS_API Body* PLPhysics::SNMPhysicsBody::GetBody ( ) const

Returns the PL physics body.

Returns:
The PL physics body, a null pointer on error (if that's the case, something went totally wrong :)
PLPHYSICS_API void PLPhysics::SNMPhysicsBody::RecreatePhysicsBody ( ) [protected]

Recreates the PL physics body.

virtual PLPHYSICS_API void PLPhysics::SNMPhysicsBody::OnActivate ( bool  bActivate) [override, protected, virtual]

Called when the scene node modifier has been activated or deactivated.

Parameters:
[in]bActivate'true' if the scene node modifier is now active, else 'false'
Note:
  • The scene node "Inactive"-flag as well as the "Frozen"-flag are taken into account
  • 'bActivate' will be 'true' if the scene node modifier AND the owner scene node AND it's parent scene container (recursive!) are active
  • 'bActivate' will be 'false' if the scene node modifier OR the owner scene node OR it's parent scene container (recursive!) is inactive
  • The default implementation is empty

Reimplemented from PLScene::SceneNodeModifier.

virtual PLPHYSICS_API void PLPhysics::SNMPhysicsBody::CreatePhysicsBody ( ) [protected, virtual]

Creates the PL physics body.

virtual PLPHYSICS_API void PLPhysics::SNMPhysicsBody::InformedOnInit ( ) [protected, virtual]

Informed on scene node modifier initialization.

Note:
  • The default implementation is empty

Reimplemented from PLScene::SceneNodeModifier.


Member Data Documentation

Mass of the physics body, 0=static body

Relative center of mass

Position offset relative to the scene node (=origin)

The collision group the body is in (0-31)

The PL physics world scene node container the physics body is in, can be a null pointer

Holds the PL physics body (ALWAYS valid!)

Listening scene node position changes etc.?


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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:21
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported