diff options
author | Yuri Sizov <yuris@humnom.net> | 2023-08-03 22:37:30 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-08-03 22:37:30 +0200 |
commit | a56e960150718374533d0a8378fb10db2219ddef (patch) | |
tree | 63764f2dab0732bdf63513ae1443c75d5e5ee495 /doc | |
parent | f9f50416758eff6c0b8981af5b4a968fa2e59b8e (diff) | |
parent | af7f787c6ed3ac39f61ca0e346256a5aa6a00289 (diff) | |
download | redot-engine-a56e960150718374533d0a8378fb10db2219ddef.tar.gz |
Merge pull request #71233 from PrecisionRender/barycentric-coords
Add ability to get face index and barycentric coordinates from raycast
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/Geometry3D.xml | 11 | ||||
-rw-r--r-- | doc/classes/PhysicsDirectSpaceState3D.xml | 2 | ||||
-rw-r--r-- | doc/classes/RayCast3D.xml | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/doc/classes/Geometry3D.xml b/doc/classes/Geometry3D.xml index 014ebd2248..85b8965faf 100644 --- a/doc/classes/Geometry3D.xml +++ b/doc/classes/Geometry3D.xml @@ -73,6 +73,17 @@ Given the two 3D segments ([param p1], [param p2]) and ([param q1], [param q2]), finds those two points on the two segments that are closest to each other. Returns a [PackedVector3Array] that contains this point on ([param p1], [param p2]) as well the accompanying point on ([param q1], [param q2]). </description> </method> + <method name="get_triangle_barycentric_coords"> + <return type="Vector3" /> + <param index="0" name="point" type="Vector3" /> + <param index="1" name="a" type="Vector3" /> + <param index="2" name="b" type="Vector3" /> + <param index="3" name="c" type="Vector3" /> + <description> + Returns a [Vector3] containing weights based on how close a 3D position ([param point]) is to a triangle's different vertices ([param a], [param b] and [param c]). This is useful for interpolating between the data of different vertices in a triangle. One example use case is using this to smoothly rotate over a mesh instead of relying solely on face normals. + [url=https://en.wikipedia.org/wiki/Barycentric_coordinate_system]Here is a more detailed explanation of barycentric coordinates.[/url] + </description> + </method> <method name="ray_intersects_triangle"> <return type="Variant" /> <param index="0" name="from" type="Vector3" /> diff --git a/doc/classes/PhysicsDirectSpaceState3D.xml b/doc/classes/PhysicsDirectSpaceState3D.xml index 17324e49c6..b00dc4236d 100644 --- a/doc/classes/PhysicsDirectSpaceState3D.xml +++ b/doc/classes/PhysicsDirectSpaceState3D.xml @@ -67,6 +67,8 @@ [code]collider_id[/code]: The colliding object's ID. [code]normal[/code]: The object's surface normal at the intersection point, or [code]Vector3(0, 0, 0)[/code] if the ray starts inside the shape and [member PhysicsRayQueryParameters3D.hit_from_inside] is [code]true[/code]. [code]position[/code]: The intersection point. + [code]face_index[/code]: The face index at the intersection point. + [b]Note:[/b] Returns a valid number only if the intersected shape is a [ConcavePolygonShape3D]. Otherwise, [code]-1[/code] is returned. [code]rid[/code]: The intersecting object's [RID]. [code]shape[/code]: The shape index of the colliding shape. If the ray did not intersect anything, then an empty dictionary is returned instead. diff --git a/doc/classes/RayCast3D.xml b/doc/classes/RayCast3D.xml index 83476a6d48..4c4db36aca 100644 --- a/doc/classes/RayCast3D.xml +++ b/doc/classes/RayCast3D.xml @@ -59,6 +59,12 @@ Returns the shape ID of the first object that the ray intersects, or [code]0[/code] if no object is intersecting the ray (i.e. [method is_colliding] returns [code]false[/code]). </description> </method> + <method name="get_collision_face_index" qualifiers="const"> + <return type="int" /> + <description> + Returns the collision object's face index at the collision point, or [code]-1[/code] if the shape intersecting the ray is not a [ConcavePolygonShape3D]. + </description> + </method> <method name="get_collision_mask_value" qualifiers="const"> <return type="bool" /> <param index="0" name="layer_number" type="int" /> |