This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
创建内容
内容优化
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::JointParticles Class

Header: #include <UniginePhysics.h>
Inherits from: Joint

This class is used to pin cloth body or rope body to rigid bodies, ragdolls or dummy bodies.

Example#

The following code illustrates connection of a rope body (rope) and a dummy body (dummy) using a particles joint. The anchor is placed at the position of a dummy body.

Source code (C++)
include <UniginePhysics.h>

/* .. */

//the anchor point is placed at the position of a dummy body, pinning area size is (0.5f, 0.5f, 1.5f)
JointParticlesPtr joint = JointParticles::create(dummy, rope, dummy->getObject()->getPosition(), Vec3(0.5f, 0.5f, 1.5f)));

// setting pinning threshold
joint->setThreshold(0.001f);

// setting number of iterations
joint->setNumIterations(4);

See Also#

JointParticles Class

Members


static JointParticlesPtr create ( ) #

Constructor. Creates a particle joint with an anchor at the origin of the world coordinates.

static JointParticlesPtr create ( const Ptr<Body> & body0, const Ptr<Body> & body1 ) #

Constructor. Creates a particle joint connecting two given bodies. An anchor is placed in the center of the body to which the cloth or rope is pinned.

Arguments

static JointParticlesPtr create ( const Ptr<Body> & body0, const Ptr<Body> & body1, const Math::Vec3 & anchor, const Math::vec3 & size ) #

Constructor. Creates a particles joint connecting two given bodies with specified pinning area size and an anchor placed at specified coordinates.

Arguments

  • const Ptr<Body> & body0 - First body to be connected with the joint. It can be one of the following:
  • const Ptr<Body> & body1 - Second body to be connected with the joint. It can be one of the following:
  • const Math::Vec3 & anchor - Anchor coordinates.
  • const Math::vec3 & size - Area for pinning vertices of cloth or rope body to another body.

int getNumParticles ( ) #

Returns the total number of pinned particles of the cloth or rope body.

Return value

The number of pinned particles.

float getParticleMass ( int num ) #

Returns the mass of the pinned particle of the cloth or rope body.

Arguments

  • int num - Particle number.

Return value

Particle mass.

Math::vec3 getParticlePosition ( int num ) #

Returns the position of the pinned particle of the cloth or rope body.

Arguments

  • int num - Particle number.

Return value

Particle position.

void setSize ( const Math::vec3 & size ) #

Updates a size of the area for pinning vertices of cloth or rope body to another body.

Arguments

  • const Math::vec3 & size - Size of the area to be pinned.

Math::vec3 getSize ( ) #

Returns the current size of the area of pinned vertices of cloth or rope body to another body.

Return value

Size of the pinned area.

void setThreshold ( float threshold ) #

Updates a threshold that determines the distance for pinning vertices of cloth or rope body to another body. If vertices are closer than the threshold, they are pinned together; otherwise, particles stay loose.

Arguments

  • float threshold - Threshold of pinning distance.

float getThreshold ( ) #

Returns the current threshold that determines the distance for pinning vertices of cloth or rope body to another body. If vertices are closer than the threshold, they are pinned together; otherwise, particles stay loose.

Return value

Threshold of pinning distance.

void clearParticles ( ) #

Unpins the cloth or rope body completely.
Last update: 2022-03-10
Build: ()