本文整理汇总了C++中Fplane::project方法的典型用法代码示例。如果您正苦于以下问题:C++ Fplane::project方法的具体用法?C++ Fplane::project怎么用?C++ Fplane::project使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fplane
的用法示例。
在下文中一共展示了Fplane::project方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pitch_correction
void CControlDirection::pitch_correction()
{
if (!m_object->ability_pitch_correction()) return;
// extended feature to pitch by path (wall climbing)
// distance between two travel point must be more than 1.f
if (m_object->control().path_builder().is_moving_on_path() &&
(m_object->movement().detail().path().size() > m_object->movement().detail().curr_travel_point_index() + 1)) {
const DetailPathManager::STravelPathPoint cur_point = m_object->movement().detail().path()[m_object->movement().detail().curr_travel_point_index()];
const DetailPathManager::STravelPathPoint next_point = m_object->movement().detail().path()[m_object->movement().detail().curr_travel_point_index()+1];
if (cur_point.position.distance_to_sqr(next_point.position) > 1) {
// получаем искомый вектор направления
Fvector target_dir;
target_dir.sub (next_point.position,cur_point.position);
m_data.pitch.target_angle = -target_dir.getP();
return;
}
}
// get current plane
u32 node = m_object->ai_location().level_vertex_id();
Fplane P;
pvDecompress (P.n,ai().level_graph().vertex(node)->plane());
P.d = -P.n.dotproduct(ai().level_graph().vertex_position(node));
Fvector position_on_plane;
P.project (position_on_plane,m_object->Position());
// находим проекцию точки, лежащей на векторе текущего направления
Fvector dir_point, proj_point;
dir_point.mad (position_on_plane, m_object->Direction(), 1.f);
P.project (proj_point,dir_point);
// получаем искомый вектор направления
Fvector target_dir;
target_dir.sub (proj_point,position_on_plane);
float yaw,pitch;
target_dir.getHP (yaw,pitch);
m_data.pitch.target_angle = -pitch;
}