0% found this document useful (0 votes)
48 views2 pages

Question 2

This optional bonus assignment involves extending the collision avoidance algorithm to handle: 1) Three rays (central ray and two whiskers) to detect collisions with obstacles 2) Multiple obstacles in the scene 3) Generating a more compelling scene with at least 10 randomly sized obstacles placed using a Halton sequence The central ray and two whiskers will each avoid the closest obstacle to the character. A final steering force is calculated from the individual forces to avoid impending obstacles detected by each ray.

Uploaded by

ejaknon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views2 pages

Question 2

This optional bonus assignment involves extending the collision avoidance algorithm to handle: 1) Three rays (central ray and two whiskers) to detect collisions with obstacles 2) Multiple obstacles in the scene 3) Generating a more compelling scene with at least 10 randomly sized obstacles placed using a Halton sequence The central ray and two whiskers will each avoid the closest obstacle to the character. A final steering force is calculated from the individual forces to avoid impending obstacles detected by each ray.

Uploaded by

ejaknon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Bonus Assignment: Whisker Collision Avoidance

Due: March 21th. Upload to Brightspace by 11:59pm NST.

This bonus assignment is optional. If you receive a grade higher than your lowest assignment
mark, this grade will be used to replace your lowest assignment mark.

Compress the folder containing your source files as a .zip for submission.
You do not have to include: node_modules, package.json, and package_lock.json

Code that does not compile will result in a 0.


Code not in a .zip will result in a 0.

The primary goal of this assignment is to extend our collision detection algorithm to 1) handle
three ray casts in the central ray + fixed whiskers configuration to search for a collision with an
obstacle and 2) work with multiple obstacles in the scene.

Introduction

Recall from Lecture 7 and 8, we wrote Craig Reynold’s collision avoidance algorithm using one
ray (or vector) from the character to a “future location” that the character will be, a certain
number of frames in the future. The one ray implementation has some limitations, as
occasionally the ray will miss an obstacle, but the character will still hit it (see Figure 1).

Figure 1:
The one ray misses the obstacle,
but the character will still hit it.

There are a number of different configurations that have been used to combat this, one of which
is the “central ray with whiskers” approach. The central ray looks identical to the one ray
approach. The whiskers are short, at a fixed length (not a number of frames in the future, a
vector with a set magnitude), and splayed at a fixed angle on each side of the central ray. In
relation to the character, this will look as follows (Figure 2).

Figure 2:
The central ray with whiskers approach.
Task

In the starter code, you will be presented with a wandering character (using the wander()
steering behaviour) that avoids an obstacle using the one ray approach.

The three goals of this assignment are:

1) Convert the behaviour to avoid multiple obstacles


2) Convert the behaviour to avoid obstacles using the central ray with whiskers approach
3) Create a more compelling scene for the character to navigate

Specifications:

Avoiding multiple obstacles

Each ray can only avoid one obstacle at a time. This obstacle should be the closest obstacle to
the character’s location. The obstacles that collide with a ray but are further away will be
ignored.

The central ray + whiskers approach

For each ray, if there is a collision, a steering force will be generated. The final steering force will
be a combination of each force generated to avoid the impending obstacle(s). While each ray
can only avoid one obstacle at a time, each ray can avoid different obstacles.

A “more compelling scene”

● The scene must include a minimum of 10 obstacles


● Each obstacle will have a radius with a random size between 2 and 10 units
● Obstacles will be placed on the scene using a Halton sequence, as presented in Lecture
16 and 17.

Hints:

I would suggest starting by extending the original, single ray, avoid collision behaviour to work
with multiple obstacles. To accomplish this, you code should iterate over all of the obstacles in
the scene and check for a collision with each. If there is a collision, check the distance between
the character and the obstacle. Keep track of the closest distance to an obstacle and avoid that
obstacle.

You might also like