ProjectilePhysicsScreenshot.png

PROJECTILE PHYSICS SIMULATION

 
ppscreenshot2.png

For this assessment I was tasked with implementing a clay pigeon style physics simulation within unity without using unity's build in physics and collision systems. The requirements were as follows:

  • The target launcher will use random values to launch projectiles.

  • Projectiles will behave under the laws of physics where gravity is the same as on earth.

  • The "shooter" is automated and must calculate to fire to intercept the target projectile.

  • There should be a basic User Interface in place that indicates the number of targets hit and the number of air speed of the target projectile in m/s.

  • The simulation should run until the user presses the escape key to halt execution of the program.

 
ProjectilePhysicsScreenshot.png

As we were required to use custom physics in this assessment the first thing I did was start to design a "projectile" class that has a velocity and acceleration. 

The base turret would, using a custom pseudo random number generator, determine a random place to fire the projectile. The "interceptor" turret then takes those values and plugs them into newton's equation of motion using the value the user specifies for how long the intercept should take.

 
ppscreenshot2_edited.jpg

The collision of the two projectiles is then determined by my custom collision system for spherical objects in which two objects distances are compared to the addition of their radius's.


If the two radius values together are greater than or equal to the distance then we know a collision has occured.