Table of Contents

set stage as ()

Description

The block sets the boundaries for the stage.

There are four types of stages for Physics Engine: boxed with roof, boxed without roof, open with floor, and open without floor.

Boxed with roof

The stage is packed with boundaries on all sides of the stage.

 

Boxed without roof

The stage has 3 boundaries – left, right, and bottom sides. The top side is open for the sprites to move. In this example, we are pushing 4 balls in different directions to see how they move on the stage.

Open with floor

The stage is open on the top, left, and right sides. The stage has a boundary only on the bottom side which act as the floor.

Open without floor

The stage is open on all sides. The sprites can move in all directions.

Example

The example demonstrates how to make a sprite be fixed to a point but can rotate. The wand is hanging like a pendulum.

The example demonstrates how to make a sprite be fixed to a point but can rotate. The wand is hanging like a pendulum.

The center of the wand in the costume is the point of rotation.

The following code creates the simulation of the pendulum.

Output

Read More
In this example, you understand the effect of the density, roughness, and bounce properties of the sprites. The ball falls from the top randomly, and the bell is fixed but can rotate. 

In this example, you understand the effect of the density, roughness, and bounce properties of the sprites. The ball falls from the top randomly, and the bell is fixed but can rotate.

Script of Bell

The bell center is changed to make it swing from the top.

Script for Ball

This script creates clones of the ball every 0.5 seconds.

This script assigns the properties of the clone.

Output

We will change the density of the bell and the ball in the block – set sprite density () roughness () bounce (). This will result in different simulations.

  1. Bell is very light and the balls are very heavy: The inertia of the balls will affect the bell too much.
  2. Bell is very light and balls are also very light: The bell is less affected by the ball. Gradually the bell slows down.
  3. Bell is very heavy and the balls are very light: The bell is not affected at all. The balls are thrown without adding any effect on the bell.
  4. Bell is very heavy and the balls are also very heavy: Same as option 2 – The bell is less affected by the ball. Gradually the bell slows down.
Read More
The example demonstrates the ball falling in gravity in a box. Using the pen extension we are also tracking the trajectory of the ball.

The example demonstrates the ball falling in gravity in a box. Using the pen extension we are also tracking the trajectory of the ball.

Read More
All articles loaded
No more articles to load