May 2018
Beginner
492 pages
11h 53m
English
Suppose when you press the button, rather than creating the new balloon at a fixed position in space, it spawns and grows from your hand position. One way to accomplish this is to make the balloon instance a child of your hand controller object.
The BalloonController will need to know which hand pressed the button and parent the balloon to that controller object. Specifically, we'll pass the hand Game Object to the NewBalloon function as follows:
public void NewBalloon(GameObject parentHand){ if (balloon == null) { balloon = Instantiate(balloonPrefab); balloon.transform.SetParent(parentHand.transform); balloon.transform.localPosition = Vector3.zero; }}
Note that in this function we added an extra test for ( ...
Read now
Unlock full access