name is the name of the object which can be used to identify the object.
transform is the initial transformation that should be applied to the object. Alternatively, you can specify the individual components pos, rot and scale.
pivot is the pivot point of the object. This is the 4th column of the offset transformation. You can also specify the entire offset transformation using the offsetTransform argument.
parent is the parent world object and determines at which position in the scene graph the new object is added. If parent is None the object will become a child of the world root. The parent argument is only used if auto_insert is True.
mass is the mass of this object (this does not include the children objects).
material describes the appearance of the object. It can be either a single Material object or a sequence of Material objects.
visible is a flag that determines whether the object is visible or not. This only affects the geometry of this WorldObject, it is not inherited by children objects.
The object will be inserted into the scene automatically if auto_insert is set to True.
A WorldObject always has the following slots:
|cog_slot||vec3||r||Center of gravity|
|mass_slot||float||rw||Mass of the local geometry|
|totalmass_slot||float||r||Total mass (including the children)|
This attribute holds the visible geometry which must be derived from GeomObject. The value can also be None if there is no visible geometry. Geometry objects can be shared between different world objects. This value can be read and written.
This attribute contains the parent world object or None. You can only read this attribute.
This is the value of the mat4 slot transform_slot which contains the object transformation T. You can read and write this attribute.
This is the value of the mat4 slot worldtransform_slot which contains the world transformation (which is a concatenation of all local transformations L). You can only read this attribute.
Note that in contrast to the transform slot, the worldtransform is not influenced by the offset transformation.
This is the value of the vec3 slot pos_slot which contains the position of the object. You can read and write this attribute.
This is the value of the mat3 slot rot_slot which contains the orientation of the object. You can read and write this attribute.
This is the value of the vec3 slot scale_slot which contains the scaling of the object. You can read and write this attribute.
This is the pivot point (vec3) of the object. You can read and write this attribute. Reading or writing this attribute is equivalent to calling getOffsetTransform() or setOffsetTransform() with a matrix that only modifies the 4th column.
This is the value of the vec3 slot cog_slot which contains the physical center of gravity. This value is derived from the center of gravity provided by the geometry object and the cogs and masses of the children objects. This means it represents the center of gravity of the entire hierarchy. The value is given with respect to the pivot coordinate system P. You can only read this value.
This is the value of the mat3 slot inertiatensor_slot which contains the inertia tensor of the entire hierarchy (just like cog). You can only read this value.
This is the value of the double slot mass_slot which contains the local mass of this object (not including the children). Or in other words, this is the mass of the geometry directly set in this object. You can read and write this value.
This is the value of the double slot totalmass_slot which contains the total mass of this object and its children. You can only read this value.
This is the value of the vec3 slot angular_slot which contains the angular velocity of the object. The value is not computed but has to be set by anyone who knows the angular velocity (such as a dynamics component). You can read and write this attribute.
This is the value of the vec3 slot linearvel_slot which contains the linear velocity of the object. The value is not computed but has to be set by anyone who knows the linear velocity (such as a dynamics component). You can read and write this attribute.
Return the local axis aligned bounding box. The bounding box is given with respect to the local transformation L (which is not what you get from the transform slot of the world object).
Returns the local transformation that has to be used for rendering. The returned transformation L is calculated as follows: , where T is the current transform (taken from the transform slot) and P is the offset transform.
Return the current offset transformation as a mat4. This transformation is given relative to the local object transformation.
Set the offset transformation. The transformation has to be given relative to the local object transformation. After setting the offset transformation, the transform slot will be updated so that localTransform() returns the same matrix as before, i.e. the world position/orientation of the object does not change.
Return the current size of the material array.
Set a new size for the material array.
Get a stored material. The method returns None if the given index is out of range or there is no material stored at that position.
Set a new material. An IndexError exception is thrown if the index is out of range.
Return the number of children objects.
Return an iterator that iterates over all children objects.
Check if a children with a particular name does exist.
Return the children with a particluar name. A KeyError exception is thrown if there is no children with the specified name.
Add a new children world object to this object. A ValueError exception is thrown if child was already added to another object. In this case you have to remove the object from its previous parent yourself. You also have to make sure that the name of child is unique among the children of this object, otherwise a KeyError exception is thrown.
Remove a children world object from this object. child can either be the name of the children or the object itself. A KeyError exception is thrown if child is not a children of this object.
Modify name so that it is unique among the children names. If name is already the name of a children object, then it is modified by adding/increasing a trailing number, otherwise it is returned unchanged.