# Changes

,  22:28, 2 March 2020
Line 22: Line 22:
|valign="top"|[[Image:physics_transverse_waves.png|thumb|none|280px|Example illustrating transverse wave propagation.]]

|valign="top"|[[Image:physics_transverse_waves.png|thumb|none|280px|Example illustrating transverse wave propagation.]]

|valign="top"|[[Image:physics_longitudinal_waves.png|thumb|none|280px|Example illustrating longitudinal wave propagation.]]

|valign="top"|[[Image:physics_longitudinal_waves.png|thumb|none|280px|Example illustrating longitudinal wave propagation.]]
+
|+
+
|valign="top"|[[Image:physics_pen.png|thumb|none|280px|Example illustrating the pen tool attached to the end of a pendulum.]]
+
|valign="top"|[[Image:physics-tracing.png|thumb|none|280px|Tracing multiple objects]]
+
|+
+
|valign="top"|[[File:TAGearTA.png|thumb|none|280px|A simple gear and motor generated in Turtle Art]]
+
|valign="top"|[[File:TAGear.png|thumb|none|280px|rendered in Physics]]
+
|+
+
|valign="top"|[[File:Chain.png|thumb|none|280px|a chain generated in Turtle Art]]

|}

|}

== Ideas to try ==

== Ideas to try ==
+
*Build a catapult to simulate Angry Birds

*Build a machine that sorts different sized balls in to two buckets, large and small, with no ball jams.

*Build a machine that sorts different sized balls in to two buckets, large and small, with no ball jams.

*A cyclic mechanism for lifting balls from the bottom of the screen to the top, again and again.

*A cyclic mechanism for lifting balls from the bottom of the screen to the top, again and again.
Line 38: Line 47:
*Try building a ratchet mechanism.

*Try building a ratchet mechanism.

*Try building an analogue clock face where the min hand goes around 60 times for each hour.

*Try building an analogue clock face where the min hand goes around 60 times for each hour.
*Modify the program itself: [http://wiki.sugarlabs.org/go/Modifying_Activities#Modifying_Physics Modifying_Physics]
+
*Modify the program itself: [[Activity_Team/Modifing_an_Activity#Modifying_Physics|Modifying Physics]]

== Tools ==

== Tools ==
[[Image:physics-toolbar.png|800px]]
+
[[Image:Physics-main-toolbar.png|800px]]
−
'''Stop/Start:''' allows you to stop time and start it again, allowing you to build constructions without them collapsing while you work. ''<Ctrl>+space''
+
;Activity Toolbar Button: Opens the activity toolbar (See Below)
+
;Tools Toolbar Button: Opens the tools toolbar (See below)
+
;Play/Pause Button: allows you to stop time and start it again, allowing you to build constructions without them falling to the ground while you work. You can now use the Grab tool while time is stopped to easily re-arrange the position of objects. ''<Ctrl+space>''
+
;Erase Pen Button: Erase all the points drawn by the pen tool
+
;Erase-all Button: Erase all objects in current simulation
−
'''Draw:''' click and hold to draw any shape you'd like! ''<Ctrl+D>''
+
[[Image:Physics-activity-toolbar.png|800px]]
−
'''Circle:''' circles of any radius. Click (center) drag and release (outer edge). ''<Ctrl+C>''
+
;Activity Title: Change the name of your project here
+
+
;Collaboration: Open the collaboration palette to share your project
+
;Save pen data: Save pen data to the Journal as a JSON-encoded stream
+
;Save pen data (CSV): Save pen data to the Journal as a comma-separated values database
−
'''Triangle:''' triangles (equilateral) of any size and initial rotation. Click (center of base) drag and release. ''<Ctrl+T>''
+
[[Image:physics-toolbar.png|800px]]
−
'''Box:''' rectangles of any dimension. Click (corner) drag + release (opposite corner). ''<Ctrl+B>''
+
;Draw Tool Button: click and hold to draw any shape you'd like! ''<Ctrl+D>''
+
;Circle Tool Button: circles of any radius. Click (center) drag and release (outer edge). ''<Ctrl+C>''
+
;Triangle Tool Button: triangles (equilateral) of any size and initial rotation. Click (center of base) drag and release. ''<Ctrl+T>''
+
;Box Tool Button: rectangles of any dimension. Click (corner) drag + release (opposite corner). ''<Ctrl+B>''
+
;Polygon Tool Button: as many sides as you would like. Draw your own N-gon. Click, drag and release for each point, to end return to the start point. ''<Ctrl+P>''
+
;Grab Tool Button: drag existing objects around with the mouse. ''<Ctrl+G>''
+
;Motor Tool Button: click an object to pin and drive it with clockwise rotation. It is easiest to stop the simulation, place your object, add its motor, and resume the simulation again. ''<Ctrl+M>''
+
;Pin Tool Button: pin a shape to the screen, it can rotate about the pin. If you want to lock a shape in place, use two or more pins to stop it rotating. ''<Ctrl+O>''
+
;Joint Tool Button: connect two objects together with a rod. Click on any object, drag to another object and release to create the joint (each end of joint allows rotation). ''<Ctrl+J>''
+
;Chain Tool Button: add a flexible chain to connect two objects together. Click and hold to draw any shape. If you start or stop on an object, it becomes connected to the end of the chain (like the joint tool)
+
;Pen Tool Button: add a pen to any object to trace the motion of that object
+
;Erase Tool Button: click on an object to erase it, or click and hold to draw a line of destruction--erasing everything in its path! ''<Ctrl+E>''
−
'''Polygon:''' as many sides as you would like. Draw your own N-gon. Click, drag and release for each point, to end return to the start point. ''<Ctrl+P>''
+
[[Image:Physics-object-properties.png]]
−
'''Grab:''' drag existing objects around with the mouse. ''<Ctrl+G>''
+
+
;Mass: feather, wood, and anvil represent light to dense
+
;Bounciness: basketball, baseball, and bowling ball represent very bouncy to inelastic
+
;Friction: ice skate, shoe, and sneaker represent low to high coefficient of friction
−
'''Motor:''' click an object to pin and drive it with clockwise rotation. It is easiest to stop the simulation, place your object, add its motor, and resume the simulation again. ''<Ctrl+M>''
+
[[Image:Physics-motor-properties.png]]
−
'''Pin:''' pin a shape to the screen, it can rotate about the pin. If you want to lock a shape in place, use two or more pins to stop it rotating. ''<Ctrl+O>''
+
The motor has a palette to set speed (fast and slow) and direction (counter-clockwise and clockwise)
−
'''Joint:''' connect two objects together with a rod. Click on any object, drag to another object and release to create the joint (each end of joint allows rotation). ''<Ctrl+J>''
+
[[Image:Physics-chain-properties.png]]
−
'''Erase:''' click on an object to erase it, or click and hold to draw a line of destruction--erasing everything in its path! ''<Ctrl+E>''
+
The chain has a palette to set the coarseness and weight of the chain elements

|'''Hints and tips''': Single clicking (no drag) with the circle, triangle or box tool, will add a default sized shape. Once you have used a shape tool, it remembers the last shape you made with it, a single click will add a clone of that last shape.

|'''Hints and tips''': Single clicking (no drag) with the circle, triangle or box tool, will add a default sized shape. Once you have used a shape tool, it remembers the last shape you made with it, a single click will add a clone of that last shape.

|}

|}
+
+
== Did you know? ==
+
+
There is a Plugin for [[Activities/TurtleArt|Turtle Blocks]] that lets you create projects for the Physics Activity:
+
+
[[File:Physics pallette.jpg]]
+
+
Use these blocks to create objects that are added to the bodylist and jointlist of a Box2d database used by the Physics Activity. Objects are positioned by the turtle x,y and colored based on the current pen attributes. From left to right:
+
* density: set the object density (0 is light; 1 is heavy)
+
* friction: set the object friction (0 is slippery; 1 is sticky)
+
* bounciness: set the object restitution (0 is rigid; 1 is bouncy)
+
* start polygon: use the current turtle x,y position to specify the first vertex of a polygon
+
* add point: use the current turtle x,y position to add a vertex to a polygon
+
* end polygon: use the current turtle x,y position to specify the last vertex of a polygon
+
* end filled polygon: use the current turtle x,y position to specify the last vertex of a ''filled'' polygon
+
: '''Note:''' The polygon must be 'normal', e.g., no crossed lines; no holes. Since Box2d does not support concave polygons, all polygons are converted to triangles (triangulation). (In Turtle Blocks, these triangles are shown by slight variations in color.)
+
* triangle: add a triangle object at the current turtle x,y position
+
* circle: add a circle object at the current turtle x,y position
+
* rectangle: add a rectangle object at the current turtle x,y position
+
* gear: add a gear object at the current turtle x,y position with the number of teeth as the argument
+
* gear radius: returns the radius of a gear with the number of teeth as the argument (useful for positioning gears)
+
* motor: add a motor at the current turtle x,y position (attached to the object at this position)
+
* pin: add a pin at the current turtle x,y position (attached to the object at this position) to prevent movement
+
* pen: add a pen at the current turtle x,y position (attached to the object at this position) to trace motion
+
* joint: add a joint between the object at the current turtle x,y position and the object at x, y
+
* save as Physics project: save the current bodylist and jointlist as a Physics project in the Journal
+
'''Note:''' The current model is cleared whenever the Erase button is pressed or a Clean block is run.
+
+
===== Examples =====
+
'''For Turtle Blocks versions 107 - 183'''
+
[[File:TAgear.ta]] [[File:Gear.physics]]
+
+
'''For Turtle Blocks verisons 184 - '''
+
[http://people.sugarlabs.org/walter/physics-plugin.tar.gz]
+
+
'''Chain'''
+
Turtle Blocks project file: [http://people.sugarlabs.org/walter/chain.tb]
+
+
+
+
[[File:Physics-plugin.tar.gz]] Physics plugin
+
+
[http://github.com/walterbender/physics-plugin git repository]

= Development =

= Development =

[[Image:PhysicsElements.png|160px|right]]

[[Image:PhysicsElements.png|160px|right]]
There are quite a few code layers to contend with. A regular Python Activity acts as a Sugar wrapper to Physics which is written using OLPCGames which itself wraps Pygame, Physics then uses Elements as a wrapper for Box2D.
+
There are quite a few code layers to contend with. A regular Python Activity acts as a Sugar wrapper to Physics which is written using SugarGames which itself wraps Pygame, Physics then uses Elements as a wrapper for Box2D.

==Video==

==Video==
Line 82: Line 156:
== Release Notes ==

== Release Notes ==
+
+
=== 17 ===
+
+
ENHANCEMENT:
+
* Chain tool behaves like magic pen: you can make loops and closed paths
+
+
=== 16 ===
+
+
ENHANCEMENT:
+
* Add sharing to magic pen and polygon
+
* Clean up of some internals
+
+
=== 15 ===
+
+
ENHANCEMENT:
+
+
+
BUG FIX:
+
* Fix problem with pause/play button
+
+
=== 14 ===
+
+
ENHANCEMENTS:
+
* New translations
+
* GTK3 conversion by Ignacio Rodriguez
+
+
=== 13 ===
+
+
ENHANCEMENTS:
+
* Added palettes to set density, bouciness, and friction (w/Sai Vineet)
+
* Added palette to set motor speed, rotation (w/Sai Vineet)
+
* Added chain tool (w/Sai Vineet)
+
+
BUG FIX:
+
* Updated Box2d version to eliminate some memory leaks (Sai Vineet)
+
+
=== 12 ===
+
+
ENHANCEMENTS:
+
* Added option to joints to set collideConnected = False
+
+
+
+
* Added erase traces (Sai Vineet)
+
* Added save/restore of pens and traces (Sai Vineet)
+
+
BUG FIXES:
+
* Removed cjson dependency for elements
+
* pep8 cleanup (Sai Vineet)
+
+
=== 11.9 ===
+
+
* Removed cjson dependency for elements
+
* Added option to joints to set collideConnected = False
+
+
+
+
+
=== v5 ===
+
+
* Added support for new toolbar design for Sugar 0.86 (old toolbars still work for Sugar 0.84 and back)
+
* Objects can now be moved with the Grab tool while the simulation is paused!
+
* Tool code cleanup and refactoring
+
* Includes latest translations
+
* Many thanks go to Peter Froehlich, Akash Gangil, Craig Macomber, and the translation team.
+
+
=== v4 ===
+
+
* Include latest translations
+

=== v3 ===

=== v3 ===
Line 120: Line 264:

* [http://git.sugarlabs.org/projects/physics GIT repository]
+
* [https://github.com/sugarlabs/physics/ GIT repository]