saddle-up / common /scripts /ThreeD.gd
Yeehaw2026's picture
Upload folder using huggingface_hub
8438369 verified
Raw History Blame Contribute Delete
1.28 kB
extends Node
func get_aabb_corners(aabb_instance):
# If working in 3D and you need the corners on a specific plane (e.g., the "top" face)
# Assuming the Y-axis represents height and you want the top corners:
var front_left: Vector3 = aabb_instance.position + Vector3(0, aabb_instance.size.y, 0)
var front_right: Vector3 = aabb_instance.position + Vector3(aabb_instance.size.x, aabb_instance.size.y, 0)
var back_left: Vector3 = aabb_instance.position + Vector3(0, aabb_instance.size.y, aabb_instance.size.z)
var back_right: Vector3 = aabb_instance.position + Vector3(aabb_instance.size.x, aabb_instance.size.y, aabb_instance.size.z)
return {
'fl': front_left,
'fr': front_right,
'bl': back_left,
'br': back_right
}
func get_random_position_aabb(aabb):
var random_x = randf_range(aabb.position.x, aabb.position.x + aabb.size.x)
var random_y = randf_range(aabb.position.y, aabb.position.y + aabb.size.y)
var random_z = randf_range(aabb.position.z, aabb.position.z + aabb.size.z)
return Vector3(random_x, random_y, random_z)
# Try to get a random point distance away from origin point.
# The point should be inside the aabb's bounding box
func get_random_position_aabb_distanced(aabb: AABB, origin: Vector3, distance: float):
# TODO: Implement me
pass