Skip to content

Commit

Permalink
Fixed Projectile not spawning at Bullet_Point and corrected rotation
Browse files Browse the repository at this point in the history
Not sure if deg_to_rad(-90) sets bullet shooting forward or not, can set it to deg_to_rad(90) if I got it wrong and the bullet should shoot forward... I don't know how to check for these things yet.
  • Loading branch information
JohnnyThunder2 authored Sep 22, 2024
1 parent ba42ee2 commit ae268b4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions COGITO/Wieldables/wieldable_toy_pistol.gd
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ func action_primary(_passed_item_reference : InventoryItemPD, _is_released: bool
# Spawning projectile
var Projectile = projectile_prefab.instantiate()
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 * Basis(Vector3(0,1,0), deg_to_rad(-90)) #can swap 'deg_to_rad(-90)' with '-1.5708' if we want this code to run faster
Projectile.damage_amount = _passed_item_reference.wieldable_damage
Projectile.set_linear_velocity(Direction * projectile_velocity)
Projectile.reparent(get_tree().get_current_scene())
Expand Down

0 comments on commit ae268b4

Please sign in to comment.