PixelLightAPI  .
Classes | Public Types | Public Member Functions | Protected Member Functions
PLPhysics::Sensor Class Reference

Abstract PL physics sensor base class. More...

#include <Sensor.h>

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

List of all members.

Classes

struct  BodyInfo
 Holds information about a detected body. More...

Public Types

enum  EFlags { ClosestBody = 1<<0 }
 Flags. More...

Public Member Functions

virtual PLPHYSICS_API ~Sensor ()
 Destructor.
PLPHYSICS_API PLCore::uint32 GetFlags () const
 Returns the flags.
PLPHYSICS_API void SetFlags (PLCore::uint32 nFlags=0)
 Sets the flags.
PLPHYSICS_API void ClearHitList ()
 Clears the list of hit bodies.
PLPHYSICS_API PLCore::uint32 GetNumOfHitBodies () const
 Returns the number of hit physics bodies.
PLPHYSICS_API const BodyInfoGetHitBody (PLCore::uint32 nIndex) const
 Returns a hit physics body by index.
PLPHYSICS_API const BodyInfoGetClosestBody () const
 Returns the closest hit physics body.
virtual PLPHYSICS_API
PLCore::uint32 
Check ()
 Performs an immediate sensor check.
virtual PLPHYSICS_API bool IsBody () const override
 Returns whether or not this is a body.
virtual PLPHYSICS_API bool IsJoint () const override
 Returns whether or not this is a joint.
virtual PLPHYSICS_API bool IsSensor () const override
 Returns whether or not this is a sensor.

Protected Member Functions

PLPHYSICS_API Sensor (World &cWorld, PLCore::uint32 nFlags=0)
 Constructor.
PLPHYSICS_API BodyInfoGetFreeBodyInfo ()
 Returns a free body information.
PLPHYSICS_API void FreeBodyInfo (BodyInfo &cBodyInfo)
 Frees a body information.
virtual PLPHYSICS_API bool Callback (Body &cBody, float fDistance, const PLMath::Vector3 &vNormal, int nCollisionID)
 Sensor callback function.

Detailed Description

Abstract PL physics sensor base class.

Remarks:
Can for instance be used for simple collision detection.

Member Enumeration Documentation

Flags.

Enumerator:
ClosestBody 

A performance hint that we are looking for the closest body


Constructor & Destructor Documentation

virtual PLPHYSICS_API PLPhysics::Sensor::~Sensor ( ) [virtual]

Destructor.

PLPHYSICS_API PLPhysics::Sensor::Sensor ( World cWorld,
PLCore::uint32  nFlags = 0 
) [protected]

Constructor.

Parameters:
[in]cWorldWorld this sensor is in
[in]nFlagsFlags (see EFlags)

Member Function Documentation

PLPHYSICS_API PLCore::uint32 PLPhysics::Sensor::GetFlags ( ) const

Returns the flags.

Returns:
Flags (see EFlags)
PLPHYSICS_API void PLPhysics::Sensor::SetFlags ( PLCore::uint32  nFlags = 0)

Sets the flags.

Parameters:
[in]nFlagsFlags (see EFlags)
PLPHYSICS_API void PLPhysics::Sensor::ClearHitList ( )

Clears the list of hit bodies.

PLPHYSICS_API PLCore::uint32 PLPhysics::Sensor::GetNumOfHitBodies ( ) const

Returns the number of hit physics bodies.

Returns:
The number of hit physics bodies
PLPHYSICS_API const BodyInfo* PLPhysics::Sensor::GetHitBody ( PLCore::uint32  nIndex) const

Returns a hit physics body by index.

Parameters:
[in]nIndexIndex of the hit physics body
Returns:
The hit physics body information, a null pointer on error (do NOT store a pointer on it!)
PLPHYSICS_API const BodyInfo* PLPhysics::Sensor::GetClosestBody ( ) const

Returns the closest hit physics body.

Returns:
The closest hit physics body information, a null pointer on error (do NOT store a pointer on it!)
virtual PLPHYSICS_API PLCore::uint32 PLPhysics::Sensor::Check ( ) [virtual]

Performs an immediate sensor check.

Returns:
The number of hit physics bodies
virtual PLPHYSICS_API bool PLPhysics::Sensor::IsBody ( ) const [override, virtual]

Returns whether or not this is a body.

Returns:
'true' if this is a body, else 'false'

Implements PLPhysics::Element.

virtual PLPHYSICS_API bool PLPhysics::Sensor::IsJoint ( ) const [override, virtual]

Returns whether or not this is a joint.

Returns:
'true' if this is a joint, else 'false'

Implements PLPhysics::Element.

virtual PLPHYSICS_API bool PLPhysics::Sensor::IsSensor ( ) const [override, virtual]

Returns whether or not this is a sensor.

Returns:
'true' if this is a sensor, else 'false'

Implements PLPhysics::Element.

PLPHYSICS_API BodyInfo& PLPhysics::Sensor::GetFreeBodyInfo ( ) [protected]

Returns a free body information.

Returns:
Free body information
Note:
PLPHYSICS_API void PLPhysics::Sensor::FreeBodyInfo ( BodyInfo cBodyInfo) [protected]

Frees a body information.

Parameters:
[in]cBodyInfoBody information to free
virtual PLPHYSICS_API bool PLPhysics::Sensor::Callback ( Body cBody,
float  fDistance,
const PLMath::Vector3 vNormal,
int  nCollisionID 
) [protected, virtual]

Sensor callback function.

Parameters:
[in]cBodyDetected physics body
[in]fDistanceDistance
[in]vNormalHit normal
[in]nCollisionIDCollision ID
Returns:
'true' to continue the sensor check, 'false' if stop it right now
Remarks:
The default implementation just adds the found body into a result list.

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:22
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported