CSGShape

Inherits: GeometryInstance < VisualInstance < Spatial < Node < Object

Inherited By: CSGCombiner, CSGPrimitive

The CSG base class.

Description

This is the CSG base class that provides CSG operation support to the various CSG nodes in Godot.

Properties

bool calculate_tangents true
int collision_layer 1
int collision_mask 1
Operation operation 0
float snap 0.001
bool use_collision false

Methods

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 )

Enumerations

enum Operation:

  • OPERATION_UNION = 0 --- Geometry of both primitives is merged, intersecting geometry is removed.
  • OPERATION_INTERSECTION = 1 --- Only intersecting geometry remains, the rest is removed.
  • OPERATION_SUBTRACTION = 2 --- The second shape is subtracted from the first, leaving a dent with its shape.

Property Descriptions

bool calculate_tangents

Default true
Setter set_calculate_tangents(value)
Getter is_calculating_tangents()

Calculate tangents for the CSG shape which allows the use of normal maps. This is only applied on the root shape, this setting is ignored on any child.

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.

Operation operation

Default 0
Setter set_operation(value)
Getter get_operation()

The operation that is performed on this shape. This is ignored for the first CSG child node as the operation is between this node and the previous child of this nodes parent.

float snap

Default 0.001
Setter set_snap(value)
Getter get_snap()

Snap makes the mesh snap to a given distance so that the faces of two meshes can be perfectly aligned. A lower value results in greater precision but may be harder to adjust.

bool use_collision

Default false
Setter set_use_collision(value)
Getter is_using_collision()

Adds a collision shape to the physics engine for our CSG shape. This will always act like a static body. Note that the collision shape is still active even if the CSG shape itself is hidden.

Method Descriptions

bool get_collision_layer_bit ( int bit ) const

Returns an individual bit on the collision mask.

bool get_collision_mask_bit ( int bit ) const

Returns an individual bit on the collision mask.

Array get_meshes ( ) const

Returns an Array with two elements, the first is the Transform of this node and the second is the root Mesh of this node. Only works when this node is the root shape.

bool is_root_shape ( ) const

Returns true if this is a root shape and is thus the object that is rendered.

void set_collision_layer_bit ( int bit, bool value )

Sets individual bits on the layer mask. Use this if you only need to change one layer's value.

void set_collision_mask_bit ( int bit, bool value )

Sets individual bits on the collision mask. Use this if you only need to change one layer's value.

© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_csgshape.html