August 2018
Intermediate to advanced
794 pages
28h 4m
English
The public float variable multiplier allows you to change the maximum magnitude of the force by changing the value in the ClickMove scripted component of each cube.
The ClickMove script class has a private variable called rigidBody set as a reference to the RigidBody component in the Awake() method.
Each time the cube receives a MouseDown() message (such as when it has been clicked with the user's mouse pointer), this method creates a random directional Vector3, and applies this as a force to the object's rigidBody reference.
The RandomDirectionComponent() method returns a random value between -multiplier and +multiplier.
Read now
Unlock full access