Documentation
¶
Overview ¶
Creates a bounding volume hierarchy (BVH) tree structure around triangle geometry.
The triangle BVH tree can be used for efficient intersection queries without involving a physics engine.
For example, this can be used in editor tools to select objects with complex shapes based on the mouse cursor position.
Performance: Creating the BVH tree for complex geometry is a slow process and best done in a background thread.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsTriangleMesh() Instance
- func (self Instance) CreateFromFaces(faces []Vector3.XYZ) bool
- func (self Instance) GetFaces() []Vector3.XYZ
- func (self Instance) ID() ID
- func (self Instance) IntersectRay(begin Vector3.XYZ, dir Vector3.XYZ) Intersection
- func (self Instance) IntersectSegment(begin Vector3.XYZ, end Vector3.XYZ) Intersection
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
- type Intersection
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 Extension ¶
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]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsTriangleMesh ¶
type 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.
type Instance ¶
type Instance [1]gdclass.TriangleMesh
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 (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsTriangleMesh ¶
func (Instance) CreateFromFaces ¶
Creates the BVH tree from an array of faces. Each 3 vertices of the input 'faces' array represent one triangle (face).
Returns true if the tree is successfully built, false otherwise.
func (Instance) GetFaces ¶
Returns a copy of the geometry faces. Each 3 vertices of the array represent one triangle (face).
func (Instance) IntersectRay ¶
Tests for intersection with a ray starting at 'begin' and facing 'dir' and extending toward infinity.
If an intersection with a triangle happens, returns a data structure with the following fields:
position: The position on the intersected triangle.
normal: The normal of the intersected triangle.
face_index: The index of the intersected triangle.
Returns an empty data structure if no intersection happens.
See also IntersectSegment, which is similar but uses a finite-length segment.
func (Instance) IntersectSegment ¶
Tests for intersection with a segment going from 'begin' to 'end'.
If an intersection with a triangle happens returns a data structure with the following fields:
position: The position on the intersected triangle.
normal: The normal of the intersected triangle.
face_index: The index of the intersected triangle.
Returns an empty data structure if no intersection happens.
See also IntersectRay, which is similar but uses an infinite-length ray.