That Awkward Sidewalk Dance

Daniel Kim
Data Mining the City
2 min readOct 1, 2019

We’ve all been there. You see another figure walking slowly toward you on the same side of the sidewalk. As you walk closer, the fear grow s within; you’d do anything to avoid the Awkward Sidewalk Dance. Despite your fears, you and your strange partner meet in the middle of the sidewalk. You step left, and the stranger steps right. Oh no, it’s too late! You’re trapped in an endless loop of manners and politeness.

This simulation tries to recreate the mass confusion that results from a crosswalk interaction. Although I was not skilled enough in C# nor Unity to figure out a more complex solution, I worked with the tools that were described in the Roll-A-Ball tutorial (arrow key inputs) and the Behavior Brick tutorials (move behaviors) to try and orchestrate the awkward interactions that could happen during a busy intersection crossing.

Agents : Crowds of “people” on either side of the crosswalk.

Environment : Any crosswalk on planet Earth.

Behavior : The agents move to a specified point on the other side of the crosswalk, and return to their beginning point. This operation repeats endlessly.

Parameters: Number of pedestrians who choose to take a bike, versus those who don’t.

Inputs: Number of people, speed, destination, and player movement.

Output: Pedestrian movement and confusion following collision.

The player is parent to an invisible, enlarged shape that acts as a collision box, shoving the innocent pedestrians aside.

Behavior Brick for the patrolling movement across the street

Player Controller — detects input for the rigid body:

using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class PlayerController : MonoBehaviour{public float speed;private Rigidbody rb; //check for playerinputvoid Start(){rb=GetComponent<Rigidbody>();}//update at every player movement. called before physicsvoid FixedUpdate(){float moveHorizontal = Input.GetAxis(“Horizontal”);float moveVertical = Input.GetAxis(“Vertical”);Vector3 movement = new Vector3(moveHorizontal,0.0f,moveVertical);rb.AddForce(movement*speed);}}

--

--