Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instantiate nodes using position instead of global_position #141

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion COGITO/Assets/Shader/ShaderPrecompiler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static func precompile(tree : SceneTree, shader : ShaderMaterial, use_new_node :
compiler.position = Vector3(0,0,-0.1) # position self in front of camera

compiler.cast_shadow = 0
compiler.custom_aabb = AABB(compiler.global_position, Vector3.ONE*100) # make sure we're always rendering
compiler.custom_aabb = AABB(compiler.position, Vector3.ONE*100) # make sure we're always rendering

tree.root.get_camera_3d().add_child(compiler)
else:
Expand Down
4 changes: 2 additions & 2 deletions COGITO/Components/Attributes/CogitoHealthAttribute.gd
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func on_death(_attribute_name:String, _value_current:float, _value_max:float):
parent_position = get_parent().global_position

if sound_on_death:
Audio.play_sound_3d(sound_on_death).global_position = parent_position
Audio.play_sound_3d(sound_on_death).position = parent_position

if spawn_on_death:
var spawned_object = spawn_on_death.instantiate()
spawned_object.global_position = parent_position
spawned_object.position = parent_position
get_tree().current_scene.add_child(spawned_object)

for nodepath in destroy_on_death:
Expand Down
2 changes: 1 addition & 1 deletion COGITO/Scripts/Cogito_Spawnzone.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func spawn_objects():
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 )

var spawned_object = object_to_spawn.instantiate()
spawned_object.global_position = spawn_point
spawned_object.position = spawn_point
get_tree().current_scene.add_child(spawned_object)

left_to_spawn -= 1
Expand Down