Grenade bounce and radius
This commit is contained in:
parent
f99108c4f0
commit
11eb875d2e
6 changed files with 28 additions and 16 deletions
|
|
@ -3,12 +3,17 @@ extends CharacterBody3D
|
|||
func _physics_process(delta: float) -> void:
|
||||
if is_multiplayer_authority() == false:
|
||||
return
|
||||
|
||||
velocity += get_gravity() * delta / 4
|
||||
|
||||
if is_on_floor():
|
||||
var fire: Node3D = preload("res://weapons/molikman/molik/molikman_molotov_fire.tscn").instantiate()
|
||||
Session.dynamic_objects_parent.add_child(fire,true)
|
||||
fire.global_position = global_position
|
||||
queue_free()
|
||||
|
||||
move_and_slide()
|
||||
var collision = move_and_collide(velocity * delta)
|
||||
if collision:
|
||||
if collision.get_normal().y > 0:
|
||||
var fire: Node3D = preload("res://weapons/molikman/molik/molikman_molotov_fire.tscn").instantiate()
|
||||
Session.dynamic_objects_parent.add_child(fire,true)
|
||||
fire.global_position = global_position
|
||||
queue_free()
|
||||
else:
|
||||
var normal = collision.get_normal()
|
||||
velocity = velocity.bounce(normal) * 0.5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue