Posts

Showing posts from April 1, 2018

Adding Force to the Balls: Creating Balls - Task 2 Part 3

Image
This script adds force to the balls being created and allows the balls to have force used in a random range in a positive direction and a negative direction using vector3 you can access the x, y and z value for the balls.

Code Explained: Creating Balls - Task 2 Part 2

Image
This is the code we used to create balls by pressing a button. The variable 'm_prefab' has been declared in the public class as a gameObject meaning that a new game object has been created that can be used in Unity. 3D vectors are structure that are used throughout Unity to pass 3D positions and directions around. It  contains functions for doing common vector operations. Vector3 -  Creates a new vector with given x, y, z components. Random.Range - Returns a random float number between and min [inclusive] and max [inclusive]. This range is between -1f and 1f and is the same for the vectors x, y and z value components. Quaternion - Constructs new Quaternion with given x,y,z,w components. Instantiate - Clones the object original and returns the clone. To summerise, this code creates clones of the ball prefab and spawns them randomly. Bibliography & References [1] https://docs.unity3d.com/ScriptReference/Random.Range.html [2] https://docs.unity3d.c

Unity Project 2: Creating Balls - Task 2 Part 1

Image
This project uses a button that when pressed the scene produces a new ball as a clone. This hierarchy displays all of the elements needed to create this project.  By inserting a canvas and panel, the balls had a place to land. Hierarchy for the ball project  The inspector allows us to change the position, rotation and scale of the ball. Other options can also be changed in the inspector which includes rigidbody, collider and rendered for the mesh. Inspector for the ball object Gamespace These are the textures I have designed that will wrap around my objects and act as a skin.  Textures Different materials can be added to the objects (Panel, Ball etc.) to give them originality and a realistic feel. Materials By storing objects already used as prefabs means that they can be re-used making the game creation more  efficient. Prefabs When the spam balls button is pressed, the ball object is cloned creating more balls.