From 1c8711561bcbbe830d9441d3f1c07edc2ba7f1a9 Mon Sep 17 00:00:00 2001 From: Antoine H Date: Mon, 4 Jan 2021 15:59:58 +0100 Subject: [PATCH] Minifix for better client navigation near seats --- Assets/Resources/Clients/Oldman.prefab | 10 +++++----- Assets/Scenes/Tests/SampleScene.unity | 12 ++++++------ Assets/Scripts/Client_controller.cs | 7 ++++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Assets/Resources/Clients/Oldman.prefab b/Assets/Resources/Clients/Oldman.prefab index 795805b..e4ebfe0 100644 --- a/Assets/Resources/Clients/Oldman.prefab +++ b/Assets/Resources/Clients/Oldman.prefab @@ -117,7 +117,7 @@ BoxCollider2D: m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} - m_IsTrigger: 1 + m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: 0.0008151531, y: 0.09807843} @@ -178,10 +178,10 @@ NavMeshObstacle: m_GameObject: {fileID: 5304524770463492230} m_Enabled: 0 serializedVersion: 3 - m_Shape: 1 - m_Extents: {x: 0.15, y: 0.1, z: 0.00001} + m_Shape: 0 + m_Extents: {x: 0.25, y: 0.275, z: 0.25} m_MoveThreshold: 0.1 m_Carve: 1 m_CarveOnlyStationary: 1 - m_Center: {x: 0, y: 0.1, z: 0} - m_TimeToStationary: 0.5 + m_Center: {x: 0, y: 0.2, z: 0} + m_TimeToStationary: 0.1 diff --git a/Assets/Scenes/Tests/SampleScene.unity b/Assets/Scenes/Tests/SampleScene.unity index 101855a..8e218e7 100644 --- a/Assets/Scenes/Tests/SampleScene.unity +++ b/Assets/Scenes/Tests/SampleScene.unity @@ -3122,7 +3122,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 380775747} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -4.09, y: -0.31, z: 2.5482712} + m_LocalPosition: {x: -4.113, y: -0.325, z: 2.5482712} m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_Children: [] m_Father: {fileID: 1863361785} @@ -3558,7 +3558,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 837069666} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.83, y: -0.76, z: 2.5482712} + m_LocalPosition: {x: -0.878, y: -0.784, z: 2.5482712} m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_Children: [] m_Father: {fileID: 1863361785} @@ -3588,7 +3588,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 885015723} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -4.63, y: -0.74, z: 2.5482712} + m_LocalPosition: {x: -4.63, y: -0.815, z: 2.5482712} m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_Children: [] m_Father: {fileID: 1863361785} @@ -32709,7 +32709,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1756509214} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -3.4, y: -2.64, z: 2.5482712} + m_LocalPosition: {x: -3.4, y: -2.6, z: 2.5482712} m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_Children: [] m_Father: {fileID: 1863361785} @@ -32728,12 +32728,12 @@ NavMeshObstacle: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1810629360} - m_Enabled: 0 + m_Enabled: 1 serializedVersion: 3 m_Shape: 0 m_Extents: {x: 0.2, y: 0.2, z: 0.2} m_MoveThreshold: 0.1 - m_Carve: 0 + m_Carve: 1 m_CarveOnlyStationary: 1 m_Center: {x: 0, y: 0.2, z: 0} m_TimeToStationary: 0.5 diff --git a/Assets/Scripts/Client_controller.cs b/Assets/Scripts/Client_controller.cs index 83d8463..583cedd 100644 --- a/Assets/Scripts/Client_controller.cs +++ b/Assets/Scripts/Client_controller.cs @@ -25,6 +25,7 @@ public class Client_controller : MonoBehaviour, IUsable //Switch Agent to obstacle if waiting if(value=="waiting") { + agent.Warp(agent.destination); //Make sure agent become static at right position agent.enabled = false; navObstacle.enabled = true; } @@ -100,7 +101,7 @@ public class Client_controller : MonoBehaviour, IUsable agent.updateRotation = false; agent.updateUpAxis = false; //Get target - agent.destination = ClientManager.Instance.assignTarget(); + agent.SetDestination(ClientManager.Instance.assignTarget()); //Assign Random priority to prevent two agent blocking each other agent.avoidancePriority=Random.Range(0, 99); @@ -126,7 +127,7 @@ public class Client_controller : MonoBehaviour, IUsable { //Leave tavern status = "leaving"; - agent.destination = ClientManager.Instance.assignTarget(agent.destination); //Request next target + agent.SetDestination(ClientManager.Instance.assignTarget(agent.destination)); //Request next target } } @@ -148,7 +149,7 @@ public class Client_controller : MonoBehaviour, IUsable //Leave tavern status = "leaving"; - agent.destination = ClientManager.Instance.assignTarget(agent.destination); //Request next target + agent.SetDestination(ClientManager.Instance.assignTarget(agent.destination)); //Request next target } }