MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / UpdateOnFrame

Method UpdateOnFrame

ogsr_engine/xrGame/Artifact.cpp:726–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724}
725
726void SArtefactDetectorsSupport::UpdateOnFrame()
727{
728 if (m_currPatrolPath && !m_parent->getVisible())
729 {
730 if (m_parent->Position().distance_to(m_destPoint) < 2.0f)
731 {
732 CPatrolPath::const_iterator b, e;
733 m_currPatrolPath->begin(m_currPatrolVertex, b, e);
734 if (b != e)
735 {
736 std::advance(b, ::Random.randI(s32(e - b)));
737 m_currPatrolVertex = m_currPatrolPath->vertex((*b).vertex_id());
738 m_destPoint = m_currPatrolVertex->data().position();
739 }
740 }
741 float cos_et = _cos(deg2rad(45.f));
742 Fvector dir;
743 dir.sub(m_destPoint, m_parent->Position()).normalize_safe();
744
745 Fvector v;
746 m_parent->PHGetLinearVell(v);
747 float cosa = v.dotproduct(dir);
748 if (v.square_magnitude() < (0.7f * 0.7f) || (cosa < cos_et))
749 {
750 Fvector power = dir;
751 power.y += 1.0f;
752 power.mul(m_path_moving_force);
753 m_parent->m_pPhysicsShell->applyGravityAccel(power);
754 }
755 }
756
757 if (m_parent->getVisible() && m_parent->GetAfRank() != 0 && m_switchVisTime + 5000 < Device.dwTimeGlobal)
758 SetVisible(false);
759
760 u32 dwDt = 2 * 3600 * 1000 / 10; // 2 hour of game time
761 if (!m_parent->getVisible() && m_switchVisTime + dwDt < Device.dwTimeGlobal)
762 {
763 m_switchVisTime = Device.dwTimeGlobal;
764 if (m_parent->Position().distance_to(Device.vCameraPosition) > 40.0f)
765 Blink();
766 }
767}
768
769void SArtefactDetectorsSupport::FollowByPath(LPCSTR path_name, int start_idx, Fvector force)
770{

Callers 1

shedule_UpdateMethod · 0.80

Calls 15

_cosFunction · 0.85
deg2radFunction · 0.85
PositionMethod · 0.80
randIMethod · 0.80
advanceFunction · 0.50
distance_toMethod · 0.45
beginMethod · 0.45
vertexMethod · 0.45
vertex_idMethod · 0.45
positionMethod · 0.45
dataMethod · 0.45
normalize_safeMethod · 0.45

Tested by

no test coverage detected