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

This block is used to analyze the image received as input from the stage, the current backdrop, and the current costume, for the handwritten and printed text.
The function reports the last text detected from the speech.
The block returns the selected class name.
The block resets and clears the NLP model.
This block is used to set the threshold for the confidence (accuracy) of object detection, 0 being low confidence and 1 being high confidence. With the threshold value, you can set the level of confidence required for object detection.
The block changes the current voice used in Text to Speech.
This block analyses the image and saves the QR Code information locally, which can be accessed using other blocks. You have to run this block every time you want to analyze a new image from the camera.
The function returns the atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), in hPa of the location.
The block will play the specified note with the set instrument for the specified amount of beats.
The block turns the webcam on (directly or flipped) or off depending on the argument. 
The block will make its sprite continuously pen a trail wherever it moves until the Pen Up block is used. The color, size, and transparency of the trail can be changed with other blocks.
The block reads the analog value of the sensors connected to the specified pin. The block returns the int value between 0 to 4096.
The block displays the specified pattern on the Quarky RGB LED. These patterns are predefined in the code.
The block stops both the motors of the Quarky robot.
The block returns the state of the specified IR sensor. It returns True if the current IR sensor value is greater than the threshold value, else False.
The block stops the execution of the audio running on Quarky.
The block enables or disables the automatic display of the box on object detection on the stage. This is useful when you want to see if the object detection happens during the analysis or not.
This block analyses the image and saves the information locally, which can be accessed using other blocks.
The block sets the four servo motors of the legs to align with the specified orientation – inside, left, and right.
The block checks if the currently recognized class from the analyse numbers block is the selected class or not.
The block reports the recognized class from the recognition window.
The block set the sprite characteristics for the Physics Engine as free, fixed, or fixed but can rotate.
The block reports the state of the sensor connected to the selected pin. The block returns true when it is HIGH (or 3.3V) or false when it is LOW (or 0V). The block is used for digital sensors like PIR Sensor, Flame Sensor, or the IR Sensor.
The block sets the analog state of the specified pin to the specified value between 0 to 255.
The block creates a new feed or deletes an existing feed with the specified name.
The block triggers the event to send a webhook request.
The block performs the selected motion for the quadruped. The motion runs for the specified times and at the specified speed.
The block writes the dataset to the CSV file as a new row.
This block calibrates the angles of the hand servo motors and saves it in the memory of Quarky. Due to some mechanical assembly errors, there may be some misalignment of the servos which can be handled with this block.
The block makes the robot move in the specified direction with the specified speed for the specified time and then stop automatically.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load
Table of Contents