Godot Version
4.3
Question
Ive been making this code for 4D objects for my 4D game & none of it has been working, can someone explain to me why and/or edit the code so it can properly work.
extends MeshInstance3D
@export_subgroup(“Shape Settings”)
enum ShapeType { HYPER_SPHERE, HYPER_CUBE, DUO_CYLINDER, PLANE, CONE, FIVE_CELL, SIXTEEN_CELL }
enum Operation { UNION, BLEND, SUBTRACT, INTERSECT }
@export var shape_type : ShapeType
@export var operation : Operation
@export_subgroup(“4D Settings”)
@export var w_position: float = 0.0
@export var w_rotation: Vector4
@export var w_scale: float = 1.0
@export_subgroup(“Render Settings”)
@export_range(0.0, 1.0) var smooth_radius : float = 0.0
@onready var num_children : int = get_child_count()
var parent_scale : Vector4 = Vector4(1, 1, 1, 1)
Returns the 4D position of the object
func get_position_4d() → Vector4:
var position_3d : Vector3 = global_transform.origin
return Vector4(position_3d.x, position_3d.y, position_3d.z, w_position)
Returns the 3D rotation of the object
func get_rotation_3d() → Vector3:
return global_transform.basis.get_euler()
Returns the 3 remaining 4D rotation axes
func get_rotation_w() → Vector4:
return w_rotation * deg_to_rad(1.0)
Returns the 4D scale of the object
func get_scale_4d() → Vector4:
if get_parent() and get_parent().has_method(“get_scale_4d”):
parent_scale = get_parent().get_scale_4d()
else:
parent_scale = Vector4(1, 1, 1, 1)
var local_scale_3d : Vector3 = global_transform.basis.get_scale()
return Vector4(local_scale_3d.x, local_scale_3d.y, local_scale_3d.z, w_scale) * parent_scale