本文整理汇总了C++中Transform::GetPositionWorld方法的典型用法代码示例。如果您正苦于以下问题:C++ Transform::GetPositionWorld方法的具体用法?C++ Transform::GetPositionWorld怎么用?C++ Transform::GetPositionWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform::GetPositionWorld方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResumeSchedule
void AiRoutine::ResumeSchedule() {
Transform* trans = this->GetObject()->GetComponent<Transform>();
AiMarker prevMark;
prevMark.WaitTime = this->waitTimer;
prevMark.Position = trans->GetPositionWorld();
prevMark.Orientation = trans->GetOrientationWorld();
AiMarker newMark = this->markers[this->currentMarker];
glm::vec3 oldForward = QuaternionForwardVector(prevMark.Orientation);
glm::vec3 newForward = QuaternionForwardVector(newMark.Orientation);
float dist = glm::distance(prevMark.Position, newMark.Position);
// Don't use glm's vector angle function because it never returns an angle greater than PI/2
float angle = acos(glm::clamp(glm::dot(oldForward, newForward), -1.0f, 1.0f));
GridNavigator* gNav = this->GetObject()->GetComponent<GridNavigator>();
if (dist > ROUNDING_ERROR) {
this->currentMarkerType = AI_MARKER_WALK;
gNav->SetDestination(newMark.Position);
this->unit->SwitchActionState(UNIT_ACTION_STATE_WALKING);
}
else if (angle > ROUNDING_ERROR) {
this->currentMarkerType = AI_MARKER_LOOK;
gNav->SetLookTarget(newMark.Orientation);
this->unit->SwitchActionState(UNIT_ACTION_STATE_IDLE);
}
else {
this->currentMarkerType = AI_MARKER_WAIT;
this->waitTimer = newMark.WaitTime;
this->unit->SwitchActionState(UNIT_ACTION_STATE_IDLE);
}
}