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 checks if the specified key is pressed. If the key is being pressed, the block returns “true”; if it is not, it returns “false”.
The is () detected? block checks whether the selected class has been detected or not. If the class is detected, then the block returns true; else, false.
The block adds two values and reports the result. The numbers can be typed directly into the block, or Reporter blocks can be used instead. This block can be stacked inside itself; this can be used to fit more numbers in.
The block adds an item onto the end of the specified list, the item containing the given text.
This block returns whether the specified detection point is detected or not on the specified pose number.
In computer vision, you can get the location and other parameters of the recognized celebrity, brand, and Object using the recognized () () () block.
The is expression of face () () block checks whether the selected face has a particular emotion or not. If the emotion matches, then the block returns true; else, false.
The block reports the specified class confidence value from the selected image feed (camera, stage, costume or backdrop). 0 is low confidence and 1 is high confidence.
The block returns the class label name.
The function returns the QR Code angle detected.
The function returns the latitude or the longitude coordinates of the location.
The block changes the project’s tempo, or speed, to the specified amount, using the unit “bpm”, or “beats per minute”.
The block maps the specified value from the first range to the second range.
The block changes the color of the particular RGB LED of Quarky.
The block sets the specified motor of the Quarky robot to the specified direction (“FORWARD” or “BACKWARD”) and specified speed.
The block returns the state of the specified touch sensor of Quarky. If the touchpad is touched it will return True, else False.
The block reports the specified class confidence value of the selected class. 0 is low confidence and 1 is high confidence.
The () of object () block reports the following attributes of the object: class, x position, y position, width, height, and confidence.
The block reports the specified class confidence value of the selected class. 0 is low confidence and 1 is high confidence.
The block reports the specified class confidence value of the selected class. 0 is low confidence and 1 is high confidence.
The blocks make the sprite go to the specified x and y locations according to the specified coordinate system – world, stage, or relative.
The block reports the analog reading of the sensor connected to the selected pin. The value will vary between 0 to 4095.
The block reverses the forward direction of the specified motor of the Quarky Expansion Board.
The block reports the red, green, or blue value of the color saved from the last data request from the get color from feed () block.
The block reports value 3 of the webhook event.
The block set all the servo motors of the quadruped angles to 90.
The block sets the servo motors of the humanoid hands to the specified angles at the specified speed.
This block sets which ports the left and right servo motors of the pick and place robot are connected to.
The block stores and reports the latest response from the ChatGPT.
This block resets the timer value to 0.0, which is necessary at the start of a project to ensure the Timer block holds the correct value.
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