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

Controls the camera functionality, allowing users to turn the camera on or off and switch to other camera.
Starts the script whenever you press a specified button of the wizbot.
Calibrates wizbot sensors, ensuring accurate readings for line following
Switches the state of the wizbot to Grid mode.
The block takes the motor port, the direction of rotation (forward or reverse) and speed of rotation (between 0 to 100 %) as input from the user and rotates the motor accordingly.
evive has two tactile switches; this block checks if either of them is pressed. The switch whose state you want to check can be chosen from the drop-down menu on this block. It returns “true” if the switch is pressed and “false” if the switch is not pressed.
The block compares the latest string message in the terminal with the data input by the user in the block. If the data matches, it returns the true, else it returns false. 
The block reports either the temperature or humidity (selected from the dropdown menu) from DHT sensor connected to the digital pin selected from the drop-down menu.
The block is used to draw characters and symbols on evive TFT Display. The matrix size for the block is 20 horizontally and 16 vertically. 
This block defines the PWM pins to which each of the servos is connected.
This block defines the PWM pins to which all the four servos of legs(2 servos of legs + 2 servos of feet) are connected.
The blocks turn their sprite the specified amount of degrees clockwise. This changes the direction the sprite is facing.
The block gives its sprite a speech bubble with the specified text — the speech bubble stays until another speech or thought block is activated, or the stop sign is pressed.
The block will play the specified sound, with no pause to its script.
Blocks held inside this block will loop a given amount of times, before allowing the script to continue. If a decimal is put in, the number is rounded up.
Scripts placed underneath this block will activate when the specified key is pressed.
The block checks whether its sprite is touching a specified color. If it is, the block returns “true”.
The block checks if the first value is equal to the other value. If the values are equal, the block returns true; if not, false. This block is not case-sensitive.
The block will change the specified variable by a given amount.
The block enables or disables the automatic display of the box on the human pose or hand detection on the stage. This is useful when you want to see if the detection is happening or not.
The recognize () in image after () seconds block starts the camera and takes an image after the specified time and analyzes it. It then saves the image features in PictoBlox.
The function enables or disables the automatic display of the box on face detection on the stage.
This block is used to analyze the image received as input from the camera, for the handwritten and printed text.
When the block is executed, the recognition window will open and you will get a specified time during which PictoBlox will record whatever you say. Once recorded, the speech will be converted to the text of the language you spoke in and saved locally.
The block opens the recognition window and shows the machine learning analysis on the camera feed. Very good for visualization of the model in PictoBlox.
The block trains the NLP model with the data added with add () as () block.
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.
The block causes the text in the Text to Speech extension to be spoken using the pronunciation of the given language but does not translate the text.
The block returns the PictoBlox language of the current user. This block can be used with the translate () to () block, to translate to or from the end user’s set language.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load
Table of Contents