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 its sprite’s current costume number.
The block holds the current backdrop number.
The block reports all the objects that are in contact with the sprite. 
The block reports the master or the current RFID tag ID.
The block reports the request-response code received.
The Color Detector module of the Camera Module processes the live video stream and detects colors as per the selected settings. This block gives the value of the selected color component for the selected cell.
The Oscilloscope module allows you to visualize the input and output signals of your hardware device on your smartphone. This block for setting the baud rate by selecting one from the drop-down for the Bluetooth module that you have connected to the boards.
The block holds its sprite’s size. This block can be displayed as a Stage monitor.
The block set the stage view to the defined coordinates with respect to the defined world coordinates. This is very helpful in creating games.
The block reports the body or error value from the HTTP request.
The Data Logger of the IoT module is used to monitor the data of sensors while they are being logged and can finally save the data in form of CSV file. This block is used for sending the data that is to be logged in the file. 
The block changes the stage view by the defined coordinate values with respect to the defined world coordinates. 
The block reports the value of the JSON object from the body.
This block refreshes the data sent to the hardware device from Dabble app.
The block reports the x coordinate value of the stage view.
The block reports the object count of the JSON object from the body.
The Camera module allows you to use your mobile camera for different activities like recording videos, capturing images, color detection, and face detection. This block is used for rotating your Smartphone’s camera in the module. 
The block reports the y coordinate value of the stage view.
The Data Logger of the IoT module is used to monitor the data of sensors while they are being logged and can finally save the data in form of CSV file. This block is used to configure the initial parameters of the data logger file. 
The block sets the velocity unit for the physics engine to the specified unit system.
The Oscilloscope module allows you to visualize the input and output signals of your hardware device on your smartphone. This block sends the data to the oscilloscope channel.  
The block sets the force unit for the physics engine to the specified unit system.
The Notification module of the IoT module triggers a notification in your Smartphone based on events occurring on your hardware. This block creates notifications that need to be sent.
The block sets the mass unit for the physics engine to the specified unit system.
The Oscilloscope module allows you to visualize the input and output signals of your hardware device on your smartphone. This block for setting the baud rate by selecting one from the drop-down for the Bluetooth module that you have connected to evive. 
The block reset the unit system of the physics engine to default.
The Camera module of Dabble app allows you to use your mobile camera for different activities like recording videos, capturing images, and color detection. This block is used to change the flash settings, camera quality, and zoom settings of your Smartphone’s camera.
The block reports the current unit system used for the specified property.
The Color Detector module of Camera Module process live video stream and detects colors as per the selected settings. This block is used for setting grid size, color calculation mode and color mode settings. The block consists of three drop downs.
The block converts the specified value of the distance from the input unit system to the target unit system.
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