Extra Math for GDScript's icon

Extra Math for GDScript 1.0.0 Scripts 3.4 Community

Submitted by user balintbarna; Unlicense; 2021-12-26

Provides easy-to-use math functions that are not yet available in the stable engine builds. Functionality includes Euler conversions, conversion to axis-angle vector, and more. If you would like to add a common math function please submit an issue on GitHub.

Usage example:
var from = Vector3.FORWARD
var to = Vector3(1, 0, 1)
var rot = ExtraMath.get_vectors_rotation(from, to)
var to_calculated = from.rotated(rot.normalized(), rot.length())
var to_calculated_with_basis = Basis(rot.normalized(), rot.length()) * from

Functions in current version:
usec_to_sec(usec: int)
sec_to_usec(sec: float)
get_vectors_rotation(from: Vector3, to: Vector3)
basis2axis_angle(b: Basis)
quat2axis_angle(q: Quat)
quat2euler(q: Quat, order = DEFAULT_EULER_ORDER)
basis2euler(b: Basis, order = DEFAULT_EULER_ORDER)
euler2quat(angles: Vector3, order = DEFAULT_EULER_ORDER)
euler2basis(angles: Vector3, order = DEFAULT_EULER_ORDER)

Constants in current version:
const EPSILON = 0.00001
const SQRTHALF = 0.7071067811865475244008443621048490
const SQRT2 = 1.4142135623730950488016887242
const LN2 = 0.6931471805599453094172321215
const EULER = 2.7182818284590452353602874714

For more details see the comments in the code.

View files Download Submit an issue Recent Edits