SoftBody¶
Inherits: MeshInstance < GeometryInstance < VisualInstance < CullInstance < Spatial < Node < Object
柔性网格物理体。
描述¶
可变形的物理体。用于创建弹性或可变形的物体,如布、橡胶或其他柔性材质。
教程¶
属性¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法¶
void |
add_collision_exception_with ( Node body ) |
get_collision_layer_bit ( int bit ) const |
|
get_collision_mask_bit ( int bit ) const |
|
get_point_transform ( int point_index ) |
|
is_point_pinned ( int point_index ) const |
|
void |
remove_collision_exception_with ( Node body ) |
void |
set_collision_layer_bit ( int bit, bool value ) |
void |
set_collision_mask_bit ( int bit, bool value ) |
void |
set_point_pinned ( int point_index, bool pinned, NodePath attachment_path=NodePath("") ) |
属性说明¶
float areaAngular_stiffness
Default |
|
Setter |
set_areaAngular_stiffness(value) |
Getter |
get_areaAngular_stiffness() |
int collision_layer
Default |
|
Setter |
set_collision_layer(value) |
Getter |
get_collision_layer() |
The physics layers this SoftBody is in.
Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property.
A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. See Collision layers and masks in the documentation for more information.
int collision_mask
Default |
|
Setter |
set_collision_mask(value) |
Getter |
get_collision_mask() |
The physics layers this SoftBody scans for collisions. See Collision layers and masks in the documentation for more information.
float damping_coefficient
Default |
|
Setter |
set_damping_coefficient(value) |
Getter |
get_damping_coefficient() |
float drag_coefficient
Default |
|
Setter |
set_drag_coefficient(value) |
Getter |
get_drag_coefficient() |
float linear_stiffness
Default |
|
Setter |
set_linear_stiffness(value) |
Getter |
get_linear_stiffness() |
NodePath parent_collision_ignore
Default |
|
Setter |
set_parent_collision_ignore(value) |
Getter |
get_parent_collision_ignore() |
指向 CollisionObject 的 NodePath,这个 SoftBody 应该避免穿过它。
bool physics_enabled
Default |
|
Setter |
set_physics_enabled(value) |
Getter |
is_physics_enabled() |
为 true
时 SoftBody
会进行物理模拟。可以通过设置为 false
来暂停物理模拟。
float pose_matching_coefficient
Default |
|
Setter |
set_pose_matching_coefficient(value) |
Getter |
get_pose_matching_coefficient() |
float pressure_coefficient
Default |
|
Setter |
set_pressure_coefficient(value) |
Getter |
get_pressure_coefficient() |
bool ray_pickable
Default |
|
Setter |
set_ray_pickable(value) |
Getter |
is_ray_pickable() |
为 true
时该 SoftBody
会响应 RayCast。
int simulation_precision
Default |
|
Setter |
set_simulation_precision(value) |
Getter |
get_simulation_precision() |
增加这个值会改善模拟结果,但会影响性能。请小心使用。
float total_mass
Default |
|
Setter |
set_total_mass(value) |
Getter |
get_total_mass() |
该 SoftBody 的质量。
float volume_stiffness
Default |
|
Setter |
set_volume_stiffness(value) |
Getter |
get_volume_stiffness() |
方法说明¶
void add_collision_exception_with ( Node body )
将一个物体添加到这个物体不能碰撞的物体列表中。
Array get_collision_exceptions ( )
返回该物体的碰撞例外节点数组。
返回碰撞遮罩上的单个的个体。
返回碰撞遮罩上的单个的个体。
返回表面数组中顶点的局部平移。
如果顶点设置为固定,则返回 true
。
void remove_collision_exception_with ( Node body )
将一个物体从该物体不能碰撞的物体列表中移除。
设置图层掩码上的各个位。如果只需要更改一层的值,请使用此选项。
设置碰撞掩码上的各个位。如果只需要更改一层的值,请使用此选项。
设置表面顶点的固定状态。当设置为 true
时,可选的attachment_path
可以定义一个空间Spatial,被固定的顶点将连接到这个空间。