tPhysics

tPhysics is a 2D Physics sandbox writtin in Python.  You can create bodies, join them with joints, then throw them at stuff.

Download:

tPhysics Source Code

How To Use:

This program is not 100% finger friendly, so at times you will need to use the keyboard and mouse.  This is mostly when you create a new body or joint.

You can spawn new objects as follows:

  1. Tap on the “Shape” button on the right side of the screen
  2. Select the type of shape you want
  3. Enter then attributes of the shape.  Angular and Linear damping are not required.  It you set density to 0 and friction to 1, you can make a static shape.  This is useful for stuff like ground, or any obstacles you do not want to move(you can’t move it once you place it either).  Any other combination of values will make a Dynamic shape, which can and will move and interact with other shapes
  4. Tap Create
  5. A.  If you did not select Arbitrary Polygon, then tap where you want the shape to go and it will be created
  6. If you did select Arbitrary Polygon, then a Shape Graph will pop up.  This will allow you to move the verticies and create your shape.  It must be convex, and no lines can cross

Joints allow you to connect two or more bodies.  Using joints you can create complex structures not possible with primitive shapes.  Here are the types of joints supported by tPhysics:

Distance:

A distance joint allows you to constrain two bodies to a certain distance(implied by how far apart they are when you join them).  Each of the joint anchors(where the joint connects with the shape) can pivot freely.  You can specify a damping ratio, if you would like friction to be simulated at each anchor.  To make this joint:

  1. Tap the “Joint” button
  2. Select the Distance Joint from the drop down menu
  3. Enter the desired attributes
  4. Tap “Create”
  5. Tap on the first anchor point, this must be a Dynamic Body
  6. Tap on the second anchor point, this must also be a Dynamic Body

Revolute:

A revolute joint forces the two bodies to share a common pivot point.  In this case, the anchor points can not rotate, and the only part that can is this common pivot point.  You can specify damping, limits, motor properties, and whether you want to two linked objects to be able to collide with each other.  To create this joint:

  1. Tap the “Joint” button
  2. Select the Revolute Joint from the drop down menu
  3. Enter the desired attributes
  4. Tap “Create”
  5. Tap on the first anchor point, this is the pivoting joint.  It must be a Dynamic Body
  6. Tap on the second anchor point, this must also be a Dynamic Body

Prismatic:

A prismatic joint allows the distance between the two objects to change, but not the relative angle.  The two anchor points are frozen and can not rotate.  You can specify damping, limits, motor properties, and whether you want the two linked objects to be able to collide with one and other.  To create this joint:

  1. Tap the “Joint” button
  2. Select the Prismatic Joint from the drop down menu
  3. Enter the desired attributes
  4. Tap “Create”
  5. Tap on the first anchor point, it must be a Dynamic Body
  6. Tap on the second anchor point, this must also be a Dynamic Body

Pulley:

The pully joint has 4 anchors, two shape anchors and two ground anchors.  It acts like a real world pulley, as one shape goes up the other goes down.  You can specify a ratio, so the distance constant can be represented as:

length1 + ratio * length2 == constant

For example, if the ratio is 2, then length1 will vary at twice the

rate of length2.  Also the force in the rope attached to body1 will have

half the constraint force as the rope attached to body2.  To create this joint:

  1. Tap the “Joint” button
  2. Select the Pulley Joint from the drop down menu
  3. Enter the desired attributes.  The ratio can not be zero, and it is recommended that you set limits.
  4. Tap “Create”
  5. Tap on the first ground anchor point
  6. Tap on the second ground anchor point
  7. Tap on the first body anchor point, this must be a Dynamic Body
  8. Tap on the second body anchor point, this must also be a Dynamic Body

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: