AI now has gravity
This commit is contained in:
parent
ec0cc0721c
commit
01952094a4
1 changed files with 4 additions and 1 deletions
|
@ -58,7 +58,10 @@ func _physics_process(delta):
|
||||||
bulletshot = false
|
bulletshot = false
|
||||||
bulletrandom = randf_range(1.0, 50.0)
|
bulletrandom = randf_range(1.0, 50.0)
|
||||||
bullettimer = bulletrandom
|
bullettimer = bulletrandom
|
||||||
velocity = (player.transform.origin - transform.origin).normalized() * SPEED
|
var direction = (player.transform.origin - transform.origin).normalized()
|
||||||
|
var xz_velocity = Vector3(direction.x, 0, direction.z) * SPEED
|
||||||
|
var y_velocity = velocity.y
|
||||||
|
velocity = Vector3(xz_velocity.x, y_velocity, xz_velocity.z)
|
||||||
$CollisionShape3D.look_at(Vector3(player.global_transform.origin.x, global_transform.origin.y, player.global_transform.origin.z), Vector3(0,1,0))
|
$CollisionShape3D.look_at(Vector3(player.global_transform.origin.x, global_transform.origin.y, player.global_transform.origin.z), Vector3(0,1,0))
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue