Deprecated: Required parameter $query follows optional parameter $post in /var/www/html/wp-content/plugins/elementor-extras/modules/breadcrumbs/widgets/breadcrumbs.php on line 1215
Physics Engine - Blocks, Python Functions, Projects | PictoBlox Extension
[PictoBloxExtension]

Physics Engine

physics
Extension Description
Add physics to simulate the real-life simulation.

Introduction

What is Physics Engine?

Physics Engine is a 2D rigid body simulation library for making games and animations. Programmers can use it in their games to make objects move in realistic ways and make the projects more interactive. From the game engine’s point of view, the physics engine is just a system for procedural animation.

Accessing Physics Engine in Block Coding

Following is the process to add Physics Engine capability to the PictoBlox Project.

  1. Open PictoBlox and create a new file.
  2. Select the coding environment as Block Coding.
  3. Next, click on the Add Extension button and add the Physics Engine extension.
  4. You can find the Physics Engine blocks available in the project.

Core Concepts

Physics Engine works with several fundamental concepts and objects. We briefly define these objects here and more details are given later in the block definitions and examples.

  1. Shape: A shape is a 2D geometrical sprite, such as a circle or polygon or the sprite shape.
  2. Rigid body: A chunk of matter that is so strong that the distance between any two bits of matter on the chunk is constant. They are hard like a diamond. In the following discussion, we use body interchangeably with rigid body.
  3. Fixture: A fixture binds a shape to a body and adds material properties such as density, friction, and restitution. A fixture puts a shape into the collision system (broad phase) so that it can collide with other shapes.
  4. Constraint: A constraint is a physical connection that removes degrees of freedom from bodies. A 2D body has 3 degrees of freedom (two translation coordinates and one rotation coordinate). If we take a body and pin it to the wall (like a pendulum) we have constrained the body to the wall. At this point the body can only rotate about the pin, so the constraint has removed 2 degrees of freedom.
  5. Contact constraint: A special constraint designed to prevent penetration of rigid bodies and to simulate friction and restitution. You do not create contact constraints; they are created automatically by Physics Engine.
  6. World: A physics world is a collection of bodies, fixtures, and constraints that interact together. Box2D supports the creation of multiple worlds, but this is usually not necessary or desirable.
  7. Solver: The physics world has a solver that is used to advance time and resolve contact and joint constraints. The Box2D solver is a high-performance iterative solver that operates in order N time, where N is the number of constraints.
  8. Continuous collision: The solver advances bodies in time using discrete time steps.
Read More

PictoBlox Blocks

The block holds a sprite’s or the Stage’s volume. This block can be displayed as a Stage monitor.
It creates a clone of the sprite in the argument. It can also clone the sprite it is running in, creating clones of clones, recursively.
The block holds (reports) the mouse-pointer’s current Mouse X.
The block multiplies the two values and reports the result.
The block can delete all the items from the specified list.
The block inserts an item containing the given text into the list, at the given position. All values below the inserted item are passed onto the item beneath them; the last item’s value is placed in a new item at the end of the list.
The block tells whether the human hand is detected or not.
The get () position of () face () block reports the x and y position of the selected landmark of the selected face.
The block returns the specified parameter for the specified signal detected: class, x position, y position, width, height, and confidence.
The function returns the weather parameters (Rain, Snow, Extreme, etc.) of the location.
The block changes the pen size by the specified amount.
The block turns OFF all the RGB LEDs of Quarky.
The block sets the servo motor connected to the specified servo pin to the specified angle.
The block returns the distance reading from the specified ultrasonic sensor.
The block returns the number of objects identified with the specified object class.
The block reports the density of the sprite.
The block connects the soil moisture sensor to the specified pin. Once initialized, other moisture sensor-related blocks can be used.
The block connects the PictoBlox to the ThinkSpeak Channel with the specified write and the read API keys. Without this block, other functionality does not work related to ThinkSpeak.
The block resets the oscillator parameter for all the servo motors.
The block reports the current time value in milliseconds.
The block sets the pick and place arm angles to the specified value.
The block makes a request to ChatGPT to get the synonyms or antonyms of the text specified in it. The response of ChatGPT is then stored in PictoBlox and can be accessed using the get AI response block.
This block allows you to scale a value from one range of numbers to another.
The block sets up an 8×8 Dot Matrix display and assigns the pins of the display (DIN, CS, CLK) to be connected to the Arduino board. The code assigns the name of the display to the pins for easy referencing and establishes communication between the Arduino board and the display.
This block helps robot to follows a line and stops at checkpoints, detecting these when both IR sensors sense black simultaneously.
The sprite will move to a specified position as set on the grid.
Changes the scene in the stage as specified from the options.
Runs the blocks inside if a specified pin is touched of the quarky.
Turns off all the LED of the wizbot.
Runs the right motor of the wizbot in a specified direction.
All articles loaded
No more articles to load

Block Coding Examples

There are no block coding examples for the extension to show.
Table of Contents