本文整理汇总了C++中CElement::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CElement::GetPosition方法的具体用法?C++ CElement::GetPosition怎么用?C++ CElement::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CElement
的用法示例。
在下文中一共展示了CElement::GetPosition方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void CFreeCameraComponent::Update(double elapsedTime)
{
if ( m_Destroyed ) return;
CElement *owner = GetOwner();
m_camController->SetPosition( owner->GetPosition() );
}
示例2: Reset
void CFreeCameraComponent::Reset()
{
CElement *owner = GetOwner();
m_camController->SetPosition( owner->GetPosition() );
}
示例3: Init
void CFreeCameraComponent::Init()
{
CElement *owner = GetOwner();
m_camController->SetPosition( owner->GetPosition() );
CEngine::GetSingleton().getCameraManager()->add(getName(), m_camController);
}
示例4: DoHitDetectionForColShape
//
// Handle the changing state of collision between one colshape and any entity
//
void CColManager::DoHitDetectionForColShape ( CColShape* pShape )
{
// Ensure colshape is enabled and not being deleted
if ( pShape->IsBeingDeleted () || !pShape->IsEnabled () )
return;
std::map < CElement*, int > entityList;
// Get all entities within the sphere
CSphere querySphere = pShape->GetWorldBoundingSphere ();
CElementResult result;
GetSpatialDatabase()->SphereQuery ( result, querySphere );
// Extract relevant types
for ( CElementResult::const_iterator it = result.begin () ; it != result.end (); ++it )
{
CElement* pEntity = *it;
switch ( pEntity->GetType () )
{
case CElement::COLSHAPE:
case CElement::SCRIPTFILE:
case CElement::RADAR_AREA:
case CElement::CONSOLE:
case CElement::TEAM:
case CElement::BLIP:
case CElement::DUMMY:
break;
default:
if ( pEntity->GetParentEntity () )
entityList[ pEntity ] = 1;
}
}
// Add existing colliders, so they can be disconnected if required
for ( list < CElement* > ::const_iterator it = pShape->CollidersBegin () ; it != pShape->CollidersEnd (); ++it )
{
entityList[ *it ] = 1;
}
// Test each entity against the colshape
for ( std::map < CElement*, int > ::const_iterator it = entityList.begin () ; it != entityList.end (); ++it )
{
CElement* pEntity = it->first;
CVector vecPosition =
pEntity->GetPosition ();
// Collided?
bool bHit = pShape->DoHitDetection ( vecPosition );
HandleHitDetectionResult ( bHit, pShape, pEntity );
}
}
示例5: Read
bool CPlayerPuresyncPacket::Read ( NetBitStreamInterface& BitStream )
{
if ( m_pSourceElement )
{
CPlayer * pSourcePlayer = static_cast < CPlayer * > ( m_pSourceElement );
// Read out the time context
unsigned char ucTimeContext = 0;
if ( !BitStream.Read ( ucTimeContext ) )
return false;
// Only read this packet if it matches the current time context that
// player is in.
if ( !pSourcePlayer->CanUpdateSync ( ucTimeContext ) )
{
return false;
}
// Read out keys
CControllerState ControllerState;
ReadFullKeysync ( ControllerState, BitStream );
pSourcePlayer->GetPad ()->NewControllerState ( ControllerState );
// Read the flags
SPlayerPuresyncFlags flags;
if ( !BitStream.Read ( &flags ) )
return false;
pSourcePlayer->SetInWater ( flags.data.bIsInWater );
pSourcePlayer->SetOnGround ( flags.data.bIsOnGround );
pSourcePlayer->SetHasJetPack ( flags.data.bHasJetPack );
pSourcePlayer->SetDucked ( flags.data.bIsDucked );
pSourcePlayer->SetWearingGoggles ( flags.data.bWearsGoogles );
pSourcePlayer->SetChoking ( flags.data.bIsChoking );
pSourcePlayer->SetAkimboArmUp ( flags.data.bAkimboTargetUp );
pSourcePlayer->SetOnFire ( flags.data.bIsOnFire );
pSourcePlayer->SetStealthAiming ( flags.data.bStealthAiming );
// Contact element
CElement* pContactElement = NULL;
if ( flags.data.bHasContact )
{
ElementID Temp;
if ( !BitStream.ReadCompressed ( Temp ) )
return false;
pContactElement = CElementIDs::GetElement ( Temp );
}
CElement * pPreviousContactElement = pSourcePlayer->GetContactElement ();
pSourcePlayer->SetContactElement ( pContactElement );
if ( pPreviousContactElement != pContactElement )
{
// Call our onPlayerContact event
CLuaArguments Arguments;
if ( pPreviousContactElement )
Arguments.PushElement ( pPreviousContactElement );
else
Arguments.PushNil ();
if ( pContactElement )
Arguments.PushElement ( pContactElement );
else
Arguments.PushNil ();
pSourcePlayer->CallEvent ( "onPlayerContact", Arguments );
}
// Player position
SPositionSync position ( false );
if ( !BitStream.Read ( &position ) )
return false;
if ( pContactElement )
{
pSourcePlayer->SetContactPosition ( position.data.vecPosition );
// Get the true position
CVector vecTempPos = pContactElement->GetPosition ();
position.data.vecPosition += vecTempPos;
}
pSourcePlayer->SetPosition ( position.data.vecPosition );
// Player rotation
SPedRotationSync rotation;
if ( !BitStream.Read ( &rotation ) )
return false;
pSourcePlayer->SetRotation ( rotation.data.fRotation );
// Move speed vector
if ( flags.data.bSyncingVelocity )
{
SVelocitySync velocity;
if ( !BitStream.Read ( &velocity ) )
return false;
pSourcePlayer->SetVelocity ( velocity.data.vecVelocity );
}
// Health ( stored with damage )
SPlayerHealthSync health;
if ( !BitStream.Read ( &health ) )
return false;
//.........这里部分代码省略.........