Every layer interacting with gravity needs to be set as a body.
Pressing the Set Body Properties button will show the following window:
Information about the current layer content will appear in the top of the window (position and size).
Bodies can be:
- Dynamic: meaning they will interact with gravity and other bodies;
- Static: meaning they will interact with other bodies but gravity does not apply to them (a floor, for example);
Kinematic: meaning they are not affected by forces but nor gravity; When checked, Is sensor sets the body to detect collisions but does not produce a visual response.
Density sets the mass of the body.
Friction defines the the friction between bodies.
Bounce sets the object velocity after a collision.
For more information on the parameters, check Corona’s API at http://docs.coronalabs.com/api/library/physics/addBody.html
Gravity scale, when set differently than 1, bypasses the environment gravity. For example, a value of 0 makes the body float in the screen.
Apply inverted gravity, when enabled changes the original gravity of a dynamic body. For example, if the page gravity tells object to fall, the dynamic body with inverted gravity will float instead.
A Shape (the form of an object) can be:
- Circle: object has a circular shape;
- Rectangle: object has a rectangular shape;
Polygon: object has a complex shape;
If the selection if Polygon, it is necessary to inform the shape of the object. It can be done using:
Path: lists all Photoshop previously made paths. A shape path can have only the maximum number of 8 points around the object. You must draw it from top to bottom, left to right;
Import from Physics Editor:
for more complex paths it is strongly recommended that you use Physics Editor, an external tool created just for path automation. If you are using it, simply point to the Lua file created by Physics Editor.
when using Physics Editor, you must set all body properties there (they overwrite Kwik’s setting). Also, make sure your shape name in PE matches the file image exported from Kwik.
For example, if your layer name is “square” and it is part of page 2, Kwik will export it as “p2_square.png”. This is the file you should open in PE and create the properties. If you name the shape (in PE) as “square”, you are going to receive a Corona Terminal error because Kwik will not find the image “square.png”.