当前位置: 首页>>代码示例>>C++>>正文


C++ Transform::GetOrientationWorld方法代码示例

本文整理汇总了C++中Transform::GetOrientationWorld方法的典型用法代码示例。如果您正苦于以下问题:C++ Transform::GetOrientationWorld方法的具体用法?C++ Transform::GetOrientationWorld怎么用?C++ Transform::GetOrientationWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transform的用法示例。


在下文中一共展示了Transform::GetOrientationWorld方法的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);
	}
}
开发者ID:VajraFramework,项目名称:Vajra,代码行数:32,代码来源:AiRoutine.cpp


注:本文中的Transform::GetOrientationWorld方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。