ConvexPolygonShape3D

package
v0.0.0-...-c858641 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

A 3D convex polyhedron shape, intended for use in physics. Usually used to provide a shape for a graphics.gd/classdb/CollisionShape3D.

graphics.gd/classdb/ConvexPolygonShape3D is solid, which means it detects collisions from objects that are fully inside it, unlike graphics.gd/classdb/ConcavePolygonShape3D which is hollow. This makes it more suitable for both detection and physics.

Convex decomposition: A concave polyhedron can be split up into several convex polyhedra. This allows dynamic physics bodies to have complex concave collisions (at a performance cost) and can be achieved by using several graphics.gd/classdb/ConvexPolygonShape3D nodes. To generate a convex decomposition from a mesh, select the graphics.gd/classdb/MeshInstance3D node, go to the Mesh menu that appears above the viewport, and choose Create Multiple Convex Collision Siblings. Alternatively, graphics.gd/classdb/MeshInstance3D.Instance.CreateMultipleConvexCollisions can be called in a script to perform this decomposition at run-time.

Performance: graphics.gd/classdb/ConvexPolygonShape3D is faster to check collisions against compared to graphics.gd/classdb/ConcavePolygonShape3D, but it is slower than primitive collision shapes such as graphics.gd/classdb/SphereShape3D and graphics.gd/classdb/BoxShape3D. Its use should generally be limited to medium-sized objects that cannot have their collision accurately represented by primitive shapes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsConvexPolygonShape3D() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsConvexPolygonShape3D

func (self *Extension[T]) AsConvexPolygonShape3D() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

func (*Extension[T]) AsShape3D

func (self *Extension[T]) AsShape3D() Shape3D.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.ConvexPolygonShape3D

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsConvexPolygonShape3D

func (self Instance) AsConvexPolygonShape3D() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) AsShape3D

func (self Instance) AsShape3D() Shape3D.Instance

func (Instance) ID

func (self Instance) ID() ID

func (Instance) Points

func (self Instance) Points() []Vector3.XYZ

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetPoints

func (self Instance) SetPoints(value []Vector3.XYZ)

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL