本文整理汇总了C++中UpdatePosition函数的典型用法代码示例。如果您正苦于以下问题:C++ UpdatePosition函数的具体用法?C++ UpdatePosition怎么用?C++ UpdatePosition使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UpdatePosition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPosition
void Camera::MenuCameraRotation()
{
// Create rotation matrix
m_menuRotation += (float)GLOBAL::GetInstance().GetDeltaTime() / 16.0f;
if (m_menuRotation > 6.28f)
{
m_menuRotation = 0.0f;
}
DirectX::XMMATRIX rotation = DirectX::XMMatrixRotationY(m_menuRotation);
// Lock shadows in center.
DirectX::XMFLOAT3 shadowPosition = GetPosition();
DirectX::XMStoreFloat3(&shadowPosition, DirectX::XMVector3TransformCoord(DirectX::XMLoadFloat3(&shadowPosition), rotation));
shadowPosition.x *= 0.8f;
DirectX::XMFLOAT3 position = DirectX::XMFLOAT3(25.0f + shadowPosition.x, 100.0f, 50.0f);
UpdatePosition(position);
UpdateTarget(DirectX::XMFLOAT3(shadowPosition.x, 5.0f, 0.0f));
UpdateViewMatrix();
UpdateProjectionMatrix(true);
GraphicsEngine::SetLightViewAndProjection(GetViewMatrix(), GetProjectionMatrix());
// Lock camera in center and rotate camera.
position = DirectX::XMFLOAT3(0.0f, 40.0f, -24.0f);
UpdatePosition(position);
UpdateTarget(DirectX::XMFLOAT3(0.0f, 7.5f, 0.0f));
UpdateViewMatrix();
UpdateProjectionMatrix(false);
DirectX::XMStoreFloat4x4(&m_viewMatrix, DirectX::XMMatrixMultiply(rotation, DirectX::XMLoadFloat4x4(&m_viewMatrix)));
GraphicsEngine::SetViewAndProjection(GetViewMatrix(), GetProjectionMatrix());
}
示例2: UpdateVelocity
void Player::UpdateStatus()
{
if ( GetKeyState(VK_ADD) == KEY_DOWN || GetKeyState(VK_ADD) == KEY_PRESSED )
{
UpdateVelocity(1.05f) ;
}
if ( GetKeyState(VK_SUBTRACT) == KEY_DOWN || GetKeyState(VK_SUBTRACT) == KEY_PRESSED )
{
UpdateVelocity(0.95f) ;
}
if ( GetKeyState(VK_DOWN) == KEY_DOWN || GetKeyState(VK_DOWN) == KEY_PRESSED )
{
UpdatePosition(0, 10.f) ;
}
if ( GetKeyState(VK_UP) == KEY_DOWN || GetKeyState(VK_UP) == KEY_PRESSED )
{
UpdatePosition(0, -10.f) ;
}
if ( GetKeyState(VK_LEFT) == KEY_DOWN || GetKeyState(VK_LEFT) == KEY_PRESSED )
{
UpdatePosition(-10.f, 0) ;
}
if ( GetKeyState(VK_RIGHT) == KEY_DOWN || GetKeyState(VK_RIGHT) == KEY_PRESSED)
{
UpdatePosition(10.f, 0) ;
}
}
示例3: UpdatePosition
void Camera::FollowCharacter(DirectX::XMFLOAT3 p_playerPos)
{
// Lock shadows on the player.
DirectX::XMFLOAT3 playerPosition = p_playerPos;
DirectX::XMFLOAT3 position = DirectX::XMFLOAT3(playerPosition.x + 25.0f, playerPosition.y + 100.0f, playerPosition.z + 50.0f);
DirectX::XMFLOAT3 target = playerPosition;
UpdatePosition(position);
UpdateTarget(target);
UpdateViewMatrix();
UpdateProjectionMatrix(true);
GraphicsEngine::SetLightViewAndProjection(GetViewMatrix(), GetProjectionMatrix());
// Visibility view projection..
playerPosition = p_playerPos;
position = DirectX::XMFLOAT3(playerPosition.x, playerPosition.y + 30.0f, playerPosition.z);
target = playerPosition;
UpdatePosition(position);
UpdateTarget(target);
UpdateViewMatrix();
GraphicsEngine::SetViewPolygonMatrix(GetViewMatrix());
// Lock camera on the player.
playerPosition = p_playerPos;
position = DirectX::XMFLOAT3(playerPosition.x, playerPosition.y + 30.0f, playerPosition.z - 15.0f);
target = playerPosition;
SetOutliningRayPosition(position);
SetOutliningRayTarget(target);
if (GLOBAL::GetInstance().CAMERA_MOVING)
{
MovingCamera(playerPosition);
}
else
{
UpdatePosition(position);
UpdateTarget(target);
UpdateViewMatrix();
UpdateProjectionMatrix(false);
GraphicsEngine::SetViewAndProjection(GetViewMatrix(), GetProjectionMatrix());
m_oldPosition = position;
}
GraphicsEngine::UpdateVisibilityPolygon(Point(playerPosition.x, playerPosition.z), (float)GLOBAL::GetInstance().GetDeltaTime());
}
示例4: GetMap
bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, float o)
{
Map const* oldMap = GetMap();
if (oldMap->GetId() != newMapid)
{
_delayedTeleport = true;
UnloadStaticPassengers();
return true;
}
else
{
UpdatePosition(x, y, z, o);
// Teleport players, they need to know it
for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
{
if ((*itr)->GetTypeId() == TYPEID_PLAYER)
{
// will be relocated in UpdatePosition of the vehicle
if (Unit* veh = (*itr)->ToUnit()->GetVehicleBase())
if (veh->GetTransport() == this)
continue;
float destX, destY, destZ, destO;
(*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, o);
(*itr)->ToUnit()->NearTeleportTo(destX, destY, destZ, destO);
}
}
return false;
}
}
示例5: FocusNextTabElement
// Processes the 'onpropertychange' event, checking for a change in position or size.
void ElementDocument::ProcessEvent(Event& event)
{
Element::ProcessEvent(event);
// Process generic keyboard events for this window in capture phase
if (event.GetPhase() == Event::PHASE_BUBBLE && event == KEYDOWN)
{
int key_identifier = event.GetParameter<int>("key_identifier", Input::KI_UNKNOWN);
// Process TAB
if (key_identifier == Input::KI_TAB)
{
FocusNextTabElement(event.GetTargetElement(), !event.GetParameter<bool>("shift_key", false));
}
// Process ENTER being pressed on a focusable object (emulate click)
else if (key_identifier == Input::KI_RETURN ||
key_identifier == Input::KI_NUMPADENTER)
{
Element* focus_node = GetFocusLeafNode();
if (focus_node && focus_node->GetProperty<int>(TAB_INDEX) == TAB_INDEX_AUTO)
{
focus_node->Click();
}
}
}
else if (event.GetTargetElement() == this)
{
if (event == RESIZE)
UpdatePosition();
}
}
示例6: UpdatePosition
void Player::Update()
{
float dt = UpdateClock::DeltaTime();
decisionTreeCooldown -= dt;
if(decisionTreeCooldown <= 0 || needsNewState)
{
// run decision tree
currentState = defensive ? NodeTree_Defensive->Evaluate() : NodeTree->Evaluate();
decisionTreeCooldown = decisionTreeTimeout;
needsNewState = false;
}
currentState->Update();
UpdatePosition();
if(hasEnemyFlag)
{
for(uint i = 0; i < game->NUM_PLAYERS; i++)
{
if(game->players[i]->teamID != teamID)
{
if(glm::length(game->players[i]->position - position) < 0.75f)
{
game->ResetFlag(teamID == 0 ? 1 : 0);
position = game->level.nodes[game->TeamFlags[teamID].homeNodeID].position;
needsNewPath = true;
needsNewState = true;
hasEnemyFlag = false;
}
}
}
}
}
示例7: UpdatePosition
void VsJoint::Physics_CollectData()
{
if(m_lpThisJoint && m_vxJoint)
{
UpdatePosition();
//Only update the joints data when we need to do robot synch, but still update our internal data.
//Only attempt to make these calls if the coordinate ID is a valid number.
if(m_iCoordID >= 0) //&& m_lpThisJoint->NeedsRobotSynch()
{
float fltDistanceUnits = m_lpThisAB->GetSimulator()->DistanceUnits();
float fltMassUnits = m_lpThisAB->GetSimulator()->MassUnits();
if(m_vxJoint->isAngular(m_iCoordID) == true)
{
m_lpThisJoint->JointPosition(m_vxJoint->getCoordinateCurrentPosition (m_iCoordID));
m_lpThisJoint->JointVelocity(m_vxJoint->getCoordinateVelocity (m_iCoordID));
m_lpThisJoint->JointForce(m_vxJoint->getCoordinateForce(m_iCoordID) * fltMassUnits * fltDistanceUnits * fltDistanceUnits);
}
else
{
m_lpThisJoint->JointPosition(m_vxJoint->getCoordinateCurrentPosition (m_iCoordID) * fltDistanceUnits);
m_lpThisJoint->JointVelocity(m_vxJoint->getCoordinateVelocity(m_iCoordID) * fltDistanceUnits);
m_lpThisJoint->JointForce(m_vxJoint->getCoordinateForce(m_iCoordID) * fltMassUnits * fltDistanceUnits);
}
}
}
}
示例8: UpdatePosition
void RichEditPara::OffsetCharRange(int nOffset)
{
RichEditObj::OffsetCharRange(nOffset);
m_bNeedUpdateLayout = TRUE;
UpdatePosition();
}
示例9: UpdatePosition
void CChartLegend::ClipArea(CRect& rcControl, CDC* pDC)
{
UpdatePosition(pDC,rcControl);
if (m_ObjectRect.IsRectEmpty())
return;
if (m_bDocked)
{
switch (m_DockSide)
{
case dsDockRight:
rcControl.right = m_ObjectRect.left + 2;
break;
case dsDockLeft:
rcControl.left = m_ObjectRect.right - 2;
break;
case dsDockTop:
rcControl.top = m_ObjectRect.bottom + 2;
break;
case dsDockBottom:
rcControl.bottom = m_ObjectRect.top - 2;
break;
}
}
}
示例10: SetupParms
/************************************************************************************
*
* ***********************************************************************************/
bool BaaderDome::SetupParms()
{
targetAz = 0;
if (UpdatePosition())
IDSetNumber(&DomeAbsPosNP, nullptr);
if (UpdateShutterStatus())
IDSetSwitch(&DomeShutterSP, nullptr);
if (UpdateFlapStatus())
IDSetSwitch(&DomeFlapSP, nullptr);
if (InitPark())
{
// If loading parking data is successful, we just set the default parking values.
SetAxis1ParkDefault(0);
}
else
{
// Otherwise, we set all parking data to default in case no parking data is found.
SetAxis1Park(0);
SetAxis1ParkDefault(0);
}
return true;
}
示例11: MoveY
// Player movement behaviour and controls //
void Player::Move(int screenX, int screenY)
{
if(IsKeyDown(KEY_UP) && y > height/2)
{
MoveY(-1.4);
}
else if(IsKeyDown(KEY_DOWN) && y < screenY-height/2)
{
MoveY(1.4);
}
if(IsKeyDown(KEY_LEFT) && x > width/2)
{
state = 3;
MoveX(-1.4);
}
else if(IsKeyDown(KEY_RIGHT) && x < screenX-width/2)
{
state = 4;
MoveX(1.4);
}
else
state = 0;
UpdatePosition();
}
示例12: UpdatePosition
void Transform::Update() {
model = glm::toMat4(rotationQ);
model[0] *= scale[0];
model[1] *= scale[1];
model[2] *= scale[2];
UpdatePosition();
}
示例13: TEST_F
TEST_F(MockWorld, TestEntityUpdatePosition)
{
auto const& w_ptr = std::make_shared<sbe::World>(RECT);
EXPECT_CALL(*t_entity.get(), UpdatePosition(w_ptr));
world.UpdatePositions(w_ptr);
}
示例14: if
void CAMERA_MOUNT::Update(const MATHVECTOR <float, 3> & newpos, const QUATERNION <float> & newdir, float dt)
{
rotation = newdir * offsetrot;
MATHVECTOR <float, 3> pos = offset;
newdir.RotateVector(pos);
pos = pos + newpos;
MATHVECTOR <float, 3> vel = pos - position;
effect = (vel.Magnitude() - 0.02) / 0.04;
if (effect < 0) effect = 0;
else if (effect > 1) effect = 1;
float bumpdiff = randgen.Get();
float power = pow(bumpdiff, 32);
if (power < 0) power = 0;
else if (power > 0.2) power = 0.2;
float veleffect = std::min(pow(vel.Magnitude() * ( 2.0 - stiffness), 3.0), 1.0);
float bumpimpulse = power * 130.0 * veleffect;
float k = 800.0 + stiffness * 800.0 * 4.0;
float c = 2.0 * std::sqrt(k * mass) * 0.35;
MATHVECTOR <float, 3> bumpforce = direction::Up * bumpimpulse;
MATHVECTOR <float, 3> springforce = -displacement * k;
MATHVECTOR <float, 3> damperforce = -velocity * c;
velocity = velocity + (springforce + damperforce + bumpforce) * dt;
displacement = displacement + velocity * dt;
UpdatePosition(pos);
}
示例15: lcObject
// New directional or spot light.
lcLight::lcLight(float px, float py, float pz, float tx, float ty, float tz)
: lcObject(LC_OBJECT_LIGHT)
{
Initialize(lcVector3(px, py, pz), lcVector3(tx, ty, tz));
mState |= LC_LIGHT_SPOT;
UpdatePosition(1);
}