Description:
Your task is to design a roll a ball interactive experience in Unity. The scene consists of a ball, a cube in the center,
and three cylinders.
The user can control the ball with using the arrow keys. Touching the yellow cylinder will turn the center cube
yellow and it will start moving left. Touching the cyan cylinder will turn the center cube cyan and it will start
moving right. The cube text will update based on the movement of the cube. Clicking on the cube will toggle its
rotation. The white cylinder will toggle the spotlight on and off that follows the cube. The light text will update
if the light is on or off. See the video for a detailed demo.
2/3
Implementation Details:
1. Scene Setup
a. Camera: Position: (0, 10, -13), Rotation: 45, 0, 0)
b. Ball: Scale: (1, 1, 1)
c. Ground Plane: Position: (0, 0, 0), Scale: (2, 1, 2)
d. Center Cube: Position: (0, 1.5, 0), Scale: (2, 2, 2)
e. Spotlight: Position: (0, 5, 0). Rotation: (90, 0, 0). Range: 10. Intensity: 4.5. Spot Angle: 60.
f. Wall Bottom (Cube): Position: (0, 0.5, -10), Scale: (18, 1, 1), Rotation: (0, 0, 0).
g. Wall Top (Cube): Position: (0, 0.5, 10), Scale: (18, 1, 1), Rotation: (0, 0, 0).
h. Wall Left (Cube): Position: (-9.5, 0.5, 0), Scale: (20, 1, 1), Rotation: (0, 90, 0).
i. Wall Right (Cube): Position: (9.5, 0.5, 0), Scale: (20, 1, 1), Rotation: (0, 90, 0).
j. Assign the red material to the left and right walls.
k. Assign the green material to the top and bottom walls.
l. Assign the blue material to the ground plane.
m. Yellow Cylinder: Position: (-9, 1, -9), Scale: (2, 1, 2).
n. Cyan Cylinder: Position: (9, 1, -9), Scale: (2, 1, 2).
o. White Cylinder: Position: (0, 1, 9), Scale: (2, 1, 2).
p. Light On text. Top left corner. Font Size: 40.
q. Cube Off text. Top right corner. Font Size: 40.
r. Light button. Bottom Middle. Font Size: 48.
s. Create a textured material for the ball. Select the texture image of your choice and assign it to
the sphere.
t. Starting the game will immediately sets the color of the cube to magenta.
2. User Interaction
a. Allow the user to control the ball using the horizontal and vertical axes input.
b. Left click on the cube will activate its rotation by 30 degrees per second around the y axis.
c. Collision of the ball with the white cylinder will toggle the spotlight on and off. The spotlight
will always remain on the top of the cube
d. Clicking the Light button will turn off or turn on the light. The text of the light will update if the
light is on or off.
3. Interactive Object Manipulation
a. As long as the ball is colliding with the yellow cylinder, the cube will turn yellow and translate
towards left (negative x axis) by 1 unit per second. The translation should only happen if the x
position of the cube is greater than -8.
b. As long as the ball is colliding with the cyan cylinder, the cube will turn cyan and translate
towards right (positive x axis) by 1 unit per second. The translation should only happen if the x
position of the cube is less than 8.
c. As long as the ball is at the top left corner, the cube will turn red and translate up (positive z
axis) by 1 unit per second. The translation should only happen if the z position of the cube is less
than 5.
d. As long as the ball is at the top right corner, the cube will turn green and translate down
(negative z axis) by 1 unit per second. The translation should only happen if the z position of the
cube is greater than -5.
e. The text for the cube will correctly display if the cube is moving left, right, up, down, or is not
moving. The color of the text should be yellow when moving left, cyan when moving right, red
when moving up, green when moving down, and black when not moving.
f. The text for the light will correctly display if the light is on or off. The color of the text will be
white when the light is on and black when it is off.
3/3
4. Physics (4)
a. The movement of the ball is handled by correctly applying the force with the magnitude of 5 in
the x-z plane based on the input axes.
b. Collisions of the balls with the cylinders, ground and the walls are correctly handled.


Are there any questions left?
New questions in the section C#
Create a Free Account
Level up your programming skills with IQCode
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Pleased to see you again

Sign up to unlock all of IQCode features:
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Looking for an answer to a question you need help with?
you have баллов