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 performs the selected action for the quadruped. The action runs for the specified times and at the specified speed.
The block reports the current time.
The block performs the selected motion for the humanoid. The motion runs for the specified times and at the specified speed.
The block stops all the motors of the robot.
The Block makes a request to ChatGPT to define the text specified in it. The response of ChatGPT is then stored in PictoBlox and can be accessed using the get AI response block.
This block sets the output of a selected PWM pin of an Arduino Uno, Arduino Mega, or Arduino Nano board to a value from 0 to 255. When set to 128, the output will be high for half the time, and low for the other half. This allows users to control the voltage output to an attached device.
This block writes a specific text, such as “Hello, World!”, onto an LCD display. It is useful for creating simple text-based user interfaces for electronic projects or devices.
This block resets all the servo motors of the robotic arm to their default angle which is commonly referred to as the ‘home’ position.
This block allows you to adjust the robot’s turning speed.
Starts the script whnever a message of specific color is recieved.
Moves the sprite a specified number of grid squares down.
Increases the sprite’s size.
Stop all the sprites’s scripts.
This block enables setting the instrument for the upcoming musical note.
This clears all the input from stage such as pen and stamp.
After connection is established, rotates the quarky a specified number of step to the right .
Shows a specified static emotion on the quarky LED display.
Detects and identifies the facial expression within a view captured by camera
Detects and identifies signs made by hand within a view captured by camera.
After connection is established, moves the wizbot a specified number of step Back.
After connection is established, rotates the wizbot a specified degree of angle to the left.
This block is used to write text on evive’s TFT display.
evive has two potentiometers whose analog outputs can be varied by turning the knob clockwise or anti-clockwise. This block returns the analog output of either of the potentiometer (from 0-1023).
There are 10 digital buttons in the gamepad module, whose data is sent to the device when they are pressed or released. The block reports whether the button is currently pressed on the gamepad or not. If the chosen button is pressed, then it returns true, else it returns false. 
The block set the relay connected to the specified digital pin to ON or OFF.
This block is used to set the angles at which the gripper of the robotic arm opens and closes. You need to use this block every time, you open or close the gripper as this block defines at which angles the gripper claw is opened and at which it is closed.
This block should be included every time you work with the humanoid robot for the first time as it calibrates the angles of all the four servo motors of the arm(2 servos of shoulder + 2 servos of hands) and saves it in the memory of evive.
The block points its sprite towards the mouse-pointer or another sprite depending on its costume center; this changes the sprite’s direction and rotates the sprite.
The block changes its sprite’s costume to a specified one.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load
Table of Contents