NLPACS::CMovePrimitive Class Reference

#include <move_primitive.h>

Inheritance diagram for NLPACS::CMovePrimitive:

NLPACS::UMovePrimitive

Detailed Description

Description of movables primitives.

This primitive can be a 2d oriented box or a 2d oriented cylinder.

Author:
Cyril 'Hulud' Corvazier

Nevrax France

Date:
2001

Definition at line 52 of file move_primitive.h.

From UMovePrimitive

bool checkTestTime (uint32 testTime, uint32 maxTestIteration)
float getAbsorbtion () const
TCollisionMask getCollisionMask () const
NLMISC::CVectorD getFinalPosition (uint8 worldImage) const
void getGlobalPosition (UGlobalPosition &pos, uint8 worldImage) const
float getHeight () const
float getMass () const
bool getObstacle () const
TCollisionMask getOcclusionMask () const
double getOrientation (uint8 worldImage) const
TType getPrimitiveType () const
float getRadius () const
TReaction getReactionType () const
void getSize (float &width, float &depth) const
const NLMISC::CVectorDgetSpeed (uint8 worldImage) const
TTrigger getTriggerType () const
void insertInWorldImage (uint8 worldImage)
bool isInCollision (CMovePrimitive *primitive)
void move (const NLMISC::CVectorD &speed, uint8 worldImage)
void removeFromWorldImage (uint8 worldImage)
void setAbsorbtion (float attenuation)
void setGlobalPosition (const UGlobalPosition &pos, uint8 worldImage)
void setGlobalPosition (const NLMISC::CVectorD &pos, uint8 worldImage, UGlobalPosition::TType type=UGlobalPosition::Unspecified)
void setOrientation (double rot, uint8 worldImage)
float _Attenuation
TCollisionMask _CollisionMask
CMoveContainer_Container
uint8 _FirstWorldImage
float _Height
sint32 _IterationCount
uint32 _LastTestTime
float _Length [2]
uint8 _NumWorldImage
TCollisionMask _OcclusionMask
CCollisionOTInfo_RootOTInfo
uint16 _StaticFlags
CPrimitiveWorldImage ** _WorldImages

Public Types

typedef uint32 TCollisionMask
 Type of the collision mask.

enum  TReaction { DoNothing = 0x0, Slide = 0x10, Reflexion = 0x20, Stop = 0x40 }
 Reaction mode. More...

enum  TTrigger { NotATrigger = 0x0, EnterTrigger = 0x100, ExitTrigger = 0x200, OverlapTrigger = 0x400 }
 Reaction mode. More...

enum  TType { _2DOrientedBox = 0x0, _2DOrientedCylinder = 0x1 }
 Primitive mode. More...

typedef uint64 TUserData

Public Member Functions

void addCollisionOTInfo (CCollisionOTInfo *info)
 Add a collision time ordered table element.

void checkSortedList ()
 Check sorted lists.

 CMovePrimitive (CMoveContainer *container, uint8 firstWorldImage, uint8 numWorldImage)
 Constructor.

void dirtAllPos ()
float getAttenuation () const
 Get attenuation.

TCollisionMask getCollisionMaskInternal () const
 Get collision mask.

bool getDontSnapToGround () const
 Test if snapping to ground is off.

uint8 getFirstWorldImage () const
virtual uint8 getFirstWorldImageV () const
float getHeightInternal () const
 Get height.

float getLength (uint where) const
 Get length.

uint8 getNumWorldImage () const
virtual uint8 getNumWorldImageV () const
TCollisionMask getOcclusionMaskInternal () const
 Get occlusion mask.

TType getPrimitiveTypeInternal () const
 Get primitive type.

float getRadiusInternal () const
 Get length.

TReaction getReactionTypeInternal () const
 Get reaction type.

TTrigger getTriggerTypeInternal () const
 Get reaction type.

CPrimitiveWorldImagegetWorldImage (uint i) const
bool isCollisionable () const
 Is collisionable.

bool isInserted (uint i) const
bool isNonCollisionable () const
bool isObstacle () const
 Is an obstacle ?

bool isTriggered (CMovePrimitive &second, bool enter, bool exit)
 Check trigger flag.

void removeCollisionOTInfo ()
 Remove all collision time ordered table element.

void removeCollisionOTInfo (CCollisionOTInfo *toRemove)
 Remove one collision time ordered table element.

void setCollisionMask (TCollisionMask mask)
virtual void setDontSnapToGround (bool dont)
void setHeight (float height)
void setNonCollisionable (bool nonCollisionable)
void setObstacle (bool obstacle)
void setOcclusionMask (TCollisionMask mask)
void setPrimitiveType (TType type)
void setRadius (float radius)
void setReactionType (TReaction type)
void setSize (float width, float depth)
void setTriggerType (TTrigger type)
virtual ~CMovePrimitive ()
 Destructor.


Data Fields

TUserData UserData

Private Types

enum  TStaticFlags {
  PrimitiveMask = 0x000f, ReactionMask = 0x00f0, TriggerMask = 0x0f00, ObstacleFlag = 0x1000,
  NonCollisionableFlag = 0x2000, DontSnapToGroundFlag = 0x4000, ForceSize = 0xffff
}

Friends

class CMoveContainer


Member Typedef Documentation

typedef uint32 NLPACS::UMovePrimitive::TCollisionMask [inherited]
 

Type of the collision mask.

Definition at line 57 of file u_move_primitive.h.

Referenced by NLNET::CPacsClient::setCollisionMask(), and NLNET::CPacsClient::setOcclusionMask().

typedef uint64 NLPACS::UMovePrimitive::TUserData [inherited]
 

Definition at line 58 of file u_move_primitive.h.

Referenced by NLNET::CPacsClient::addPrimitive(), NLNET::cbPacsAnswer(), NLNET::CPacsClient::getPositionSpeed(), NLNET::CPacsClient::getPositionSpeedCallback(), NLPACS::CPrimitiveBlock::getUserData(), NLNET::CPacsClient::removePrimitive(), NLNET::CPacsClient::setCurrentPrimitive(), NLNET::CPacsClient::testMove(), and NLNET::CPacsClient::testMoveCallback().


Member Enumeration Documentation

enum NLPACS::UMovePrimitive::TReaction [inherited]
 

Reaction mode.

Enumeration values:
DoNothing  No reaction. For static objects or not influanced objects. Default value.
Slide  This object slids over surfaces.
Reflexion  This object reflects over surfaces.
Stop  This object stops over surfaces.

Definition at line 80 of file u_move_primitive.h.

00081         {
00085                 DoNothing=0x0,
00086 
00090                 Slide=0x10,
00091 
00095                 Reflexion=0x20,
00096 
00100                 Stop=0x40,
00101         };

enum NLPACS::CMovePrimitive::TStaticFlags [private]
 

Enumeration values:
PrimitiveMask 
ReactionMask 
TriggerMask 
ObstacleFlag 
NonCollisionableFlag 
DontSnapToGroundFlag  The primitive shoudln't be snapped to ground.
ForceSize 

Definition at line 58 of file move_primitive.h.

00059         {
00060                 // Mask for the primitive type
00061                 PrimitiveMask   =0x000f,
00062 
00063                 // Mask for the primitive type
00064                 ReactionMask    =0x00f0,
00065 
00066                 // Mask for the trigger type
00067                 TriggerMask             =0x0f00,
00068 
00069                 // Obstacle flag. This flag tells that this object is an obstacle for others objects.
00070                 ObstacleFlag    =0x1000,
00071 
00072                 // Ghost flag. This flag tells that this object is a ghost object or not.
00073                 NonCollisionableFlag    =0x2000,
00074                 
00076                 DontSnapToGroundFlag = 0x4000,
00077 
00078                 // Force the size to uint16.
00079                 ForceSize               =0xffff
00080         };

enum NLPACS::UMovePrimitive::TTrigger [inherited]
 

Reaction mode.

Enumeration values:
NotATrigger  Not a trigger.
EnterTrigger  This is a one time trigger. This trigger is actived only when an object enter in its volume.
ExitTrigger  This is a one time trigger. This trigger is actived only when an object exit from its volume.
OverlapTrigger  This is an overlap trigger. This trigger is actived each time the object overlap the trigger.

Definition at line 104 of file u_move_primitive.h.

00105         {
00109                 NotATrigger=0x0,
00110 
00114                 EnterTrigger=0x100,
00115 
00119                 ExitTrigger=0x200,
00120 
00124                 OverlapTrigger=0x400,
00125         };

enum NLPACS::UMovePrimitive::TType [inherited]
 

Primitive mode.

Enumeration values:
_2DOrientedBox  This is a static 2d oriented bounding box. It can be oriented only on the Z axis. It has a height. Collision can be performed only no its sides but not on its top and bottom planes. It doesn't mode. Default value.
_2DOrientedCylinder  This is a movable 2d oriented cylinder. It can be oriented only on the Z axis. It has a height. Collision can be performed only no its sides but not on its top and bottom planes. It can move only with 3d translations.

Definition at line 61 of file u_move_primitive.h.

00062         {
00068                 _2DOrientedBox=0x0,
00069 
00075                 _2DOrientedCylinder=0x1,
00076         };


Constructor & Destructor Documentation

NLPACS::CMovePrimitive::CMovePrimitive CMoveContainer container,
uint8  firstWorldImage,
uint8  numWorldImage
 

Constructor.

virtual NLPACS::CMovePrimitive::~CMovePrimitive  )  [virtual]
 

Destructor.


Member Function Documentation

void NLPACS::CMovePrimitive::addCollisionOTInfo CCollisionOTInfo info  )  [inline]
 

Add a collision time ordered table element.

Definition at line 349 of file move_primitive.h.

References _RootOTInfo, and NLPACS::CCollisionOTInfo::primitiveLink().

00350         {
00351                 // Link to the list
00352                 info->primitiveLink (this, _RootOTInfo);
00353                 _RootOTInfo=info;
00354         }

void NLPACS::CMovePrimitive::checkSortedList  ) 
 

Check sorted lists.

bool NLPACS::CMovePrimitive::checkTestTime uint32  testTime,
uint32  maxTestIteration
[inline]
 

Definition at line 393 of file move_primitive.h.

References _IterationCount, _LastTestTime, and uint32.

Referenced by NLPACS::CPrimitiveWorldImage::evalCollision().

00394         {
00395                 // Already checked for this test time ?
00396                 if (testTime!=_LastTestTime)
00397                 {
00398                         // First time this primitive is visited at this test
00399                         _LastTestTime=testTime;
00400 
00401                         // Test counter
00402                         _IterationCount=maxTestIteration;
00403                 }
00404                 else
00405                 {
00406                         // Too many test this primitive ?
00407                         if (_IterationCount<=0)
00408                         {
00409 //                              nlwarning("in checkTestTime(): Get to the max iteration count");
00410                                 return false;
00411                         }
00412                         else
00413                                 _IterationCount--;
00414                 }
00415                 // Ok, test can be performed
00416                 return true;
00417         }

void NLPACS::CMovePrimitive::dirtAllPos  )  [inline]
 

Definition at line 154 of file move_primitive.h.

References _Container, _NumWorldImage, _WorldImages, NLPACS::CPrimitiveWorldImage::dirtPos(), and uint.

00155         {
00156                 for (uint i=0; i<_NumWorldImage; i++)
00157                 {
00158                         // Get world image and check if it exist
00159                         CPrimitiveWorldImage    *worldImage=_WorldImages[i];
00160 
00161                         // Dirt its pos
00162                         worldImage->dirtPos (_Container, this, i+_FirstWorldImage);
00163                 }
00164         }

float NLPACS::CMovePrimitive::getAbsorbtion  )  const [virtual]
 

Set the attenuation of collision for this object. Default value is 1. Should be between 0~1. 0, all the enrgy is attenuated by the collision. 1, all the energy stay in the object. Used only with the flag Reflexion.

Parameters:
attenuation is the new attenuation for the primitive.

Implements NLPACS::UMovePrimitive.

float NLPACS::CMovePrimitive::getAttenuation  )  const [inline]
 

Get attenuation.

Definition at line 313 of file move_primitive.h.

References _Attenuation.

Referenced by NLPACS::CPrimitiveWorldImage::reaction().

00314         {
00315                 return _Attenuation;
00316         }

TCollisionMask NLPACS::CMovePrimitive::getCollisionMask  )  const [virtual]
 

Set the collision mask for this primitive. Default mask is 0xffffffff.

Parameters:
mask is the new collision mask.

Implements NLPACS::UMovePrimitive.

TCollisionMask NLPACS::CMovePrimitive::getCollisionMaskInternal  )  const [inline]
 

Get collision mask.

Definition at line 299 of file move_primitive.h.

References _CollisionMask.

Referenced by NLPACS::CPrimitiveWorldImage::evalCollision().

00300         {
00301                 // New position
00302                 return _CollisionMask;
00303         }

bool NLPACS::CMovePrimitive::getDontSnapToGround  )  const [inline, virtual]
 

Test if snapping to ground is off.

Implements NLPACS::UMovePrimitive.

Definition at line 96 of file move_primitive.h.

References _StaticFlags, and DontSnapToGroundFlag.

00097         {
00098                 return (_StaticFlags & DontSnapToGroundFlag) != 0;
00099         }

NLMISC::CVectorD NLPACS::CMovePrimitive::getFinalPosition uint8  worldImage  )  const [virtual]
 

Get the position of the move primitive at the end of the movement. This method is slow. Just for initilisation and teleportation.

If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.

Returns:
the new position of the primitive.

Implements NLPACS::UMovePrimitive.

uint8 NLPACS::CMovePrimitive::getFirstWorldImage  )  const [inline]
 

Definition at line 142 of file move_primitive.h.

References uint8.

00143         {
00144                 return _FirstWorldImage;
00145         }

virtual uint8 NLPACS::CMovePrimitive::getFirstWorldImageV  )  const [virtual]
 

Return the first world image

Implements NLPACS::UMovePrimitive.

void NLPACS::CMovePrimitive::getGlobalPosition UGlobalPosition pos,
uint8  worldImage
const [virtual]
 

Set the global position of the move primitive. This method is fast because you must pass the global position of the primitive.

If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.

Parameters:
pos is the new global position of the primitive.

Implements NLPACS::UMovePrimitive.

float NLPACS::CMovePrimitive::getHeight  )  const [virtual]
 

Set the height. For boxes or cylinder.

Parameters:
height is the new height size of the box. It the size of the sides aligned on OZ.

Implements NLPACS::UMovePrimitive.

float NLPACS::CMovePrimitive::getHeightInternal  )  const [inline]
 

Get height.

Definition at line 325 of file move_primitive.h.

Referenced by NLPACS::CPrimitiveWorldImage::evalCollisionOCoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverS(), and NLPACS::CPrimitiveWorldImage::evalCollisionSoverOC().

00326         {
00327                 return _Height;
00328         }

float NLPACS::CMovePrimitive::getLength uint  where  )  const [inline]
 

Get length.

Definition at line 319 of file move_primitive.h.

References uint.

Referenced by NLPACS::CPrimitiveWorldImage::evalCollision(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverS(), NLPACS::CPrimitiveWorldImage::evalCollisionSoverOC(), and NLPACS::CPrimitiveWorldImage::precalcPos().

00320         {
00321                 return _Length[where];
00322         }

float NLPACS::CMovePrimitive::getMass  )  const [inline]
 

Definition at line 421 of file move_primitive.h.

References _StaticFlags, nlassert, and PrimitiveMask.

Referenced by NLPACS::CPrimitiveWorldImage::reaction().

00422         {
00423                 // Box ?
00424                 if ( (_StaticFlags&PrimitiveMask) == _2DOrientedBox )
00425                         return _Length[0]*_Length[1]*_Height;
00426                 // Cylinder ?
00427                 else
00428                 {
00429                         nlassert ( (_StaticFlags&PrimitiveMask) == _2DOrientedCylinder );
00430                         return _Length[0]*(float)NLMISC::Pi*_Height;
00431                 }
00432         }

uint8 NLPACS::CMovePrimitive::getNumWorldImage  )  const [inline]
 

Definition at line 148 of file move_primitive.h.

References _NumWorldImage, and uint8.

00149         {
00150                 return _NumWorldImage;
00151         }

virtual uint8 NLPACS::CMovePrimitive::getNumWorldImageV  )  const [virtual]
 

Return the num of world image

Implements NLPACS::UMovePrimitive.

bool NLPACS::CMovePrimitive::getObstacle  )  const [virtual]
 

Set the obstacle flag.

Parameters:
obstacle is true if this primitive is an obstacle, else false.

Implements NLPACS::UMovePrimitive.

TCollisionMask NLPACS::CMovePrimitive::getOcclusionMask  )  const [virtual]
 

Set the occlusion mask for this primitive. Default mask is 0xffffffff.

Parameters:
mask is the new occlusion mask.

Implements NLPACS::UMovePrimitive.

TCollisionMask NLPACS::CMovePrimitive::getOcclusionMaskInternal  )  const [inline]
 

Get occlusion mask.

Definition at line 306 of file move_primitive.h.

References _OcclusionMask.

Referenced by NLPACS::CPrimitiveWorldImage::evalCollision().

00307         {
00308                 // New position
00309                 return _OcclusionMask;
00310         }

double NLPACS::CMovePrimitive::getOrientation uint8  worldImage  )  const [virtual]
 

Set the new orientation of the move primitive. Only for the box primitives.

If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.

Parameters:
rot is the new OZ rotation in radian.
worldImage is the world image in which the primitive must be oriented.

Implements NLPACS::UMovePrimitive.

TType NLPACS::CMovePrimitive::getPrimitiveType  )  const [virtual]
 

Set the primitive type.

Parameters:
type is the new primitive type.

Implements NLPACS::UMovePrimitive.

TType NLPACS::CMovePrimitive::getPrimitiveTypeInternal  )  const [inline]
 

Get primitive type.

Definition at line 278 of file move_primitive.h.

References _StaticFlags, PrimitiveMask, and uint32.

Referenced by NLPACS::CPrimitiveWorldImage::evalCollision(), NLPACS::CPrimitiveWorldImage::evalCollisionOBoverOB(), NLPACS::CPrimitiveWorldImage::evalCollisionOBoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionOCoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverS(), NLPACS::CPrimitiveWorldImage::evalCollisionSoverOC(), NLPACS::CPrimitiveWorldImage::precalcBB(), and NLPACS::CPrimitiveWorldImage::precalcPos().

00279         {
00280                 // New position
00281                 return (TType)(_StaticFlags&(uint32)PrimitiveMask);
00282         }

float NLPACS::CMovePrimitive::getRadius  )  const [virtual]
 

Set the cylinder size. Only for cylinder.

Parameters:
radius is the new radius size of the cylinder.

Implements NLPACS::UMovePrimitive.

float NLPACS::CMovePrimitive::getRadiusInternal  )  const [inline]
 

Get length.

Definition at line 331 of file move_primitive.h.

Referenced by NLPACS::CPrimitiveWorldImage::evalCollision(), NLPACS::CPrimitiveWorldImage::evalCollisionOCoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionPoverOC(), NLPACS::CPrimitiveWorldImage::evalCollisionSoverOC(), and NLPACS::CPrimitiveWorldImage::precalcBB().

00332         {
00333                 return _Length[0];
00334         }

TReaction NLPACS::CMovePrimitive::getReactionType  )  const [virtual]
 

Set the reaction type.

Parameters:
type is the new reaction type.

Implements NLPACS::UMovePrimitive.

TReaction NLPACS::CMovePrimitive::getReactionTypeInternal  )  const [inline]
 

Get reaction type.

Definition at line 285 of file move_primitive.h.

References _StaticFlags, ReactionMask, and uint32.

Referenced by NLPACS::CPrimitiveWorldImage::reaction().

00286         {
00287                 // New position
00288                 return (TReaction)(_StaticFlags&(uint32)ReactionMask);
00289         }

void NLPACS::CMovePrimitive::getSize float &  width,
float &  depth
const [virtual]
 

Set the box size. Only for boxes.

Parameters:
width is the new width size of the box. It the size of the sides aligned on OX.
depth is the new depth size of the box. It the size of the sides aligned on OY.

Implements NLPACS::UMovePrimitive.

const NLMISC::CVectorD& NLPACS::CMovePrimitive::getSpeed uint8  worldImage  )  const [virtual]
 

Get the speed vector for this primitive.

the new speed vector.

Implements NLPACS::UMovePrimitive.

TTrigger NLPACS::CMovePrimitive::getTriggerType  )  const [virtual]
 

Set the trigger type. Default type is NotATrigger.

Parameters:
type is the new trigger type.

Implements NLPACS::UMovePrimitive.

TTrigger NLPACS::CMovePrimitive::getTriggerTypeInternal  )  const [inline]
 

Get reaction type.

Definition at line 292 of file move_primitive.h.

References _StaticFlags, TriggerMask, and uint32.

00293         {
00294                 // New position
00295                 return (TTrigger)(_StaticFlags&(uint32)TriggerMask);
00296         }

CPrimitiveWorldImage* NLPACS::CMovePrimitive::getWorldImage uint  i  )  const [inline]
 

Definition at line 116 of file move_primitive.h.

References _NumWorldImage, _WorldImages, nlassert, and uint.

Referenced by NLPACS::CMoveContainer::changed(), NLPACS::CPrimitiveWorldImage::checkSortedList(), isInserted(), and NLPACS::CMoveCell::updateSortedLists().

00117         {
00118                 // Checks this primitive belong of the requested world image.
00119                 nlassert ((i>=(uint)_FirstWorldImage)&&(i<(uint)_FirstWorldImage+(uint)_NumWorldImage));
00120 
00121                 // Return the good one
00122                 return _WorldImages[i-_FirstWorldImage];
00123         }

void NLPACS::CMovePrimitive::insertInWorldImage uint8  worldImage  )  [virtual]
 

Insert the primitive in a world image of the move container.

This primitive must a collisionable primitive.

Parameters:
worldImage is the number of the world image where you want to insert the primitive.

Implements NLPACS::UMovePrimitive.

bool NLPACS::CMovePrimitive::isCollisionable  )  const [inline, virtual]
 

Is collisionable.

Implements NLPACS::UMovePrimitive.

Definition at line 343 of file move_primitive.h.

References isNonCollisionable().

Referenced by NLPACS::CMoveContainer::changed().

00344         {
00345                 return !isNonCollisionable();
00346         }

bool NLPACS::CMovePrimitive::isInCollision CMovePrimitive primitive  ) 
 

bool NLPACS::CMovePrimitive::isInserted uint  i  )  const [inline]
 

Definition at line 126 of file move_primitive.h.

References _NumWorldImage, getWorldImage(), NLPACS::CPrimitiveWorldImage::isInWorldImageFlag(), and uint.

00127         {
00128                 // Checks
00129                 if ((i>=(uint)_FirstWorldImage)&&(i<(uint)_FirstWorldImage+(uint)_NumWorldImage))
00130                 {
00131                         // Get world image
00132                         return getWorldImage (i)->isInWorldImageFlag ();
00133                 }
00134                 else
00135                         return false;
00136         }

bool NLPACS::CMovePrimitive::isNonCollisionable  )  const [inline]
 

Definition at line 101 of file move_primitive.h.

References _StaticFlags, and NonCollisionableFlag.

Referenced by isCollisionable().

00102         {
00103                 return (_StaticFlags&NonCollisionableFlag)!=0;
00104         }

bool NLPACS::CMovePrimitive::isObstacle  )  const [inline]
 

Is an obstacle ?

Definition at line 337 of file move_primitive.h.

References _StaticFlags, and ObstacleFlag.

Referenced by NLPACS::CPrimitiveWorldImage::reaction().

00338         {
00339                 return (_StaticFlags&ObstacleFlag)!=0;
00340         }

bool NLPACS::CMovePrimitive::isTriggered CMovePrimitive second,
bool  enter,
bool  exit
 

Check trigger flag.

void NLPACS::CMovePrimitive::move const NLMISC::CVectorD speed,
uint8  worldImage
[virtual]
 

Move the primitive. This method is fast. Use it to move primitives.

If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.

Parameters:
speed is the speed of the primitive.

Implements NLPACS::UMovePrimitive.

void NLPACS::CMovePrimitive::removeCollisionOTInfo  ) 
 

Remove all collision time ordered table element.

void NLPACS::CMovePrimitive::removeCollisionOTInfo CCollisionOTInfo toRemove  ) 
 

Remove one collision time ordered table element.

Referenced by NLPACS::CCollisionOTStaticInfo::removeFromPrimitives(), and NLPACS::CCollisionOTDynamicInfo::removeFromPrimitives().

void NLPACS::CMovePrimitive::removeFromWorldImage uint8  worldImage  )  [virtual]
 

Remove the primitive from a world image of the move container.

This primitive must a collisionable primitive.

Parameters:
worldImage is the number of the world image from where you want to remove the primitive.

Implements NLPACS::UMovePrimitive.

void NLPACS::CMovePrimitive::setAbsorbtion float  attenuation  )  [virtual]
 

Set the attenuation of collision for this object. Default value is 1. Should be between 0~1. 0, all the enrgy is attenuated by the collision. 1, all the energy stay in the object. Used only with the flag Reflexion.

Parameters:
attenuation is the new attenuation for the primitive.

Implements NLPACS::UMovePrimitive.

void NLPACS::CMovePrimitive::setCollisionMask TCollisionMask  mask  )  [inline, virtual]
 

Set the collision mask for this primitive. Default mask is 0xffffffff.

Parameters:
mask is the new collision mask.

Implements NLPACS::UMovePrimitive.

Definition at line 207 of file move_primitive.h.

References _CollisionMask.

00208         {
00209                 _CollisionMask=mask;
00210         }

virtual void NLPACS::CMovePrimitive::setDontSnapToGround bool  dont  )  [inline, virtual]
 

Tells that the primitive should not be snapped to ground. The default is false

Implements NLPACS::UMovePrimitive.

Definition at line 90 of file move_primitive.h.

References _StaticFlags, and DontSnapToGroundFlag.

00091         {
00092                 if (dont) _StaticFlags |= DontSnapToGroundFlag;
00093                 else _StaticFlags &= ~DontSnapToGroundFlag;
00094         }

void NLPACS::CMovePrimitive::setGlobalPosition const UGlobalPosition pos,
uint8  worldImage
[virtual]
 

Set the global position of the move primitive. This method is fast because you must pass the global position of the primitive.

If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.

Parameters:
pos is the new global position of the primitive.

Implements NLPACS::UMovePrimitive.

void NLPACS::CMovePrimitive::setGlobalPosition const NLMISC::CVectorD pos,
uint8  worldImage,
UGlobalPosition::TType  type = UGlobalPosition::Unspecified
[virtual]
 

Set the global position of the move primitive. Setting the global position can take a long time if you use a UGlobalRetriever. Set the position with this method only the first time or for teleporting.

If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.

Parameters:
pos is the new global position of the primitive.

Implements NLPACS::UMovePrimitive.

void NLPACS::CMovePrimitive::setHeight float  height  )  [inline, virtual]
 

Set the height. For boxes or cylinder.

Parameters:
height is the new height size of the box. It the size of the sides aligned on OZ.

Implements NLPACS::UMovePrimitive.

Definition at line 257 of file move_primitive.h.

References height.

00258         {
00259                 // New size
00260                 _Height=height;
00261         }

void NLPACS::CMovePrimitive::setNonCollisionable bool  nonCollisionable  )  [inline]
 

Definition at line 107 of file move_primitive.h.

References _StaticFlags, and NonCollisionableFlag.

00108         {
00109                 if (nonCollisionable)
00110                         _StaticFlags|=NonCollisionableFlag;
00111                 else
00112                         _StaticFlags&=~NonCollisionableFlag;
00113         }

void NLPACS::CMovePrimitive::setObstacle bool  obstacle  )  [inline, virtual]
 

Set the obstacle flag.

Parameters:
obstacle is true if this primitive is an obstacle, else false.

Implements NLPACS::UMovePrimitive.

Definition at line 227 of file move_primitive.h.

References _StaticFlags, ObstacleFlag, and uint32.

00228         {
00229                 // New flag
00230                 if (obstacle)
00231                         _StaticFlags|=ObstacleFlag;
00232                 else
00233                         _StaticFlags&=~(uint32)ObstacleFlag;
00234         }

void NLPACS::CMovePrimitive::setOcclusionMask TCollisionMask  mask  )  [inline, virtual]
 

Set the occlusion mask for this primitive. Default mask is 0xffffffff.

Parameters:
mask is the new occlusion mask.

Implements NLPACS::UMovePrimitive.

Definition at line 217 of file move_primitive.h.

References _OcclusionMask.

00218         {
00219                 _OcclusionMask=mask;
00220         }

void NLPACS::CMovePrimitive::setOrientation double  rot,
uint8  worldImage
[virtual]
 

Set the new orientation of the move primitive. Only for the box primitives.

If you modify a noncollisionable primitive with this method, you must evaluate in the world image where you have modify it before modify any other dynamic properties in another world image.

Parameters:
rot is the new OZ rotation in radian.
worldImage is the world image in which the primitive must be oriented.

Implements NLPACS::UMovePrimitive.

void NLPACS::CMovePrimitive::setPrimitiveType TType  type  )  [inline, virtual]
 

Set the primitive type.

Parameters:
type is the new primitive type.

Implements NLPACS::UMovePrimitive.

Definition at line 171 of file move_primitive.h.

References _StaticFlags, PrimitiveMask, type, and uint32.

00172         {
00173                 // New position
00174                 _StaticFlags&=~(uint32)PrimitiveMask;
00175                 _StaticFlags|=type;
00176         }

void NLPACS::CMovePrimitive::setRadius float  radius  )  [inline, virtual]
 

Set the cylinder size. Only for cylinder.

Parameters:
radius is the new radius size of the cylinder.

Implements NLPACS::UMovePrimitive.

Definition at line 268 of file move_primitive.h.

References _StaticFlags, nlassert, PrimitiveMask, and uint32.

00269         {
00270                 // Checks
00271                 nlassert ((((uint32)_StaticFlags)&PrimitiveMask)==_2DOrientedCylinder);
00272 
00273                 // New position
00274                 _Length[0]=radius;
00275         }

void NLPACS::CMovePrimitive::setReactionType TReaction  type  )  [inline, virtual]
 

Set the reaction type.

Parameters:
type is the new reaction type.

Implements NLPACS::UMovePrimitive.

Definition at line 183 of file move_primitive.h.

References _StaticFlags, ReactionMask, type, and uint32.

00184         {
00185                 // New position
00186                 _StaticFlags&=~(uint32)ReactionMask;
00187                 _StaticFlags|=type;
00188         }

void NLPACS::CMovePrimitive::setSize float  width,
float  depth
[inline, virtual]
 

Set the box size. Only for boxes.

Parameters:
width is the new width size of the box. It the size of the sides aligned on OX.
depth is the new depth size of the box. It the size of the sides aligned on OY.

Implements NLPACS::UMovePrimitive.

Definition at line 242 of file move_primitive.h.

References _StaticFlags, depth, nlassert, PrimitiveMask, uint32, and width.

00243         {
00244                 // Checks
00245                 nlassert ((((uint32)_StaticFlags)&PrimitiveMask)==_2DOrientedBox);
00246 
00247                 // New position
00248                 _Length[0]=width;
00249                 _Length[1]=depth;
00250         }

void NLPACS::CMovePrimitive::setTriggerType TTrigger  type  )  [inline, virtual]
 

Set the trigger type. Default type is NotATrigger.

Parameters:
type is the new trigger type.

Implements NLPACS::UMovePrimitive.

Definition at line 195 of file move_primitive.h.

References _StaticFlags, TriggerMask, type, and uint32.

00196         {
00197                 // New position
00198                 _StaticFlags&=~(uint32)TriggerMask;
00199                 _StaticFlags|=type;
00200         }


Friends And Related Function Documentation

friend class CMoveContainer [friend]
 

Definition at line 55 of file move_primitive.h.


Field Documentation

float NLPACS::CMovePrimitive::_Attenuation [private]
 

Definition at line 447 of file move_primitive.h.

Referenced by getAttenuation().

TCollisionMask NLPACS::CMovePrimitive::_CollisionMask [private]
 

Definition at line 462 of file move_primitive.h.

Referenced by getCollisionMaskInternal(), and setCollisionMask().

CMoveContainer* NLPACS::CMovePrimitive::_Container [private]
 

Definition at line 465 of file move_primitive.h.

Referenced by dirtAllPos().

uint8 NLPACS::CMovePrimitive::_FirstWorldImage [private]
 

Definition at line 456 of file move_primitive.h.

float NLPACS::CMovePrimitive::_Height [private]
 

Definition at line 444 of file move_primitive.h.

sint32 NLPACS::CMovePrimitive::_IterationCount [private]
 

Definition at line 477 of file move_primitive.h.

Referenced by checkTestTime().

uint32 NLPACS::CMovePrimitive::_LastTestTime [private]
 

Definition at line 474 of file move_primitive.h.

Referenced by checkTestTime().

float NLPACS::CMovePrimitive::_Length[2] [private]
 

Definition at line 441 of file move_primitive.h.

uint8 NLPACS::CMovePrimitive::_NumWorldImage [private]
 

Definition at line 453 of file move_primitive.h.

Referenced by dirtAllPos(), getNumWorldImage(), getWorldImage(), and isInserted().

TCollisionMask NLPACS::CMovePrimitive::_OcclusionMask [private]
 

Definition at line 459 of file move_primitive.h.

Referenced by getOcclusionMaskInternal(), and setOcclusionMask().

CCollisionOTInfo* NLPACS::CMovePrimitive::_RootOTInfo [private]
 

Definition at line 468 of file move_primitive.h.

Referenced by addCollisionOTInfo().

uint16 NLPACS::CMovePrimitive::_StaticFlags [private]
 

Definition at line 450 of file move_primitive.h.

Referenced by getDontSnapToGround(), getMass(), getPrimitiveTypeInternal(), getReactionTypeInternal(), getTriggerTypeInternal(), isNonCollisionable(), isObstacle(), setDontSnapToGround(), setNonCollisionable(), setObstacle(), setPrimitiveType(), setRadius(), setReactionType(), setSize(), and setTriggerType().

CPrimitiveWorldImage** NLPACS::CMovePrimitive::_WorldImages [private]
 

Definition at line 471 of file move_primitive.h.

Referenced by dirtAllPos(), and getWorldImage().

TUserData NLPACS::UMovePrimitive::UserData [inherited]
 

User data.

Definition at line 130 of file u_move_primitive.h.


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 14:18:58 2004 for NeL by doxygen 1.3.6