Work in progress
Godot documentation is being updated to reflect the latest changes in version
4.0
. Some documentation pages may
still state outdated information. This banner will tell you if you're reading one of such pages.
The contents of this page are up to date. If you can still find outdated information, please open an issue.
ConcavePolygonShape3D¶
Inherits: Shape3D < Resource < RefCounted < Object
Concave polygon shape resource (also called "trimesh") for 3D physics.
Description¶
3D concave polygon shape resource (also called "trimesh") to be added as a direct child of a PhysicsBody3D or Area3D using a CollisionShape3D node. This shape is created by feeding a list of triangles. Despite its name, ConcavePolygonShape3D can also store convex polygon shapes. However, unlike ConvexPolygonShape3D, ConcavePolygonShape3D is not limited to storing convex shapes exclusively.
Note: When used for collision, ConcavePolygonShape3D is intended to work with static PhysicsBody3D nodes like StaticBody3D and will not work with CharacterBody3D or RigidBody3D with a mode other than Static.
Performance: Due to its complexity, ConcavePolygonShape3D is the slowest collision shape to check collisions against. Its use should generally be limited to level geometry. For convex geometry, using ConvexPolygonShape3D will perform better. For dynamic physics bodies that need concave collision, several ConvexPolygonShape3Ds can be used to represent its collision by using convex decomposition; see ConvexPolygonShape3D's documentation for instructions. However, consider using primitive collision shapes such as SphereShape3D or BoxShape3D first.
Warning: Using this shape for an Area3D (via a CollisionShape3D node, created e.g. by using the Create Trimesh Collision Sibling option in the Mesh menu that appears when selecting a MeshInstance3D node) may give unexpected results: the area will only detect collisions with the triangle faces in the ConcavePolygonShape3D (and not with any "inside" of the shape, for example); moreover it will only detect all such collisions if backface_collision is true
.
Tutorials¶
Properties¶
|
Methods¶
get_faces ( ) const |
|
void |
set_faces ( PackedVector3Array faces ) |
Property Descriptions¶
bool backface_collision = false
If set to true
, collisions occur on both sides of the concave shape faces. Otherwise they occur only along the face normals.
Method Descriptions¶
PackedVector3Array get_faces ( ) const
Returns the faces (an array of triangles).
void set_faces ( PackedVector3Array faces )
Sets the faces (an array of triangles).