#include "common/oneworldenv.h"
#include "labengine/base/kaimfileopener.h"
namespace
{
#define KT_TEST_ENV_CLASS OneWorldEnv
KT_TEST_ENV {}
KT_TUTORIAL
{
KT_LOG_TITLE_BEGIN("TUTORIAL - Create and update CylinderObstacle");
KT_ASSERT(KT_ENV.AddNavData("generated/plane200x200_80ktri/plane200x200_80ktri.NavData") != nullptr);
KT_ENV.StartVisualDebugUsingLocalFile("CylinderObstacle.VisualDebug");
cylinderObstacleInitConfig.
m_world = KT_ENV.GetNavWorld();
cylinderObstacleInitConfig.
m_startPosition =
Kaim::Vec3f(1.f, 0.f, 0.f);
cylinderObstacleInitConfig.
m_height = 2.f;
cylinderObstacleInitConfig.
m_radius = 1.f;
cylinderObstacle->
Init(cylinderObstacleInitConfig);
for (
KyUInt32 gameFrame = 0; gameFrame < 10; ++gameFrame)
{
switch (gameFrame)
{
case 0:
case 1:
case 2:
case 3:
case 7:
{
cylinderObstacle->
SetPosition(cylinderObstacle->
GetPosition() + cylinderObstacle->
GetVelocity());
break;
}
case 4:
break;
case 6:
break;
case 8:
{
cylinderObstacle->SetPosition(cylinderObstacle->GetPosition());
break;
}
default:
break;
}
}
cylinderObstacle = nullptr;
KT_ENV.CleanUpWorld();
}
KT_TUTORIAL
{
KT_LOG_TITLE_BEGIN("TUTORIAL - Create and Update BoxObstacle");
KT_ASSERT(KT_ENV.AddNavData("generated/plane200x200_80ktri/plane200x200_80ktri.NavData") != nullptr);
KT_ENV.StartVisualDebugUsingLocalFile("BoxObstacle.VisualDebug");
boxObstacleInitConfig.
m_world = KT_ENV.GetNavWorld();
boxObstacleInitConfig.
m_startPosition =
Kaim::Vec3f(1.f, 0.f, 0.f);
boxObstacleInitConfig.
m_localHalfExtents =
Kaim::Vec3f(1.f, 1.f, 1.f);
boxObstacle->
Init(boxObstacleInitConfig);
for (
KyUInt32 gameFrame = 0; gameFrame < 10; ++gameFrame)
{
const Kaim::Vec3f boxCenterRelativePosition = boxObstacle->
GetTransform().
Rotate(boxObstacle->
GetLocalCenter());
Kaim::Vec3f boxCenterOnNavMesh = boxObstacle->GetTransform().
T + boxCenterRelativePosition;
transform.T = boxCenterOnNavMesh;
}
boxObstacle = nullptr;
KT_ENV.CleanUpWorld();
}
KT_TUTORIAL
{
KT_LOG_TITLE_BEGIN("TUTORIAL - Create and Update BoxObstacle");
KT_ASSERT(KT_ENV.AddNavData("generated/village_with_building_100m_yUP/village_with_building_100m_yUP.NavData") != nullptr);
KT_ENV.StartVisualDebugUsingLocalFile("BoxObstacle_Yup.VisualDebug");
coordSystem.
Setup(oneMeterInClientUnits, clientAxisForX, clientAxisForY, clientAxisForZ);
Kaim::Vec3f boxClientHalfExtents(200.0f, 50.0f, 100.0f);
boxClientTransform.T.
Set(3000.0f, -50.0f, 3000.0f);
boxObstacleInitConfig.
m_world = KT_ENV.GetNavWorld();
boxObstacle->
Init(boxObstacleInitConfig);
for (
KyUInt32 gameFrame = 0; gameFrame < 100; ++gameFrame)
{
boxClientTransform.R = clientRotationMatrix.
Transform(boxClientTransform.R);
}
boxObstacle = nullptr;
KT_ENV.CleanUpWorld();
}
}