Ejemplo n.º 1
0
	public bool CheckObstacleCollision(Vector3 pos, ObstaclesScript script)
	{
		//if (state == null || script == null)
		//	return false;
						
		if (script.ShapeChoice.Shape == Enum.Enumeration.Sphere)
		{
			Vector3 obstaclePos = script.gameObj.transform.position;
			Vector3 aux = obstaclePos - pos;
			
			float sphereRadius = script.size.x;
			
		 	return (aux.magnitude - sphereRadius - agentRadius) <= 0;				
		}
		else if (script.ShapeChoice.Shape == Enum.Enumeration.Rectangle)
		{
			Bounds box = script.gameObj.collider.bounds;
			
			return box.SqrDistance(pos) <= agentRadius;
		}
				
		return false;		
	}	
Ejemplo n.º 2
0
    public bool CheckObstacleCollision(FootstepPlanningState state, ObstaclesScript script)
    {
        //if (state == null || script == null)
        //	return false;

        if (script.ShapeChoice.Shape == Enum.Enumeration.Sphere)
        {
            Vector3 obstaclePos = script.gameObj.transform.position;
            Vector3 aux = obstaclePos - state.currentPosition;

            float sphereRadius = script.size.x;

         	return (aux.magnitude - sphereRadius - analyzer.GetRadius()) <= 0;
        }
        else if (script.ShapeChoice.Shape == Enum.Enumeration.Rectangle)
        {
            Bounds box = script.gameObj.collider.bounds;

            return box.SqrDistance(state.currentPosition) <= analyzer.GetRadius();
        }

        return false;
    }