//---------------------------- // Update //---------------------------- bool COrientedParticle::Update() { // Game pausing can cause dumb time things to happen, so kill the effect in this instance if ( mTimeStart > theFxHelper.mTime ) { return false; } if (( mTimeStart < theFxHelper.mTime ) && UpdateOrigin() == false ) { // we are marked for death return false; } if ( !Cull()) { UpdateSize(); UpdateRGB(); UpdateAlpha(); UpdateRotation(); Draw(); } return true; }
void KSceneSFXEditorBillboardPage::UpdateSpecifiedUI() { GET_SFX_EDITOR(); int nSelect = m_comboBillboard.GetCurSel(); KG_PROCESS_ERROR(nSelect != -1); IEKG3DSFX *pSFX = NULL; pScene->GetSFX(&pSFX); IEKG3DSFXBillboard *pBillboard = NULL; pSFX->GetBillboard(nSelect, &pBillboard); ASSERT(pBillboard); int nFrame = pFrame->GetKeysFrame()->m_Slider.GetCurPos(); if (m_radioWidth.GetCheck()) UpdateBillboardWidth(pBillboard, nFrame); else if (m_radioHeight.GetCheck()) UpdateBillboardHeight(pBillboard, nFrame); else if (m_radioColor.GetCheck()) UpdateBillboardColor(pBillboard, nFrame); else if (m_radioTextureFrameIndex.GetCheck()) UpdateTextureFrameIndex1(pBillboard, nFrame); else if (m_radioTexture2FrameIndex.GetCheck()) UpdateTextureFrameIndex2(pBillboard, nFrame); else if (m_radioRotationAnimation.GetCheck()) UpdateRotation(pBillboard, nFrame); else if (m_radioUVOffset.GetCheck()) UpdateUV(pBillboard, nFrame); Exit0: return; }
//------------------------------------------------------------------------ void CRapid::Activate(bool activate) { CSingle::Activate(activate); if (!activate) { if (m_soundId != INVALID_SOUNDID) { m_pWeapon->StopSound(m_soundId); m_soundId = INVALID_SOUNDID; } if (m_spinUpSoundId != INVALID_SOUNDID) { m_pWeapon->StopSound(m_spinUpSoundId); m_spinUpSoundId = INVALID_SOUNDID; } } m_rotation_angle = 0.0f; m_speed = 0.0f; m_accelerating = false; m_decelerating = false; m_acceleration = 0.0f; // initialize rotation xforms UpdateRotation(0.0f); m_soundId = INVALID_SOUNDID; m_spinUpSoundId = INVALID_SOUNDID; Firing(false); m_startedToFire = false; }
void RoboCat::UpdateAttackState( float inDeltaTime ) { mTimeSinceLastAttack += inDeltaTime; if ( mTargetCat && !mTargetCat->DoesWantToDie() ) { //determine the distance to the target cat Vector3 diff = mTargetCat->GetLocation() - mLocation; float distSq = diff.LengthSq2D(); //if we're in yarn cooldown, we aren't allowed to do anything if ( mTimeSinceLastAttack >= kYarnCooldown ) { UpdateRotation( mTargetCat->GetLocation() ); if ( distSq <= kAttackRangeSq ) { //if we're in range, throw a ball of yarn mTimeSinceLastAttack = 0.0f; GameObjectPtr me = NetworkManager::sInstance->GetGameObject( mNetworkId ); YarnPtr yarn = std::static_pointer_cast< Yarn >( GameObjectRegistry::sInstance->CreateGameObject( 'YARN' ) ); yarn->InitFromShooter( me, mTargetCat ); } else { MoveToLocation( inDeltaTime, mTargetCat->GetLocation() ); } } } else { //target cat is dead mTargetCat.reset(); mState = RC_IDLE; } }
void CTwisterDialog::OnUpdateButton() { UpdateData(TRUE); UpdateRotation(m_strResult); UpdateData(FALSE); }
LTBOOL SecurityCamera::Update() { State eStatePrevious = m_eState; if (m_bTripped) { UpdateFlashingLight(); SetNextUpdate(0.001f); return LTTRUE; } if (m_eState == eStateDestroyed || m_eState == eStateOff) { SetNextUpdate(0.0f); return LTTRUE; } UpdateRotation(); if (!m_bDisabled) { UpdateDetect(); } UpdateSounds(eStatePrevious); SetNextUpdate(0.001f); UpdateFlashingLight(); return LTTRUE; }
void RPG_Pickup::ThinkFunction() { const float deltaTime = Vision::GetTimer()->GetTimeDifference(); if(m_elapsedTime < m_spawnIdleTime) { // don't do anything if we haven't been idle long enough m_elapsedTime += deltaTime; return; } if(m_rigidBodyComponent) { RemoveComponent(m_rigidBodyComponent); m_rigidBodyComponent = NULL; m_currentMagnetSpeed = 0.0f; m_currentMagnetVelocity.setZero(); } UpdateRotation(deltaTime); UpdateMagnetForces(deltaTime); IncPosition(deltaTime * m_currentMagnetVelocity); CheckCharacterContact(); }
void AMWMot::Tick(float DeltaSeconds) { Super::Tick(DeltaSeconds); UpdateRotation(DeltaSeconds); Lightcone->AdjustLight(SpotLight); }
void RoboCat::EnterMovingState( const Vector3& inTarget ) { mMoveLocation = inTarget; UpdateRotation( inTarget ); mState = RC_MOVING; }
void Camera::Update(float dt, Input* input) { //Keyboard camera movement if (input->IsKeyDown(DIK_W)) { UpdatePosition(0, 0, m_moveSpeed*dt); } if (input->IsKeyDown(DIK_S)) { UpdatePosition(0, 0, -m_moveSpeed*dt); } if (input->IsKeyDown(DIK_A)) { UpdatePosition(-m_moveSpeed*dt, 0, 0); } if (input->IsKeyDown(DIK_D)) { UpdatePosition(m_moveSpeed*dt, 0, 0); } if (input->IsKeyDown(DIK_SPACE)) { UpdatePosition(0, m_moveSpeed*dt, 0); } //Faster move speed with shift if (input->IsKeyDown(DIK_LSHIFT)) { m_moveSpeed = 30; } else { m_moveSpeed = 10; } //Right mouse button if (input->IsMouseDown(1)) { //Update the rotation based on mouse XMFLOAT2 mouse = input->GetMouseMovement(); UpdateRotation(mouse.y*dt, mouse.x*dt, 0); } //Mouse Scroll float scroll = input->GetMouseScroll(); if (scroll != 0) { UpdatePosition(0, 0, scroll*m_scrollZoomSpeed*dt); } }
/** * Updates the position and orientation of the camera as well as other state (like velocity.) Should be * called every frame. * * @param UserImpulseData Input data from the user this frame * @param DeltaTime Time interval since last update * @param bAllowRecoilIfNoImpulse True if we should recoil FOV if needed * @param MovementSpeedScale Scales the speed of movement * @param InOutCameraPosition [in, out] Camera position * @param InOutCameraEuler [in, out] Camera orientation * @param InOutCameraFOV [in, out] Camera field of view */ void FEditorCameraController::UpdateSimulation( const FCameraControllerUserImpulseData& UserImpulseData, const float DeltaTime, const bool bAllowRecoilIfNoImpulse, const float MovementSpeedScale, FVector& InOutCameraPosition, FVector& InOutCameraEuler, float& InOutCameraFOV ) { bool bAnyUserImpulse = false; // Apply dead zone test to user impulse data //ApplyImpulseDeadZone( UserImpulseData, FinalUserImpulse, bAnyUserImpulse ); if( UserImpulseData.RotateYawVelocityModifier != 0.0f || UserImpulseData.RotatePitchVelocityModifier != 0.0f || UserImpulseData.RotateRollVelocityModifier != 0.0f || UserImpulseData.MoveForwardBackwardImpulse != 0.0f || UserImpulseData.MoveRightLeftImpulse!= 0.0f || UserImpulseData.MoveUpDownImpulse != 0.0f || UserImpulseData.ZoomOutInImpulse != 0.0f || UserImpulseData.RotateYawImpulse != 0.0f || UserImpulseData.RotatePitchImpulse != 0.0f || UserImpulseData.RotateRollImpulse != 0.0f ) { bAnyUserImpulse = true; } FVector TranslationCameraEuler = InOutCameraEuler; if (Config.bPlanarCamera) { //remove roll TranslationCameraEuler.X = 0; //remove pitch TranslationCameraEuler.Y = 0; } // Movement UpdatePosition( UserImpulseData, DeltaTime, MovementSpeedScale, TranslationCameraEuler, InOutCameraPosition ); // Rotation UpdateRotation( UserImpulseData, DeltaTime, InOutCameraEuler ); // FOV UpdateFOV( UserImpulseData, DeltaTime, InOutCameraFOV ); // Recoil camera FOV if we need to ApplyRecoil( DeltaTime, bAllowRecoilIfNoImpulse, bAnyUserImpulse, InOutCameraFOV ); }
void Camera::RotatePitch(float num) { Quaternion rotation(GetSide(), num/30); Quaternion Conjugate = rotation.conjugate(); Quaternion result = (rotation.mult(Direction)).mult(Conjugate); Quaternion result_2 = (rotation.mult(Up)).mult(Conjugate); SetDirection(Vec3(result.getX(), result.getY(), result.getZ())); UpdateRotation(); }
void KSceneSFXEditorBillboardPage::OnEnSetfocusEditRotationAnimation() { // TODO: Add your control notification handler code here GET_SFX_EDITOR(); GET_BILLBOARD(); CheckRadioButton(IDC_RADIO_BILLBOARD_COLOR, IDC_RADIO_UV_OFFSET, IDC_RADIO_ROTATION_ANIMATION); OnBnClickedRadioRotationAnimation(); int nFrame = pFrame->GetKeysFrame()->m_Slider.GetCurPos(); UpdateRotation(pBillboard, nFrame); }
void NonPlayerCharacterInstance :: Update() { if(!isDead) { brain->Process(); UpdateMovementVelocity(); UpdateRotation(); } CharacterInstance::Update(); }
BOOL CTwisterDialog::OnInitDialog() { CDialog::OnInitDialog(); EnableToolTips(TRUE); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUT, strAboutMenu); } } fntCourier = new CFont; fntCourier->CreateFont(8,0,0,0,400,FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_MODERN, "Courier"); ((CEdit*) GetDlgItem(IDC_X_INPUT))->SetFont(fntCourier); ((CEdit*) GetDlgItem(IDC_Y_INPUT))->SetFont(fntCourier); ((CEdit*) GetDlgItem(IDC_Z_INPUT))->SetFont(fntCourier); ((CEdit*) GetDlgItem(IDC_RESULT_BOX))->SetFont(fntCourier); // Subclass edit boxes m_cXBox.SubclassDlgItem(IDC_X_INPUT,this); m_cYBox.SubclassDlgItem(IDC_Y_INPUT,this); m_cZBox.SubclassDlgItem(IDC_Z_INPUT,this); // Setup edit boxes m_cXBox.SetOptions(1); m_cXBox.SetOptions(1); m_cXBox.SetOptions(1); m_strX = "0"; m_strY = "0"; m_strZ = "0"; ((CButton*) GetDlgItem(IDC_RADIANS_RADIO))->SetCheck(1); m_bRadians = TRUE; UpdateRotation(m_strResult); UpdateData(FALSE); VERIFY(m_CopyLogo.AutoLoad(IDC_COPY_BUTTON, this)); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void vehicle::Init(int vNr, city *_c, vehicles *_v, vModel *vModel, int bL[2]) { nr = vNr; c = _c; v = _v; vM = vModel; p.p = c->Path(bL[0], bL[1]); //clear speed = 0; k = 0; lNr = 0; lNr = c->LanesNr(p.Prev(), p.Now()) - 1; //------------------------------------------------------------ //starting pos building *bT; bT = &c->b.b[bL[0]]; progr = bT->d; UpdatePosition(); UpdateRotation(); //------------------------------------------------------------ //targerProgress bT = &c->b.b[bL[1]]; targetProgr = bT->d; //check if inverse std::list<int>::iterator it; it = p.p.end(); it--;it--; if (bT->r[0] == *it) targetProgr = c->Length(bT->r[0], bT->r[1]) - targetProgr; //------------------------------------------------------------ c->AddVList(nr, p.Prev(), p.Now(), lNr); changingLaneFrom = -1; }
void CMole::ProcessStuck(float _fTimeDelta, CTask& _rTask) { _rTask.DecrementStuckTime(_fTimeDelta); if (_rTask.GetStuckTimeLeft() <= 0.0f) { m_Tasks.pop(); } CFVec2 vOpositeLook(0.0f, -1.0f); vOpositeLook.RotateZ(m_fHeading); vOpositeLook.RotateZ(fDegsToRad(180)); UpdateRotation(_fTimeDelta, vOpositeLook); UpdatePosition(_fTimeDelta); }
void CModelViewRender::OnMouseMove(UINT nFlags, CPoint point) { CSize offset = point - m_ptLastMousePos; if (0 != (nFlags & MK_LBUTTON)) { // processing rotation while left mouse button is pressed if (0 != (nFlags & MK_CONTROL)) { m_v3Rotation.roll += offset.cx; m_v3Rotation.pitch += offset.cy; m_v3Rotation.roll = max(min(m_v3Rotation.roll, 180), -180); } else { m_v3Rotation.pitch += offset.cy; m_v3Rotation.yaw += offset.cx; //m_v3Rotation.yaw = max(min(m_v3Rotation.yaw, 180), -180); } m_v3Rotation.pitch = max(min(m_v3Rotation.pitch, 180), -180); UpdateRotation(); GetDockDlg()->SetRotation(m_v3Rotation); } if (0 != (nFlags & MK_RBUTTON)) { // move object position while right mouse button is pressed m_v3Position.x -= (point.x - m_ptLastMousePos.x) * m_fScaleOffset; m_v3Position.y -= (point.y - m_ptLastMousePos.y) * m_fScaleOffset; UpdatePosition(); GetDockDlg()->SetPosition(m_v3Position); } m_ptLastMousePos = point; CView::OnMouseMove(nFlags, point); }
void CMole::ProcessExplore(float _fTimeDelta, CTask& _rTask) { UpdateTaskTargetPath(_fTimeDelta, _rTask); if (!_rTask.HasTargetNode() || (s_pSharedPath->GetNode(_rTask.GetTargetNodeId()).bDiscovered && s_pSharedPath->HasUndiscoveredNodesLeft())) { int iTargetNodeId = 0; bool bFoundNode = s_pSharedPath->FindUndiscoveredNode(m_vPosition, m_fRadius, m_fHeading, iTargetNodeId); if (!bFoundNode) { s_pSharedPath->FindRandomAccesableNode(iTargetNodeId); bFoundNode = true; } if (bFoundNode) { _rTask.SetTargetNodeId(iTargetNodeId); UpdateTaskTargetPath(_fTimeDelta, _rTask); } } // If have target if (_rTask.HasTargetNode()) { CFVec2 vSteerForce; ComputeSteerForce(_rTask.GetNodeIdsPath().back(), vSteerForce); UpdateRotation(_fTimeDelta, vSteerForce); UpdatePosition(_fTimeDelta); } }
bool GameObject::CreateFromProto(uint32 entry,uint32 mapid, float x, float y, float z, float ang, float orientation1, float orientation2, float orientation3, float orientation4) { pInfo= GameObjectNameStorage.LookupEntry(entry); if(!pInfo) return false; Object::_Create( mapid, x, y, z, ang ); SetUInt32Value( OBJECT_FIELD_ENTRY, entry ); SetFloatValue( GAMEOBJECT_PARENTROTATION, orientation1 ); SetFloatValue( GAMEOBJECT_PARENTROTATION + 1, orientation2 ); UpdateRotation( orientation3,orientation4 ); SetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_STATE, 1); SetUInt32Value( GAMEOBJECT_DISPLAYID, pInfo->DisplayID ); SetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_TYPE_ID, pInfo->Type); InitAI(); return true; }
void CMole::ProcessHunt(float _fTimeDelta, CTask& _rTask) { UpdateTaskTargetPath(_fTimeDelta, _rTask); // If have target if (_rTask.HasTargetNode()) { CFVec2 vSteerForce; ComputeSteerForce(_rTask.GetNodeIdsPath().back(), vSteerForce); UpdateRotation(_fTimeDelta, vSteerForce); UpdatePosition(_fTimeDelta); } else { // Reached disternace position m_Tasks.pop(); } }
LTBOOL SecurityCamera::Update() { State eStatePrevious = m_eState; if (m_eState == eStateDestroyed) { SetNextUpdate(UPDATE_NEVER); return LTTRUE; } if (m_bTripped) { UpdateFlashingLight(); SetNextUpdate(UPDATE_NEXT_FRAME); return LTTRUE; } if(m_eState == eStateOff) { SetNextUpdate(UPDATE_NEVER); return LTTRUE; } // Only update the rotation and detection if the camera is not disabled... if (!m_bDisabled) { UpdateRotation(); UpdateDetect(); } UpdateSounds(eStatePrevious); SetNextUpdate(UPDATE_NEXT_FRAME); UpdateFlashingLight(); return LTTRUE; }
void Camera::RotateYaw3rd(float num) { Vec3 tempCenter(World::Instance()->GetMainCharacter()->getPos().getX(), World::Instance()->GetMainCharacter()->getPos().getY(), World::Instance()->GetMainCharacter()->getPos().getZ()); Vec3 tempCamer(Position.getX(), Position.getY(), Position.getZ()); tempCamer.rotateByPoint(tempCenter, -num/30); SetPosition(tempCamer); static float Rotation = 0; Rotation += num/30; if(Rotation < 0) { Rotation += 360; } else if(Rotation > 360) { Rotation -= 360; } //just for rotate the Character World::Instance()->GetMainCharacter()->setRotation(0,Rotation, 0); Quaternion rotation(Up, num/30); Quaternion Conjugate = rotation.conjugate(); Quaternion result = (rotation.mult(Direction)).mult(Conjugate); SetDirection(Vec3(result.getX(), result.getY(), result.getZ())); UpdateRotation(); }
void WorldModelDebris::Update() { CollisionInfo standingInfo; if (m_bRotate) { g_pLTServer->SetNextUpdate(m_hObject, 0.01f); g_pLTServer->GetStandingOn(m_hObject, &standingInfo); if (standingInfo.m_hObject) { m_bRotate = LTFALSE; } else { UpdateRotation(); } } else { g_pLTServer->SetNextUpdate(m_hObject, 0.0f); } }
//------------------------------------------------------------------------ void CRapid::Activate(bool activate) { BaseClass::Activate(activate); if (m_pBarrelSpinAction) { m_pBarrelSpinAction->Stop(); m_pBarrelSpinAction = 0; } if (activate) { m_pBarrelSpinAction = GetWeapon()->PlayAction(GetFragmentIds().barrel_spin); } m_rotation_angle = 0.0f; m_speed = 0.0f; m_rapidFlags &= ~(eRapidFlag_accelerating|eRapidFlag_decelerating|eRapidFlag_startedFiring); m_acceleration = 0.0f; // initialize rotation xforms UpdateRotation(0.0f); Firing(false); }
void FlyCamera::Update(float deltaTime) { UpdateRotation(deltaTime); UpdatePosition(deltaTime); }
void UMWBotSensorComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); UpdateRotation(DeltaTime); }
void CModelViewRender::RotationChanged() { GetDockDlg()->GetRotation(m_v3Rotation); UpdateRotation(); }
void CModelViewRender::ResetRotation() { m_v3Rotation.Set(0, 0, 0); UpdateRotation(); GetDockDlg()->SetRotation(m_v3Rotation); }
//------------------------------------------------------------------------ void CRapid::Update(float frameTime, uint32 frameId) { FUNCTION_PROFILER( GetISystem(), PROFILE_GAME ); PlayStopRapidFireIfNeeded(); BaseClass::Update(frameTime, frameId); if (m_speed <= 0.0f && m_acceleration < 0.0001f) { FinishDeceleration(); return; } CActor* pOwnerActor = m_pWeapon->GetOwnerActor(); const bool isOwnerClient = pOwnerActor ? pOwnerActor->IsClient() : false; const bool isOwnerPlayer = pOwnerActor ? pOwnerActor->IsPlayer() : false; m_pWeapon->RequireUpdate(eIUS_FireMode); m_speed = m_speed + m_acceleration*frameTime; if (m_speed > m_fireParams->rapidparams.max_speed) { m_speed = m_fireParams->rapidparams.max_speed; m_rapidFlags &= ~eRapidFlag_accelerating; } if ((m_speed >= m_fireParams->rapidparams.min_speed) && !(m_rapidFlags & eRapidFlag_decelerating)) { float dt = 1.0f; if (cry_fabsf(m_speed)>0.001f && cry_fabsf(m_fireParams->rapidparams.max_speed)>0.001f) { dt = m_speed * (float)__fres(m_fireParams->rapidparams.max_speed); } CRY_ASSERT(m_fireParams->fireparams.rate > 0); m_next_shot_dt = 60.0f* (float)__fres((m_fireParams->fireparams.rate*dt)); if (CanFire(false)) { if (!OutOfAmmo()) { const bool firing = (m_rapidFlags & eRapidFlag_netShooting) || Shoot(true, m_fireParams->fireparams.autoReload); Firing(firing); } else { StopFire(); } } } else if (m_firing) { StopFire(); if (OutOfAmmo() && isOwnerPlayer) { m_pWeapon->Reload(); } } if ((m_speed < m_fireParams->rapidparams.min_speed) && (m_acceleration < 0.0f) && !(m_rapidFlags & eRapidFlag_decelerating)) Accelerate(m_fireParams->rapidparams.deceleration); UpdateRotation(frameTime); UpdateFiring(pOwnerActor, isOwnerClient, isOwnerPlayer, frameTime); }