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 button allows to add a sound from library to the list.
After execution, the sprite moves on the stage and does not draw lines.
After connection is established, moves the quarky a specified number of step backward.
Shows a specified text on the LED display of the quarky.
Analyzes and process images captured from the camera.
Analyzes and process hand detected from the camera.
Eables wizbot to follow a line using its sensors.
After connection is established, moves the wizbot a specified number of step forward.
This block switches the state of the wizbot to Draw mode.
This block makes the robot move forward and reverse for a set time, collecting IR sensor data on both white and black lines.
The block sets the cursor at the specified coordinate in the TFT Display of evive. Origin (0,0) is at the top left corner of the screen. Positive X-direction is to right while positive Y-direction is downward. Once the cursor has moved to the specified coordinate, you can write text using that point as the reference.
The block check takes the slide switch number (1 or 2) and state to be checked for (Up or Down) as input and returns “True” if the slide switch is in the specified state and “False” if it is not in the specified state.
The block returns a number received from the terminal module of the Dabble app.
The block free or locks the motor connected to the selected slot from evive, Arduino Uno, Mega & Nano.
The block reports the analog reading from analog sensor varying between 0 to 1023, connected to the selected analog pin.
This block should be included every time you work with the robotic arm as this block calibrates the angles of the servo motors and saves it in the memory of evive.
This block defines the PWM pins to which all the four servos of arms (2 servos of shoulders + 2 servos of hands) are connected.
The blocks turn their sprite the specified amount of degrees counter-clockwise. This changes the direction the sprite is facing.
The block gives its sprite a thought bubble with the specified text, which stays for the specified amount of seconds.
The block will stop any sounds currently being played on all sprites and the Stage. Pressing the Stop button will also stop all sounds, but is rarely used as it also stops all the other scripts running in the project.
Blocks held inside this block will be in a loop — just like the Repeat () block and the Repeat Until () block, except that the loop never ends (unless the stop sign is clicked, the Stop All block is activated, or the stop script block is activated within the loop). Due to this infinite loop, the block has no bump at the bottom; having a bump would be pointless, as the blocks below it would never be activated.
Scripts that wear this block will be triggered once the specified backdrop has been switched to on the Stage.
The block checks whether a color on its sprite is touching another color. If it is, the block returns “true”.
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 checks if the first value is greater than the other value. If the second value is less, the block returns true; if not, it returns false.
The block shows the specified variable’s Stage monitor.
This block is used to analyze the image received as input from the camera or the stage, for human pose detection.
The recognize () in image from () block extracts the image from Stage, Costume, or Backdrop in PictoBlox, analyzes it, and saves information in PictoBlox.
This block is used to set the threshold for the confidence (accuracy) of face detection, 0 being low confidence and 1 being high confidence. With the threshold value, you can set the level of confidence required for face detection.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load
Table of Contents