Added Attack animation, Fix Edge case for path finding. Added footsteps. Level 2 merge #444
|
@ -1,3 +1,3 @@
|
||||||
Name: Level2_AITest_NavData
|
Name: Level2_AITest_NavData
|
||||||
ID: 255209218
|
ID: 258243609
|
||||||
Type: 15
|
Type: 15
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- NavData: 255209218
|
- NavData: 258243609
|
||||||
- EID: 20
|
- EID: 20
|
||||||
Name: ===== Light =====
|
Name: ===== Light =====
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -112,6 +112,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -164,6 +165,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -216,6 +218,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 500
|
Score: 500
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -268,6 +271,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 500
|
Score: 500
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -320,6 +324,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -372,6 +377,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -424,6 +430,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -482,6 +489,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 2
|
density: 2
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -702,6 +710,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -754,6 +763,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -806,6 +816,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -858,6 +869,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -910,6 +922,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 500
|
Score: 500
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -962,6 +975,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1014,6 +1028,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1066,6 +1081,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1118,6 +1134,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1170,6 +1187,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1222,6 +1240,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1274,6 +1293,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1326,6 +1346,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1378,6 +1399,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1430,6 +1452,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1482,6 +1505,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 500
|
Score: 500
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1534,6 +1558,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1586,6 +1611,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1638,6 +1664,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1696,6 +1723,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 500
|
Score: 500
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1748,6 +1776,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1800,6 +1829,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1852,6 +1882,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1904,6 +1935,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -1956,6 +1988,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -2014,6 +2047,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 500
|
Score: 500
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
|
currFood: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -2066,6 +2100,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -2118,6 +2153,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 50
|
Score: 50
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -2170,6 +2206,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -2222,6 +2259,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -2274,6 +2312,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -2332,6 +2371,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 2
|
density: 2
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -2558,6 +2598,7 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Score: 10
|
Score: 10
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
|
currFood: 0
|
||||||
density: 2
|
density: 2
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
soundDistance: 10
|
soundDistance: 10
|
||||||
|
@ -2778,6 +2819,7 @@
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: ScoringZone
|
- Type: ScoringZone
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
startingParticleCount: 10
|
||||||
- EID: 18
|
- EID: 18
|
||||||
Name: CollisionWall
|
Name: CollisionWall
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -2841,6 +2883,7 @@
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: ScoringZone
|
- Type: ScoringZone
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
startingParticleCount: 10
|
||||||
- EID: 17
|
- EID: 17
|
||||||
Name: CollisionWall
|
Name: CollisionWall
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -3041,8 +3084,6 @@
|
||||||
armLength: 2
|
armLength: 2
|
||||||
turnSpeedPitch: 0.200000003
|
turnSpeedPitch: 0.200000003
|
||||||
turnSpeedYaw: 0.400000006
|
turnSpeedYaw: 0.400000006
|
||||||
inverseXControls: true
|
|
||||||
inverseYControls: false
|
|
||||||
pitchUpperClamp: 45
|
pitchUpperClamp: 45
|
||||||
pitchLowerClamp: 5
|
pitchLowerClamp: 5
|
||||||
- EID: 9
|
- EID: 9
|
||||||
|
|
|
@ -442,6 +442,11 @@ namespace SHADE
|
||||||
|
|
||||||
if (ImGui::DragScalar("Col", ImGuiDataType_U16, &navSystem->numCols_editor)) {}
|
if (ImGui::DragScalar("Col", ImGuiDataType_U16, &navSystem->numCols_editor)) {}
|
||||||
if(ImGui::DragScalar("Row", ImGuiDataType_U16, &navSystem->numRows_editor)){}
|
if(ImGui::DragScalar("Row", ImGuiDataType_U16, &navSystem->numRows_editor)){}
|
||||||
|
if (ImGui::Checkbox("Draw Navigation Area", &navSystem->drawNavigationArea)) {}
|
||||||
|
if (ImGui::Checkbox("Draw Navigation Data", &navSystem->drawNavigationData)) {}
|
||||||
|
if (ImGui::Checkbox("Draw Path", &navSystem->drawPath)) {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ImGui::Button("Generate"))
|
if (ImGui::Button("Generate"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,11 @@ namespace SHADE
|
||||||
auto id = ComponentFamily::GetID<SHNavigationComponent>();
|
auto id = ComponentFamily::GetID<SHNavigationComponent>();
|
||||||
SHComponentManager::CreateComponentSparseSet<SHNavigationComponent>();
|
SHComponentManager::CreateComponentSparseSet<SHNavigationComponent>();
|
||||||
SystemID i = SystemFamily::GetID<SHNavigationSystem>();
|
SystemID i = SystemFamily::GetID<SHNavigationSystem>();
|
||||||
|
|
||||||
|
drawNavigationArea = true;
|
||||||
|
drawNavigationData = true;
|
||||||
|
drawPath = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHNavigationSystem::Exit()
|
void SHNavigationSystem::Exit()
|
||||||
|
@ -227,61 +232,57 @@ namespace SHADE
|
||||||
if (editor->editorState != SHEditor::State::PLAY)
|
if (editor->editorState != SHEditor::State::PLAY)
|
||||||
{
|
{
|
||||||
SHNavigationSystem* system = static_cast<SHNavigationSystem*>(GetSystem());
|
SHNavigationSystem* system = static_cast<SHNavigationSystem*>(GetSystem());
|
||||||
if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::H))
|
|
||||||
{
|
|
||||||
system->GenerateNavigationGridData(SHVec3{ 0.0f }, navigationAreaSize, 80, 80);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto debugDrawSystem = SHSystemManager::GetSystem<SHDebugDrawSystem>();
|
auto debugDrawSystem = SHSystemManager::GetSystem<SHDebugDrawSystem>();
|
||||||
if (debugDrawSystem)
|
if (debugDrawSystem)
|
||||||
{
|
{
|
||||||
SHTransform trans;
|
if (system->drawNavigationArea)
|
||||||
trans.position = SHVec3{ 0.0f };
|
|
||||||
trans.scale = navigationAreaSize;
|
|
||||||
trans.ComputeTRS();
|
|
||||||
debugDrawSystem->DrawWireCube(trans.trs, SHColour::YELLOW, false);
|
|
||||||
|
|
||||||
#ifdef DRAW_NAVIGATION_DATA
|
|
||||||
for (uint16_t r = 0; r < system->numRows; ++r)
|
|
||||||
{
|
{
|
||||||
for (uint16_t c = 0; c < system->numCols; ++c)
|
SHTransform trans;
|
||||||
|
trans.position = SHVec3{ 0.0f };
|
||||||
|
trans.scale = navigationAreaSize;
|
||||||
|
trans.ComputeTRS();
|
||||||
|
debugDrawSystem->DrawWireCube(trans.trs, SHColour::YELLOW, false);
|
||||||
|
}
|
||||||
|
if (system->drawNavigationData)
|
||||||
|
{
|
||||||
|
for (uint16_t r = 0; r < system->numRows; ++r)
|
||||||
{
|
{
|
||||||
if (system->GetNavigationData(r, c) == true)
|
for (uint16_t c = 0; c < system->numCols; ++c)
|
||||||
{
|
{
|
||||||
SHVec3 topleft{ system->origin.x - (system->size.x / 2.0f), system->origin.y, system->origin.z - (system->size.z / 2.0f) };
|
if (system->GetNavigationData(r, c) == true)
|
||||||
SHVec2 halfGridSize = system->GetGridSize() * 0.5f;
|
{
|
||||||
|
SHVec3 topleft{ system->origin.x - (system->size.x / 2.0f), system->origin.y, system->origin.z - (system->size.z / 2.0f) };
|
||||||
|
SHVec2 halfGridSize = system->GetGridSize() * 0.5f;
|
||||||
|
|
||||||
|
//offset it by row and column and center it with half grid size.
|
||||||
|
topleft += SHVec3{ c * system->GetGridSize().x, 0.0f, r * system->GetGridSize().y } + SHVec3{ halfGridSize.x,0.0f,halfGridSize.y };
|
||||||
|
SHTransform t;
|
||||||
|
t.position = system->GetGridWorldPos({ r,c });
|
||||||
|
t.scale = SHVec3{ halfGridSize.x * 2.0f, 1.0f, halfGridSize.y * 2.0f };
|
||||||
|
t.ComputeTRS();
|
||||||
|
debugDrawSystem->DrawCube(t.trs, SHColour::RED, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SHVec3 topleft{ system->origin.x - (system->size.x / 2.0f), system->origin.y, system->origin.z - (system->size.z / 2.0f) };
|
||||||
|
SHVec2 halfGridSize = system->GetGridSize() * 0.5f;
|
||||||
|
|
||||||
|
//offset it by row and column and center it with half grid size.
|
||||||
|
topleft += SHVec3{ c * system->GetGridSize().x, 0.0f, r * system->GetGridSize().y } + SHVec3{ halfGridSize.x,0.0f,halfGridSize.y };
|
||||||
|
SHTransform t;
|
||||||
|
t.position = system->GetGridWorldPos({ r,c });
|
||||||
|
t.scale = SHVec3{ halfGridSize.x * 2.0f, 1.0f, halfGridSize.y * 2.0f };
|
||||||
|
t.ComputeTRS();
|
||||||
|
debugDrawSystem->DrawCube(t.trs, SHColour::WHITE, true);
|
||||||
|
}
|
||||||
|
|
||||||
//offset it by row and column and center it with half grid size.
|
|
||||||
topleft += SHVec3{ c * system->GetGridSize().x, 0.0f, r * system->GetGridSize().y } + SHVec3{ halfGridSize.x,0.0f,halfGridSize.y };
|
|
||||||
SHTransform t;
|
|
||||||
t.position = system->GetGridWorldPos({r,c});
|
|
||||||
t.scale = SHVec3{ halfGridSize.x * 2.0f, 1.0f, halfGridSize.y * 2.0f};
|
|
||||||
t.ComputeTRS();
|
|
||||||
debugDrawSystem->DrawCube(t.trs, SHColour::RED, true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
SHVec3 topleft{ system->origin.x - (system->size.x / 2.0f), system->origin.y, system->origin.z - (system->size.z / 2.0f) };
|
|
||||||
SHVec2 halfGridSize = system->GetGridSize() * 0.5f;
|
|
||||||
|
|
||||||
//offset it by row and column and center it with half grid size.
|
|
||||||
topleft += SHVec3{ c * system->GetGridSize().x, 0.0f, r * system->GetGridSize().y } + SHVec3{ halfGridSize.x,0.0f,halfGridSize.y };
|
|
||||||
SHTransform t;
|
|
||||||
t.position = system->GetGridWorldPos({ r,c });
|
|
||||||
t.scale = SHVec3{ halfGridSize.x * 2.0f, 1.0f, halfGridSize.y * 2.0f };
|
|
||||||
t.ComputeTRS();
|
|
||||||
debugDrawSystem->DrawCube(t.trs, SHColour::WHITE, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -334,37 +335,36 @@ namespace SHADE
|
||||||
//return so we don't run the parts after this twice.
|
//return so we don't run the parts after this twice.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
comp.forward = SHVec3::Normalise(direction);
|
comp.forward = SHVec3::Normalise(direction);
|
||||||
|
|
||||||
#ifdef DRAW_NAVIGATION_PATH
|
#ifdef SHEDITOR
|
||||||
|
if (drawPath)
|
||||||
auto debugDrawSystem = SHSystemManager::GetSystem<SHDebugDrawSystem>();
|
|
||||||
|
|
||||||
auto queue = comp.path;
|
|
||||||
|
|
||||||
while (!queue.empty())
|
|
||||||
{
|
{
|
||||||
uint16_t r = queue.front().row;
|
auto debugDrawSystem = SHSystemManager::GetSystem<SHDebugDrawSystem>();
|
||||||
uint16_t c = queue.front().column;
|
|
||||||
|
auto queue = comp.path;
|
||||||
|
|
||||||
|
while (!queue.empty())
|
||||||
{
|
{
|
||||||
SHVec3 topleft{ origin.x - (size.x / 2.0f), origin.y, origin.z - (size.z / 2.0f) };
|
uint16_t r = queue.front().row;
|
||||||
SHVec2 halfGridSize = GetGridSize() * 0.5f;
|
uint16_t c = queue.front().column;
|
||||||
|
|
||||||
//offset it by row and column and center it with half grid size.
|
{
|
||||||
topleft += SHVec3{ c * GetGridSize().x, 0.0f, r * GetGridSize().y } + SHVec3{ halfGridSize.x,0.0f,halfGridSize.y };
|
SHVec3 topleft{ origin.x - (size.x / 2.0f), origin.y, origin.z - (size.z / 2.0f) };
|
||||||
SHTransform t;
|
SHVec2 halfGridSize = GetGridSize() * 0.5f;
|
||||||
t.position = GetGridWorldPos({ r,c });
|
|
||||||
t.scale = SHVec3{ halfGridSize.x * 2.0f, 1.0f, halfGridSize.y * 2.0f };
|
|
||||||
t.ComputeTRS();
|
|
||||||
debugDrawSystem->DrawCube(t.trs, SHColour::YELLOW, true);
|
|
||||||
|
|
||||||
|
//offset it by row and column and center it with half grid size.
|
||||||
|
topleft += SHVec3{ c * GetGridSize().x, 0.0f, r * GetGridSize().y } + SHVec3{ halfGridSize.x,0.0f,halfGridSize.y };
|
||||||
|
SHTransform t;
|
||||||
|
t.position = GetGridWorldPos({ r,c });
|
||||||
|
t.scale = SHVec3{ halfGridSize.x * 2.0f, 1.0f, halfGridSize.y * 2.0f };
|
||||||
|
t.ComputeTRS();
|
||||||
|
debugDrawSystem->DrawCube(t.trs, SHColour::YELLOW, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
queue.pop();
|
||||||
}
|
}
|
||||||
queue.pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -404,13 +404,92 @@ namespace SHADE
|
||||||
NavigationNode startingNode;
|
NavigationNode startingNode;
|
||||||
startingNode.index = GetNavigationGridIndex(transform->GetWorldPosition());
|
startingNode.index = GetNavigationGridIndex(transform->GetWorldPosition());
|
||||||
|
|
||||||
startingNode.parent.row = NullGridIndex;
|
if (GetNavigationData(startingNode.index) == true)
|
||||||
startingNode.parent.column = NullGridIndex;
|
{
|
||||||
startingNode.h = std::numeric_limits<uint32_t>::max();
|
uint16_t i = comp.tolerance;
|
||||||
startingNode.g = 0;
|
while (openList.empty())
|
||||||
startingNode.f = 0;
|
{
|
||||||
|
|
||||||
|
NavigationGridIndex tolCheckIndex = startingNode.index;
|
||||||
|
tolCheckIndex.row += i;
|
||||||
|
if (GetNavigationData(tolCheckIndex) == false)
|
||||||
|
{
|
||||||
|
startingNode.index = tolCheckIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolCheckIndex = startingNode.index;
|
||||||
|
tolCheckIndex.row -= i;
|
||||||
|
if (GetNavigationData(tolCheckIndex) == false)
|
||||||
|
{
|
||||||
|
startingNode.index = tolCheckIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolCheckIndex = startingNode.index;
|
||||||
|
tolCheckIndex.column += i;
|
||||||
|
if (GetNavigationData(tolCheckIndex) == false)
|
||||||
|
{
|
||||||
|
startingNode.index = tolCheckIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolCheckIndex = startingNode.index;
|
||||||
|
tolCheckIndex.column -= i;
|
||||||
|
if (GetNavigationData(tolCheckIndex) == false)
|
||||||
|
{
|
||||||
|
startingNode.index = tolCheckIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolCheckIndex = startingNode.index;
|
||||||
|
tolCheckIndex.row += i;
|
||||||
|
tolCheckIndex.column += i;
|
||||||
|
if (GetNavigationData(tolCheckIndex) == false)
|
||||||
|
{
|
||||||
|
startingNode.index = tolCheckIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolCheckIndex = startingNode.index;
|
||||||
|
tolCheckIndex.row -= i;
|
||||||
|
tolCheckIndex.column -= i;
|
||||||
|
if (GetNavigationData(tolCheckIndex) == false)
|
||||||
|
{
|
||||||
|
startingNode.index = tolCheckIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolCheckIndex = startingNode.index;
|
||||||
|
tolCheckIndex.row -= i;
|
||||||
|
tolCheckIndex.column += i;
|
||||||
|
if (GetNavigationData(tolCheckIndex) == false)
|
||||||
|
{
|
||||||
|
startingNode.index = tolCheckIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolCheckIndex = startingNode.index;
|
||||||
|
tolCheckIndex.row += i;
|
||||||
|
tolCheckIndex.column -= i;
|
||||||
|
if (GetNavigationData(tolCheckIndex) == false)
|
||||||
|
{
|
||||||
|
startingNode.index = tolCheckIndex;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
startingNode.parent.row = NullGridIndex;
|
||||||
|
startingNode.parent.column = NullGridIndex;
|
||||||
|
startingNode.h = std::numeric_limits<uint32_t>::max();
|
||||||
|
startingNode.g = 0;
|
||||||
|
startingNode.f = 0;
|
||||||
|
|
||||||
|
openList.push_back(startingNode);
|
||||||
|
|
||||||
|
|
||||||
openList.push_back(startingNode);
|
|
||||||
|
|
||||||
|
|
||||||
NavigationNode endNode;
|
NavigationNode endNode;
|
||||||
|
|
|
@ -75,6 +75,9 @@ namespace SHADE
|
||||||
|
|
||||||
AssetID navDataAsset{};
|
AssetID navDataAsset{};
|
||||||
|
|
||||||
|
bool drawNavigationArea;
|
||||||
|
bool drawNavigationData;
|
||||||
|
bool drawPath;
|
||||||
|
|
||||||
|
|
||||||
void GenerateNavigationGridData(SHVec3 origin, SHVec3 size, uint16_t numRow, uint16_t numCol) noexcept;
|
void GenerateNavigationGridData(SHVec3 origin, SHVec3 size, uint16_t numRow, uint16_t numCol) noexcept;
|
||||||
|
|
Loading…
Reference in New Issue