In part 1 of the “Basic Physics in Goo Create” tutorial we created a tilted pinball table, some bumpers and a ball. Pressing play showed that the ball moved around the pinball table in a physically realistic way.
Here is a screen shot of the entity hierarchy you should have so far if you followed the first part.
In this part we will add the bottom flippers and slants and finally the script to give them the appropriate behavior.
Remember: before we can add new entities to the table we have to reset the table tilt. The table tilt is set to 36 degrees on the X axis:
Hint: To see this you have to click on the table in the entity hierarchy (on the right side) and open up the transform panel (on the left side).
Change the rotation degrees to zero and the table should appear flat again.
Now we add the slants. The slants are at the side of the flippers and keep the ball from draining.
Hint: If you want the game to be harder you can leave the slants out of course.
To add the slants simply add another two boxes and give them a collider component and the following settings:
It should look like this:
OK, now it’s time to add the actual flippers. Since a flipper needs to flip from the side we need to give them a parent entity or they would spin instead of flip.
So let’s first add two empty entities. Give them each a rigid body component and the following settings:
Finally we add the flippers themselves. Add another two boxes. Give them fitting names like LeftFlipper and RightFlipper. Then nest them each under it’s appropriate pivot entity. Then give them colliders and the following settings:
Here is a screen shot of the final entity hierarchy:
OK, we are done with the entity hierarchy. It is time to tilt the pinball table again. Select the table entity and change the X rotation to 36 again.
Hint: If you want you can move the slants around to fit the flippers better.
Here is my final result:
Now we will add the script.
Make sure you have selected the table entity. Now click on +ADD COMPONENT and select script. Inside the script component panel select ADD SCRIPT and select CUSTOM.
Click on the edit button
and replace the existing script with this one:
Click on play and you should have a working Goo Pinball Game! PS: If you spend more time on details and involve a graphics artist you get this: