This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

BodyRagDoll Class

This class is used to simulate rag doll bodies. This body automatically generates a rag doll skeleton, i.e. collision shapes that are bound to the bones and joints that connect them.

BodyRagDoll Class

Members


BodyRagDoll ()

Constructor. Creates a rag doll with default properties.

BodyRagDoll (const Ptr<Object> & object)

Constructor. Creates a rag doll with default properties for a given object.

Arguments

  • const Ptr<Object> & object - Object approximated with the new rag doll.

int getNumBones ()

Returns the number of bones in the rag doll.

Return value

Number of bones.

int findBone (const char * name)

Searches for a bone with a given name.

Arguments

  • const char * name - Name of the bone.

Return value

Number of the bone in the list of bones, if it is found; otherwise, -1.

void setBones (const Ptr<Node> & node)

Imports a set of bones from a given node.

Arguments

  • const Ptr<Node> & node - Node, from which the bones will be imported.

int createBones (float error = 0.2, float threshold = 0.01, int capsule = 0)

Automatically generates a simplified skeleton from the mesh and its bones. Each bone is approximated with a convex hull or a capsule based on given parameters.

Arguments

  • float error - Permissible error, which is used for creating convex hulls. This is an optional parameter.
  • float threshold - Threshold, which is used to detect and discard too small convex hulls. A convex hull, which volume is smaller than an average volume multiplied by the threshold, is discarded. This is an optional parameter.
  • int capsule - Approximation shape. By the value of 0, convex hull is used; the value of 1 sets capsule approximation.

Return value

Created bone number.

void setBoneFrameBased (int bone, int based)

Sets a value indicating if bone transformations should be based on skinned animation data or conditioned by physics.

Arguments

  • int bone - Bone number.
  • int based - Positive value to set skinned animation-based transformations, 0 for rag doll physical animation.

int isFrameBased ()

Returns a value indicating if rag doll bones move according to the animation written in the file.

Return value

Positive number if the bones move according to the file animation; otherwise, 0.

void setMass (float mass)

Sets a mass of the rag doll.
Notice
If g (Earth's gravity) equals to 9.8 m/s2, and 1 unit equals to 1 m, the mass is measured in kilograms.

Arguments

  • float mass - Mass of the rag doll.

const char * getBoneName (int bone)

Returns the name of a given bone.

Arguments

  • int bone - Bone number.

Return value

Bone name.

float getMass ()

Returns the mass of the rag doll.
Notice
If g (Earth's gravity) equals to 9.8 m/s2, and 1 unit equals to 1 m, the mass is measured in kilograms.

Return value

Mass of the rag doll.

float getRigidity ()

Returns the rigidity of bones movement, i.e. how much interpolated linear and angular velocities of all the bones corrects velocities of each separate bone.

Return value

Rigidity of bones movement:
  • By the value of 0, bones are independent.
  • By the value of 1, bones movement is uniform, as interpolated velocity greatly changes velocities of each bone.

int getBoneNumber (int bone)

Checks whether the bone with the given number exists.

Arguments

  • int bone - The number of the bone.

Return value

Bone number.

void setFrameBased (int based)

Sets a value indicating if rag doll bones move according to the animation written in the file.

Arguments

  • int based - Positive number to make the bones move according to the file animation, 0 to make the movements physics-driven.

void setRigidity (float rigidity)

Sets rigidity of bones movement, i.e. how much interpolated linear and angular velocities of all the bones corrects velocities of each separate bone.

Arguments

  • float rigidity - Rigidity of bones movement. Provided value is saturated in range [0;1]:
    • By the value of 0, bones are independent.
    • By the value of 1, bones movement is uniform, as interpolated velocity greatly changes velocities of each bone.

Math::Mat4 getBoneTransform (int bone)

Returns the transformation of animation bone for the current frame.

Arguments

  • int bone - Bone number.

Return value

Bone transformation matrix.

int isBoneFrameBased (int bone)

Returns a value indicating if bone transformations are based on skinned animation data or conditioned by physics.

Arguments

  • int bone - Bone number.

Return value

Positive value if transformations are based on skinned animation, 0 if they are rag doll physical animation.

Ptr<Node> getBones ()

Exports a set of bones into a given node.

Return value

Node, into which the bones will be exported.
Last update: 03.07.2017
Build: ()