-
Notifications
You must be signed in to change notification settings - Fork 6
PhysicsMaterial Extension
Physics properties (only game physics properties are supported) are exported to something like this in ogex:
Extension (applic = "Blender", type = "PhysicsMaterial")
{
Extension (applic = "Blender", type = "PM/type")
{
string {"STATIC"}
}
Extension (applic = "Blender", type = "PM/mass")
{
float {0.1}
}
Extension (applic = "Blender", type = "PM/collision_group")
{
unsigned_int16 {65535}
}
Extension (applic = "Blender", type = "PM/collision_mask")
{
unsigned_int16 {65535}
}
Extension (applic = "Blender", type = "PM/shape")
{
Extension (applic = "Blender", type = "TriangleMeshShape")
{
ref {$geometry1}
Extension (applic = "Blender", type = "PM/margin")
{
float {0.04}
}
}
}
}
This extension contains all attributes of a physics object. Only objects will contain this extension structure.
PM is short for physics material. type
here means the "physics type" and only contains a string which can be one of: (from the Blender Python API documentation)
-
NO_COLLISION
No Collision, Disable collision for this object. -
STATIC
Static, Stationary object. -
DYNAMIC
Dynamic, Linear physics. -
RIGID_BODY
Rigid Body, Linear and angular physics. -
SOFT_BODY
Soft Body, Soft body. -
OCCLUDER
Occluder, Occluder for optimizing scene rendering. -
SENSOR
Sensor, Collision Sensor, detects static and dynamic objects but not the other collision sensor objects. -
NAVMESH
Navigation Mesh, Navigation mesh. -
CHARACTER
Character, Simple kinematic physics appropriate for game characters.
Substructures: 1 float
primitive.
Default: 1.0
Mass of the physics object.
Substructures: 1 unsigned_int16
primitive.
Default: 0x01
Collision group of the physics object found in the Blender Game physics properties panel.
Substructures: 1 unsigned_int16
primitive.
Default: 0xFF
Collision mask of the physics object found in the Blender Game physics properties panel.
Collision shape of this physics object. Will only exist if the type is neither OCCLUDER
or NAVMESH
. Contains one extension substructure of the following:
-
BoxShape
specified by a float array of size 3 for the half extents. -
SphereShape
specified by a float array of size 3 for the half extents. -
CylinderShape
specified by a float array of size 3 for the half extents. -
ConeShape
specified by a float array of size 3 for the half extents. -
ConvexHullShape
specified by aref
to the objects geometry. -
TriangleMeshShape
specified by aref
to the objects geometry. -
CapsuleShape
specified by a float array of size 3 for the half extents. -
CompoundShape
see below.
In addition to the above, the individual specific shape will also contain a PM/margin
extension structure containing exactly one shape primitive which represents the collision margin for the shape.
Compound shapes are specified similar to:
Extension (applic = "Blender", type = "CompoundShape")
{
Extension (applic = "Blender", type = "CompoundChild")
{
Extension (applic = "Blender", type = "BoxShape")
{
float[3] {{1.0, 1.0, 1.0}}
Extension (applic = "Blender", type = "PM/margin")
{
float {0.0}
}
}
}
Extension (applic = "Blender", type = "CompoundChild")
{
float[16]
{
{1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 1.0, 1.0}
}
Extension (applic = "Blender", type = "SphereShape")
{
float {1.0}
Extension (applic = "Blender", type = "PM/margin")
{
float {0.0}
}
}
}
}
They consist of a set of "CompoundChild"
, which have a float[16]
for their relative compound child offset (may be omitted if it is an identity transformation) and a collision shape, see PM/shape.