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

Moves the wizbot in arc length in specified direction and step length from the options.
The block is used to draw an outline of the triangle or a filled triangle from three points on evive TFT display. It takes the color and the 3 points for the corner of the triangle to draws a triangle.
When the block is executed it plays the tone of specified frequency/note for a specific duration/beat. The note and the beat can be selected from the drop-down menu. Also, the user can input the specific frequency and duration (in milliseconds).
Dabble input module has 2 potentiometers whose value can be varied from 0 to 1023 by the user. This block reports the current value of the selected potentiometer.
The block sets the end-effector to the specified position on the selected axis and the other two positions remain the same.
This block sets the value of the selected servo by the value you enter. Whereas the angle of other servos remains the same.
The block changes the selected sprite’s X position to a specified value.
The block changes the specified effect on its sprite by the specified amount. There are seven different effects to choose from: colour, fisheye, whirl, pixelate, mosaic, brightness and ghost.
The block reports how loud the noise is that a microphone receives, on a scale of 0 to 100. To use this block, a microphone must be used, and so a message will appear on the screen, asking for permission to use the microphone. If you deny it, the block will report a loudness of 0 or -1.
The block picks a pseudorandom number ranging from the first given number to the second, including both endpoints. If both numbers have no decimals, it will report a whole number. For example, if a 1 and a 3 were inputted, the block could return a 1, 2 or 3. If one of the numbers has a decimal point, even .0, it reports a number with a decimal. For example, if 0.1 and 0.14 were given, the output will be 0.1, 0.11, 0.12, 0.13, or 0.14.
The block replaces the specified item; in other words, it changes the item’s content to the given text.
The function allows the user to add a particular face into the database from the camera or stage. The user can specify the name of the face with the argument as well. This addition of the face in the database is also stored inside the PictoBlox file while saving.
The block returns the specified parameter for the specified number card detected.
The function set the API keys for the Open Weather Map API calls.
The block returns the hex code of the Red, Green, and Blue values specified.
The block returns the state of the digital sensor connected to the specified pin of the Quarky.
The block does the step simulation for the Physics Engine. This block is required to run in a loop for the physics to work.
The block reports the moisture reading from the sensor. The value varies from 0 to 100%.
The block sends multiple data to the ThingSpeak channel with a delay of the specified time seconds. The data is mapped to the 8 fields of the ThingSpeak channel.
The block executes the oscillator according to stored parameters for the servo motor and the current angle specified in the block.
The block sets the oscillator parameters for the selected servo motor.
The block moves the servo motors of the pick and place robot to the place angle specified by the user.
The block sets the user API key of the ChatGPT in the project. 
The block makes the specified LED turn ON or OFF on the 8×8 Dot Matrix display.
This block is used to move the end-effector to the specified position of the selected axis, while the other two positions remain the same.
This block allows the user to control the end-effector of a robotic arm to move in a specified axis by a set value, with all other axes remaining constant.
This block is use for set the motor speed while doing the line following and Turning.
Moves the wizbot forward for a √2 step length on the grid pattern.
The block sets the time on evive’s Real Time Clock (RTC) to the time specified by the user in the input.
Dabble phone sensor module give the real-time reading of the following sensors to evive: Accelerometer, gyroscope, proximity sensor, magnetometer, light meter, sound meter, GPS, temperature sensor and barometer. This block reports the current value of the selected sensor.
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