build a small set of 3D physics demonstrations using the Unity Game Engine
Budget: £20 – £250 GBP
build a small set of 3D physics demonstrations using the Unity Game Engine1
that
can perform a variety of tasks in 3D using vector maths and equation of motion2
. This can be
implemented in the language of your choice (Javascript or C#) though C# is preferred. Note
that you are allowed to use the transform of all the game objects but not the rigid body or
any of the Unity Physics. You must use the Euler method (described in the lectures) for all of
the problems. You can use the structure Vector3 but not its methods such as normalized etc.
Note that for high marks your solutions must be complete (meet all requirements), well
coded, reusable, be a realistic, and take into account the dimension of the game objects in
collisions.
You shall build and test a class library consisting of at least the following functions. Note in
Unity you can use Vector3 as your basic 3D vector structure.
Function Max Mark
3D vector addition
3D vector subtraction
3D dot product
Unit vector of a 3D vector
Vector reflection (axis aligned)
Polar to cartesian, Cartesian to
Polar coordinates
Unit direction vector
Magnitude of a 3D vector
Scaler multiple of 3D vector
Vectors nearly equal with radius
3D zero vector (0,0,0)
A point is on a line
Task 1 – 3D Trajectory problem with restitution
A) A trajectory in 3D (use a sphere) for a projectile that has a launch vector that can be
set in design time. Time step = Time.deltaTime. The gravity vector is (0.0, -9.81,0.0).
The initial position of the projectile can be anywhere in your scene. When the sphere
lands (so y component of position very close to zero) then the sphere should bounce
as though on a hard surface. See figure 1. Use a coefficient of restitution e that has a
value that can be set at design time by using a public property on the script. Note
that you need to decide when to stop the ball and this should be when the new
bounce height (in y) is approaching zero. In other words, the vertical velocity after
the bounce is smaller in than some tolerance (e.g. 0.01).
Task 3
This task is to create a scene that demonstrates a path follow routine using vector maths
(direction vectors). Set up four or more game objects (waypoints) anywhere in a 3D scene.
Another game object (a sphere) travels from waypoint to waypoint continuously at a speed
that can be set via a public property in the Unity script. Once the sphere is within a given
distance to the waypoint, it should then move in a circle around the waypoint and then on
to the next waypoint (5 points for this step). The radius of the rotation can be set as a public
property – see Figure 5 Waypoint script settings.
If your waypoints are labelled A B C D, then the order of travel shall be A B C D A and then
repeat. The figure below shows an example scene with four cylinders as waypoints. Note
that you must be able to move the waypoints to any location at design time and path follow
with still work. Figure 6 shows the moving object’s public script properties.
Task 4: - 25 Marks Available
A) Vector reflection and friction problem. Construct a plane surround by four solid walls.
This is similar to the pool or snooker table and can be square or rectangular. Figure 6
show a stylised plane and four cubes stretched out to form the surrounding walls
(think snooker table cushions to get the dimensions correct). For part A you only need
one ball (sphere).
that
can perform a variety of tasks in 3D using vector maths and equation of motion2
. This can be
implemented in the language of your choice (Javascript or C#) though C# is preferred. Note
that you are allowed to use the transform of all the game objects but not the rigid body or
any of the Unity Physics. You must use the Euler method (described in the lectures) for all of
the problems. You can use the structure Vector3 but not its methods such as normalized etc.
Note that for high marks your solutions must be complete (meet all requirements), well
coded, reusable, be a realistic, and take into account the dimension of the game objects in
collisions.
You shall build and test a class library consisting of at least the following functions. Note in
Unity you can use Vector3 as your basic 3D vector structure.
Function Max Mark
3D vector addition
3D vector subtraction
3D dot product
Unit vector of a 3D vector
Vector reflection (axis aligned)
Polar to cartesian, Cartesian to
Polar coordinates
Unit direction vector
Magnitude of a 3D vector
Scaler multiple of 3D vector
Vectors nearly equal with radius
3D zero vector (0,0,0)
A point is on a line
Task 1 – 3D Trajectory problem with restitution
A) A trajectory in 3D (use a sphere) for a projectile that has a launch vector that can be
set in design time. Time step = Time.deltaTime. The gravity vector is (0.0, -9.81,0.0).
The initial position of the projectile can be anywhere in your scene. When the sphere
lands (so y component of position very close to zero) then the sphere should bounce
as though on a hard surface. See figure 1. Use a coefficient of restitution e that has a
value that can be set at design time by using a public property on the script. Note
that you need to decide when to stop the ball and this should be when the new
bounce height (in y) is approaching zero. In other words, the vertical velocity after
the bounce is smaller in than some tolerance (e.g. 0.01).
Task 3
This task is to create a scene that demonstrates a path follow routine using vector maths
(direction vectors). Set up four or more game objects (waypoints) anywhere in a 3D scene.
Another game object (a sphere) travels from waypoint to waypoint continuously at a speed
that can be set via a public property in the Unity script. Once the sphere is within a given
distance to the waypoint, it should then move in a circle around the waypoint and then on
to the next waypoint (5 points for this step). The radius of the rotation can be set as a public
property – see Figure 5 Waypoint script settings.
If your waypoints are labelled A B C D, then the order of travel shall be A B C D A and then
repeat. The figure below shows an example scene with four cylinders as waypoints. Note
that you must be able to move the waypoints to any location at design time and path follow
with still work. Figure 6 shows the moving object’s public script properties.
Task 4: - 25 Marks Available
A) Vector reflection and friction problem. Construct a plane surround by four solid walls.
This is similar to the pool or snooker table and can be square or rectangular. Figure 6
show a stylised plane and four cubes stretched out to form the surrounding walls
(think snooker table cushions to get the dimensions correct). For part A you only need
one ball (sphere).