Falling ball

Making Physics Objects

Falling ball

In this tutorial you will learn how to:

You can download the project files here. My thanks to Matthew Peacock at Anonymous Creative Group for providing the demo direction and Photoshop file!

https://kwiksher.com/tutorials/Kwik4/FallingBalls.zip

.psd is 768 x 1024. You can create a new project with iPad Mini.

You find the following layers in falling.psd has

Creating a virtual wall

Setting the environment

Hybrid is a debug mode to check the body shape, in the final build, please get it back to Normal


Layer Properites

Select the all sbXX ball layers and click to open the layer properties in order to set the same properties to the layers at once

Layer Properties Window,


Physics Body - Dynamic

Keeping the multiple sections on the ball layers, click Set body properties from Physics

The following properties will be applied to all the balls


Physics Body - Staic

Select logo layer and make it Static body and set the shape from poly.lua

Kinematic body is not affected with gravity, so it is never falling but if another object hits it , it follows the law of physics. If isSensor is true, it ignores collisions.


Integration with Physics Editor

Physics Editor is a 3rd party tool to make the polygon shape for image. It outputs the coordinates of polygon shape to lua file. As we made Hybrid environment, you see the green overlay on the logo, it tells where the physics shape exists. Each ball’s shape is circle and it is overlay in orange because dynamic object. The logo is static so it is green.

Please check how to use Physics Editor from CodeAndWeb

You can drag the logo image from build4/assets/images/p1/logo.png to Physics Editor and the identifier for “logo” image should be “logo”.