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

Method PitchCorrection

ogsr_engine/xrGame/CustomMonster.cpp:721–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

719BOOL CCustomMonster::UsedAI_Locations() { return (TRUE); }
720
721void CCustomMonster::PitchCorrection()
722{
723 CLevelGraph::SContour contour;
724 ai().level_graph().contour(contour, ai_location().level_vertex_id());
725
726 Fplane P;
727 P.build(contour.v1, contour.v2, contour.v3);
728
729 Fvector position_on_plane;
730 P.project(position_on_plane, Position());
731
732 // находим проекцию точки, лежащей на векторе текущего направления
733 Fvector dir_point, proj_point;
734 dir_point.mad(position_on_plane, Direction(), 1.f);
735 P.project(proj_point, dir_point);
736
737 // получаем искомый вектор направления
738 Fvector target_dir;
739 target_dir.sub(proj_point, position_on_plane);
740
741 float yaw, pitch;
742 target_dir.getHP(yaw, pitch);
743
744 movement().m_body.target.pitch = -pitch;
745}
746
747BOOL CCustomMonster::feel_touch_on_contact(CObject* O)
748{

Callers

nothing calls this directly

Calls 8

DirectionEnum · 0.85
contourMethod · 0.80
getHPMethod · 0.80
level_vertex_idMethod · 0.45
buildMethod · 0.45
projectMethod · 0.45
madMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected