extends Node3D Define the axis the object will rotate. @export var rotationaxis :…
- User
extends Node3D
Define the axis the object will rotate.
@export var rotation_axis : Vector3 = Vector3(1,0,0)
Rotation speed.
@export var rotation_speed : float = 1
@export var is_rotating : bool
@export var check_world_state: bool @export var world_state_property: String = "lab_power"
Called when the node enters the scene tree for the first time.
func _ready() -> void: if check_world_state: check_for_power.call_deferred() pass # Replace with function body.
Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: if is_rotating: self.rotate(rotation_axis, rotation_speed * delta)
func check_for_power() -> void: await CogitoSceneManager.is_node_ready() var property_value = CogitoSceneManager._current_world_dict.get(world_state_property) CogitoGlobals.debug_log(true, "cogito_rotator_tool", "world_dict: " + str(world_state_property) + " = " + str(property_value) )
codeif property_value == true: is_rotating = true else: is_rotating = false - Assistant
- User
extends Area3D
@export var spawn_area : CollisionShape3D
@export_range(1,100) var spawn_amount : int
@export var object_to_spawn : PackedScene
Called when the node enters the scene tree for the first time.
func _ready() -> void: if !spawn_area.shape.is_class("BoxShape3D"): print("spawn area is not a BoxShape3D!") pass # Replace with function body.
func spawn_objects(): var left_to_spawn = spawn_amount var spawn_point : Vector3 = Vector3.ZERO while left_to_spawn > 0: spawn_point.x = randf_range(spawn_area.global_position.x - spawn_area.shape.size.x, spawn_area.global_position.x + spawn_area.shape.size.x ) spawn_point.y = randf_range(spawn_area.global_position.y - spawn_area.shape.size.y, spawn_area.global_position.y + spawn_area.shape.size.y ) spawn_point.z = randf_range(spawn_area.global_position.z - spawn_area.shape.size.z, spawn_area.global_position.z + spawn_area.shape.size.z )
codevar spawned_object = object_to_spawn.instantiate() spawned_object.position = spawn_point get_tree().current_scene.add_child(spawned_object) left_to_spawn -= 1func _on_generic_button_pressed() -> void: spawn_objects()
- Assistant