.Phn files are the files used by Phun to save scenes and phunlets. Since Beta 4, they work with raw thyme code, making it possible to copy&paste scenes into phun.
The scenes are plain text, and thus can be edited with a text editor. Everything is case sensitive, so be careful with editing.
example
A simple phun file might look like this:
FileInfo.title = "file title"; //this is the title of the file
FileInfo.author = "author"; //and here you can see who's the author
FileInfo.description = "short description"; //this is a short description of the file
FileInfo.version = 2; //this is the file version. Version 1 was used until beta 4
Sim.gravity = [0.0, -9.800000190734863]; //this is an example of a cvar in a phn file.
//Any console command can be added
Scene.addCircle { // this command adds a circle with the variables set below
geomID = 2; //the unique geometry id is used for fixates, pens and hinges to remember their parent
density = 5.248076438903809; //the mass of the object
entityID = 0; // objects with the same entityID are fixated together.
color = [0.0, 0.0, 0.0, 1.0]; //the color
pos = [-7.451908588409424, 23.29408836364746]; //the position of the object's centre of gravity
zDepth = 1.0; //the order of the object. Controls if it is above or below other objects.
radius = 0.598817765712738; //the radius of the circle
angle = -1.612239003181458 //the angle in which the object is rotated
};
Scene.addPlane {
entityID = 555;
color = [0.5377467274665833, 0.7011092305183411, 0.5186272263526917, 1.0];
pos = [0.0, -41.41909027099609];
angle = 1.570796370506287;
geomID = 12718670;
zDepth = 41.0
};
Scene.addGroup { //objects can be grouped for easy selecting. This part adds a new group of objects
name = "selected"; //the name of the group
entityIDs = [767] //an array of entities that are in the group
};
Scene.addGroup {
name = "tracked"; //this is a special group saying that object 358 is tracked by the camera
entityIDs = [358]
}
The file accepts default thyme c-vars, which are usually written at the top of the file.
possible properties for types of objects
circles
| Property name
| Property type
| Description
|
| thyme command | Scene.addCircle{} | the command used to add a new Circle. properties go between the brackets
|
| GeomID | Positive integer | Geometry ID, must be unique. Used to attach springs and hinges
|
| entityID | Positive integer | entity ID, if left out, will default to the Geometry ID
|
| color | Four decimal positive values | RGBA values [Red, Green, Blue, Alpha]
|
| collideWater | true or false | determines if it collides with water
|
| collideSet | signed integer | Collision groups. This is an integer representation of a binary number (see below)
|
| density | Decimal positive value | mass of the object
|
| friction | Decimal positive value | Coefficient of friction
|
| restitution | Decimal positive value | Bounciness
|
| airFrictionMult | Decimal positive value | multiplier of air friction. Determines the amount of air friction an object has
|
| radius | Decimal positive value | Radius of the circle
|
| pos | Array of 2 decimal values | Object’s origin coordinates
|
| zDepth | Decimal positive value | The Z-order of an object
|
| angle | decimal value | Angle of object
|
Box
| Property name
| Property type
| Description
|
| thyme command | Scene.addBox{} | the command used to add a new Box. properties go between the brackets
|
| GeomID | Positive integer | Geometry ID, must be unique. Used to attach springs and hinges
|
| entityID | Positive integer | entity ID, if left out, will default to the Geometry ID
|
| color | Four decimal positive values | RGBA values [Red, Green, Blue, Alpha]
|
| collideWater | true or false | determines if it collides with water
|
| collideSet | signed integer | Collision groups. This is an integer representation of a binary number (see below)
|
| density | Decimal positive value | mass of the object
|
| friction | Decimal positive value | Coefficient of friction
|
| restitution | Decimal positive value | Bounciness
|
| airFrictionMult | Decimal positive value | multiplier of air friction. Determines the amount of air friction an object has
|
| size | Array of 2 decimal positive values | Size of the box in X and Y direction
|
| pos | Array of 2 decimal values | Object’s origin coordinates
|
| zDepth | Decimal positive value | The Z-order of an object
|
| angle | decimal value | Angle of object
|
Polygon
| Property name
| Property type
| Description
|
| thyme command | Scene.addPolygon{} | the command used to add a new Polygon. properties go between the brackets
|
| GeomID | Positive integer | Geometry ID, must be unique. Used to attach springs and hinges
|
| entityID | Positive integer | entity ID, if left out, will default to the Geometry ID
|
| color | Four decimal positive values | RGBA values [Red, Green, Blue, Alpha]
|
| collideWater | true or false | determines if it collides with water
|
| collideSet | signed integer | Collision groups. This is an integer representation of a binary number (see below)
|
| density | Decimal positive value | mass of the object
|
| friction | Decimal positive value | Coefficient of friction
|
| restitution | Decimal positive value | Bounciness
|
| airFrictionMult | Decimal positive value | multiplier of air friction. Determines the amount of air friction an object has
|
| pos | Array of 2 decimal values | Object’s origin coordinates
|
| zDepth | Decimal positive value | The Z-order of an object
|
| angle | decimal value | Angle of object
|
| vecs | 2D Array of decimal values | vertex coordinates for all points (x,y)
|
Plane
| Property name
| Property type
| Description
|
| thyme command | Scene.addPlane{} | the command used to add a new Plane. properties go between the brackets
|
| GeomID | Positive integer | Geometry ID, must be unique. Used to attach springs and hinges
|
| entityID | Positive integer | entity ID, if left out, will default to the Geometry ID
|
| color | Four decimal positive values | RGBA values [Red, Green, Blue, Alpha]
|
| collideWater | true or false | determines if it collides with water
|
| collideSet | signed integer | Collision groups. This is an integer representation of a binary number (see below)
|
| friction | Decimal positive value | Coefficient of friction
|
| restitution | Decimal positive value | Bounciness
|
| pos | Array of 2 decimal values | Object’s origin coordinates
|
| zDepth | Decimal positive value | The Z-order of an object
|
| angle | decimal value | Angle of object
|
Spring
| Property name
| Property type
| Description
|
| thyme command | Scene.addSpring{} | the command used to add a new spring. properties go between the brackets
|
| entityID | Positive integer | entity ID
|
| length | Decimal positive value | the length of the spring
|
| geom0pos | Array of 2 decimal values | position of spring on the first geometry
|
| geom1pos | Array of 2 decimal values | position of spring on the second geometry
|
| color | Four decimal positive values | RGBA values [Red, Green, Blue, Alpha]
|
| size | Decimal positive valye | Size of the spring
|
| zDepth | Decimal positive value | The Z-order of an object
|
| geom0 | Positive integer | The geometry ID of the first object it's hinged too
|
| geom1 | Positive integer | The geometry ID of the second object it's hinged too
|
Fixates
| Property name
| Property type
| Description
|
| thyme command | Scene.addFixjoint{} | the command used to add a new fixate. properties go between the brackets
|
| entityID | Positive integer | entity ID
|
| geom0pos | Array of 2 decimal values | position of fixate on the first geometry
|
| geom1pos | Array of 2 decimal values | position of fixate on the second geometry
|
| color | Four decimal positive values | RGBA values [Red, Green, Blue, Alpha]
|
| size | Decimal positive valye | Size of the fixate
|
| zDepth | Decimal positive value | The Z-order of an object
|
| geom0 | Positive integer | The geometry ID of the first object it's connected to
|
| geom1 | Positive integer | The geometry ID of the second object it's connected to
|
Hinges
| Property name
| Property type
| Description
|
| thyme command | Scene.addHinge{} | the command used to add a new hinge. properties go between the brackets
|
| entityID | Positive integer | entity ID
|
| geom0pos | Array of 2 decimal values | position of hinge on the first geometry
|
| geom1pos | Array of 2 decimal values | position of hinge on the second geometry
|
| color | Four decimal positive values | RGBA values [Red, Green, Blue, Alpha]
|
| size | Decimal positive valye | Size of the hinge
|
| zDepth | Decimal positive value | The Z-order of an object
|
| geom0 | Positive integer | The geometry ID of the first object it's connected to
|
| geom1 | Positive integer | The geometry ID of the second object it's connected to
|
Pens
| Property name
| Property type
| Description
|
| thyme command | Scene.addPen{} | the command used to add a new pen. properties go between the brackets
|
| entityID | Positive integer | entity ID
|
| geom | Positive integer | The geometry ID of the object it's connected to
|
| relPoint | Array of 2 decimal values | position of pen on the parent geometry
|
| color | Four decimal positive values | RGBA values [Red, Green, Blue, Alpha]
|
| size | Decimal positive valye | Size of the pen
|
| zDepth | Decimal positive value | The Z-order of an object
|
group
| Property name
| Property type
| Description
|
| thyme command | Scene.addGroup{} | the command used to add a new group. properties go between the brackets
|
| name | String | Name of the group. Use "selected" for the selected objects, and "tracked" for the objects that should be followed by the camera. The name should always be inside quotation marks
|
| entityIDs | array of positive integers | All the entities that should be selected
|
property explanation
collideSet
The collideSet property determines on which layers the object is active. The value can be determined with this method:
For every collision group, you search its value. When you have all the values, you add them to get your number:
layer A = 1
layer B = 2
layer C = 4
layer D = 8
layer E = 16
So if you have an object that collides on layer A, C and E, this is what you get:
A = 1, C = 4, E = 16. 1+4+16 = 21
So the collideSet value is 21.
Color
Colors are stored as an array of 4 values: Red, Green, Blue, transparency (also called alpha)
The values range from 0.0 to 1.0 (decimal numbers).
So for example the color red will be [1,0,0,1], and the color green [0,1,0,1]. The invisible pink unicorn has a value of [0.95314, 0.59553, 1.0, 0.0]
Parameter list
| parameter
| Polygon
| Circle
| Box
| Plane
| Hinge
| Fixate
| Spring
| Pen
|
| buttonDestroy | o | o | o | o | o | o | o | o
|
| buttonMirror | o | o | o | o | o | o | o | o
|
| color | o | o | o | o | o | o | o | o
|
| entityID | o | o | o | o | o | o | o | o
|
| zDepth | o | o | o | o | o | o | o | o
|
| angle | o | o | o | o | . | . | . | .
|
| collideSet | o | o | o | o | . | . | . | .
|
| collideWater | o | o | o | o | . | . | . | .
|
| friction | o | o | o | o | . | . | . | .
|
| geomID | o | o | o | o | . | . | . | .
|
| heteroCollide | o | o | o | o | . | . | . | .
|
| pos | o | o | o | o | . | . | . | .
|
| restitution | o | o | o | o | . | . | . | .
|
| airFrictionMult | o | o | o | . | . | . | . | .
|
| controllerAcc | o | o | o | . | . | . | . | .
|
| controllerAcc | o | o | o | . | . | . | . | .
|
| controllerInvertX | o | o | o | . | . | . | . | .
|
| controllerInvertY | o | o | o | . | . | . | . | .
|
| controllerReverseXY | o | o | o | . | . | . | . | .
|
| density | o | o | o | . | . | . | . | .
|
| forceController | o | o | o | . | . | . | . | .
|
| vecs | o | . | . | . | . | . | . | .
|
| radius | . | o | . | . | . | . | . | .
|
| size | . | . | o | . | o | o | o | o
|
| geom0 | . | . | . | . | o | o | o | .
|
| geom0pos | . | . | . | . | o | o | o | .
|
| geom1 | . | . | . | . | o | o | o | .
|
| geom1pos | . | . | . | . | o | o | o | .
|
| autoBrake | . | . | . | . | o | . | . | .
|
| buttonBack | . | . | . | . | o | . | . | .
|
| buttonBrake | . | . | . | . | o | . | . | .
|
| buttonForward | . | . | . | . | o | . | . | .
|
| ccw | . | . | . | . | o | . | . | .
|
| distanceLimit | . | . | . | . | o | . | . | .
|
| impulseLimit | . | . | . | . | o | . | . | .
|
| motor | . | . | . | . | o | . | . | .
|
| motorSpeed | . | . | . | . | o | . | . | .
|
| motorTorque | . | . | . | . | o | . | . | .
|
| dampingFactor | . | . | . | . | . | . | o | .
|
| length | . | . | . | . | . | . | o | .
|
| strengthFactor | . | . | . | . | . | . | o | .
|
| geom | . | . | . | . | . | . | . | o
|
| fadeTime | . | . | . | . | . | . | . | o
|
| relPoint | . | . | . | . | . | . | . | o
|
Last modified February 14, 2009 6:23 am