Seems more reliable than the original method but not perfect. Added number based weapon switching
This commit is contained in:
@@ -21,7 +21,7 @@ var player_velocity
|
||||
func _ready():
|
||||
|
||||
visible = false
|
||||
linear_velocity += transform.basis * Vector3(0, 0, -bullet_speed) + player_velocity
|
||||
linear_velocity += transform.basis * Vector3(0, 0, -bullet_speed)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@@ -31,7 +31,7 @@ func _physics_process(delta):
|
||||
|
||||
distance_from_player = abs(self.global_position - player_position)
|
||||
|
||||
if distance_from_player.x > 2 or distance_from_player.y > 2 or distance_from_player.z > 2:
|
||||
if distance_from_player.length() > 1.5:
|
||||
visible = true
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user