CSGShape

Inherits: GeometryInstance < VisualInstance < CullInstance < Spatial < Node < Object

Inherited By: CSGCombiner, CSGPrimitive

CSG基类。

描述

这是CSG基类,可为Godot中的各个CSG节点提供CSG操作支持。

属性

bool

calculate_tangents

true

int

collision_layer

1

int

collision_mask

1

Operation

operation

0

float

snap

0.001

bool

use_collision

false

方法

bool

get_collision_layer_bit ( int bit ) const

bool

get_collision_mask_bit ( int bit ) const

Array

get_meshes ( ) const

bool

is_root_shape ( ) const

void

set_collision_layer_bit ( int bit, bool value )

void

set_collision_mask_bit ( int bit, bool value )

枚举

enum Operation:

  • OPERATION_UNION = 0 —- 合并两个图元的几何,删除相交的几何。

  • OPERATION_INTERSECTION = 1 —- 仅保留相交的几何,其余的将被删除。

  • OPERATION_SUBTRACTION = 2 —- 从第一个形状减去第二个形状,留下一个带有其形状的凹痕。

属性说明

  • bool calculate_tangents

Default

true

Setter

set_calculate_tangents(value)

Getter

is_calculating_tangents()

计算允许使用法线贴图的CSG形状的切线。这仅适用于根部形状,此设置将在所有子级上均被忽略。


  • int collision_layer

Default

1

Setter

set_collision_layer(value)

Getter

get_collision_layer()

The physics layers this area 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

1

Setter

set_collision_mask(value)

Getter

get_collision_mask()

The physics layers this CSG shape scans for collisions. See Collision layers and masks in the documentation for more information.


Default

0

Setter

set_operation(value)

Getter

get_operation()

在此形状上执行的操作。对于第一个CSG子节点,将忽略此操作,因为操作是在此节点与该节点父级的上一个子级之间进行的。


Default

0.001

Setter

set_snap(value)

Getter

get_snap()

捕捉使网格捕捉到给定的距离,以便两个网格的面可以完美对齐。较低的值会导致较高的精度,但可能难以调整。


Default

false

Setter

set_use_collision(value)

Getter

is_using_collision()

为我们的CSG形状向物理引擎添加碰撞形状。这将始终像一个静态物体。请注意,即使CSG形状本身被隐藏,碰撞形状仍处于活动状态。

方法说明

  • bool get_collision_layer_bit ( int bit ) const

返回碰撞遮罩上的单个的个体。


  • bool get_collision_mask_bit ( int bit ) const

返回碰撞遮罩上的单个的个体。


  • Array get_meshes ( ) const

返回带有两个元素的Array,第一个是此节点的Transform,第二个是此节点的根Mesh。仅当此节点为根形时才有效。


  • bool is_root_shape ( ) const

如果这是根形状,因此是渲染的对象,则返回true


  • void set_collision_layer_bit ( int bit, bool value )

设置图层掩码上的各个位。如果只需要更改一层的值,请使用此选项。


  • void set_collision_mask_bit ( int bit, bool value )

设置碰撞掩码上的各个位。如果只需要更改一层的值,请使用此选项。