bullet physics seem better, need to figure out collisions and collision points

This commit is contained in:
derek
2024-10-23 11:32:18 -05:00
parent 9e644fe79f
commit d5300779a0
4 changed files with 35 additions and 29 deletions

View File

@@ -21,7 +21,7 @@ var player_velocity
func _ready():
visible = false
linear_velocity += transform.basis * Vector3(0, 0, -bullet_speed)
linear_velocity += transform.basis * Vector3(0, 0, -bullet_speed) + player_velocity
# Called every frame. 'delta' is the elapsed time since the previous frame.
@@ -33,10 +33,11 @@ func _physics_process(delta):
visible = true
func _on_body_entered(body: Node) -> void:
if body.is_in_group("testtest"):
if !body.is_in_group("player"):
mesh.visible = false
#bullethole effect
@@ -47,9 +48,9 @@ func _on_body_entered(body: Node) -> void:
#else:
#instance_bullethole.look_at(body.get_collision_point() + body.get_collision_normal())
#move rigidbodies
if body.is_in_group("scene_rigidbody"):
body.linear_velocity += transform.basis * Vector3(0,0,-1 * bullet_force_mod)
##move rigidbodies
#if body.is_in_group("scene_rigidbody"):
#body.linear_velocity += transform.basis * Vector3(0,0,-1 * bullet_force_mod)
if body.is_in_group("breakable"):
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)