A shape is a component of a rigid body. It attaches a collision geometry to the parent rigid body with some physical properties such as coefficients of friction and restitution. The collision geometry can locally be transformed relative to the parent rigid body's center of gravity.

Constructor

new(config:ShapeConfig)

Creates a new shape by configuration config.

Variables

userData:Any

Extra field that users can use for their own purposes.

Methods

inlinegetAabb():Aabb

Returns the AABB of the shape. The AABB may be incorrect if the shape doesn't have a parent rigid body.

inlinegetAabbTo(aabb:Aabb):Void

Sets aabb to the AABB of the shape. The AABB may be incorrect if the shape doesn't have a parent rigid body.

This does not create a new instance of AABB.

inlinegetCollisionGroup():Int

Returns the collision group bits the shape belongs to.

inlinegetCollisionMask():Int

Returns the collision mask bits of the shape.

inlinegetContactCallback():ContactCallback

Returns the contact callback of the shape.

inlinegetDensity():Float

Returns the density of the shape.

inlinegetFriction():Float

Returns the coefficient of friction.

inlinegetGeometry():Geometry

Returns the colision geometry of the shape.

inlinegetLocalTransform():Transform

Returns the transform of the shape relative to the parent rigid body's transform.

inlinegetLocalTransformTo(transform:Transform):Void

Sets transform to the transform of the shape relative to the parent rigid body's transform.

This does not create a new instance of Transform.

inlinegetNext():Shape

Returns the next shape in the rigid body.

If the next one does not exist, null will be returned.

inlinegetPrev():Shape

Returns the previous shape in the rigid body.

If the previous one does not exist, null will be returned.

inlinegetRestitution():Float

Returns the coefficient of restitution.

inlinegetRigidBody():RigidBody

Returns the parent rigid body. This returns null if the shape doesn't have a parent rigid body.

inlinegetTransform():Transform

Returns the world transform of the shape.

inlinegetTransformTo(transform:Transform):Void

Sets transform to the world transform of the shape.

This does not create a new instance of Transform.

inlinesetCollisionGroup(collisionGroup:Int):Void

Sets the shape's collision group bits to collisionGroup.

inlinesetCollisionMask(collisionMask:Int):Void

Sets the shape's collision mask bits to collisionMask.

inlinesetContactCallback(callback:ContactCallback):Void

Sets the contact callback of the shape to callback.

inlinesetDensity(density:Float):Void

Sets the density of the shape to density.

This affects the parent rigid body's mass data.

inlinesetFriction(friction:Float):Void

Sets the coefficient of friction to friction.

inlinesetLocalTransform(transform:Transform):Void

Sets the shape's transform to transform relative to the parent rigid body's transform.

This affects the parent rigid body's mass data.

inlinesetRestitution(restitution:Float):Void

Sets the coefficient of restitution to restitution.