Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 79fce001 authored by Daniel Dugas's avatar Daniel Dugas
Browse files

ensure boxes don't spawn on goal

parent 5f868aa8
No related branches found
No related tags found
No related merge requests found
......@@ -199,15 +199,22 @@ public class CrowdBotSim_TrialManager : MonoBehaviour, TrialManager {
float GOAL_X = -7;
float ROBOT_Z = 0;
float GOAL_Z = 0;
float ROBOT_R = 0.3f;
float GOAL_R = 0.5f;
float PAD_R = 1.0f;
float xmin = x - width / 2.0f;
float xmax = x + width / 2.0f;
float zmin = z - depth / 2.0f;
float zmax = z + depth / 2.0f;
bool collides_with_robot_or_goal = false;
if (
x < (ROBOT_X + width / 2.0f) && x > (ROBOT_X - width / 2.0f) &&
z < (ROBOT_Z + depth / 2.0f) && z > (ROBOT_Z - depth / 2.0f)
ROBOT_X > (xmin - ROBOT_R - PAD_R) && ROBOT_X < (xmax + ROBOT_R + PAD_R) &&
ROBOT_Z > (zmin - ROBOT_R - PAD_R) && ROBOT_Z < (zmax + ROBOT_R + PAD_R)
)
collides_with_robot_or_goal = true;
if (
x < (GOAL_X + width / 2.0f) && x > (GOAL_X - width / 2.0f) &&
z < (GOAL_Z + depth / 2.0f) && z > (GOAL_Z - depth / 2.0f)
GOAL_X > (xmin - GOAL_R - PAD_R) && GOAL_X < (xmax + GOAL_R + PAD_R) &&
GOAL_Z > (zmin - GOAL_R - PAD_R) && GOAL_Z < (zmax + GOAL_R + PAD_R)
)
collides_with_robot_or_goal = true;
return collides_with_robot_or_goal;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment