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

Fixed issue where Projectile would spawn at world orgin instead of bullet_point in Godot 4.3 #285

Merged
merged 2 commits into from
Sep 25, 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/Wieldables/toy_pistol.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bus = &"SFX"

[node name="Bullet_Point" type="Node3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, -1.81899e-12, 0, 1, 0, 0, 0, 1, 0.277335, 0.0601448, 0.00182778)
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.277335, 0.0601448, 0.00182778)

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
Expand Down
2 changes: 2 additions & 0 deletions COGITO/Wieldables/wieldable_toy_pistol.gd
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ func action_primary(_passed_item_reference : InventoryItemPD, _is_released: bool
# Spawning projectile
var Projectile = get_projectile()
bullet_point.add_child(Projectile)
Projectile.set_global_position(Vector3(bullet_point.global_position.x,bullet_point.global_position.y,bullet_point.global_position.z))
Projectile.global_transform.basis = bullet_point.global_transform.basis
Projectile.damage_amount = _passed_item_reference.wieldable_damage
Projectile.set_linear_velocity(Direction * projectile_velocity)
Projectile.reparent(get_tree().get_current_scene())
Expand Down