rotated grenade to face the correct way

remotes/1699310152913738325/tmp_refs/heads/legacy
Jan Heemstra 2021-05-03 01:04:32 +02:00
parent ec58bb525f
commit 4d5bf6a8ad
4 changed files with 19 additions and 12 deletions

View File

@ -1,4 +1,8 @@
extends RigidBody
func _process(delta):
# TODO: synchronize position
pass
func explode():
queue_free()

View File

@ -1,28 +1,26 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Assets/Weapons/GrenadeLauncher/Grenade.gd" type="Script" id=1]
[ext_resource path="res://Assets/Weapons/GrenadeLauncher/GrenadeMesh.tscn" type="PackedScene" id=2]
[sub_resource type="PhysicsMaterial" id=3]
friction = 0.3
bounce = 0.7
[sub_resource type="SphereShape" id=1]
radius = 0.1
[sub_resource type="SphereMesh" id=2]
radius = 0.1
height = 0.2
[sub_resource type="CapsuleShape" id=4]
radius = 0.102523
height = 0.105712
[node name="Grenade" type="RigidBody"]
physics_material_override = SubResource( 3 )
script = ExtResource( 1 )
[node name="CollisionShape" type="CollisionShape" parent="."]
shape = SubResource( 1 )
[node name="GrenadeMesh" parent="." instance=ExtResource( 2 )]
transform = Transform( 4.37114e-08, -1, -3.82137e-15, -1, -4.37114e-08, 8.74228e-08, -8.74228e-08, 0, -1, 0, 0, 0 )
[node name="MeshInstance" type="MeshInstance" parent="."]
mesh = SubResource( 2 )
material/0 = null
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 )
shape = SubResource( 4 )
[node name="Timer" type="Timer" parent="."]
wait_time = 2.0

View File

@ -23,6 +23,6 @@ sync func fire_weapon():
var muzzle_transform = $Model/Muzzle.global_transform
grenade_instance.global_transform = muzzle_transform
grenade_instance.linear_velocity = muzzle_transform.basis.y * 40 + player.velocity
grenade_instance.linear_velocity = muzzle_transform.basis.y * 20 + player.velocity
get_tree().root.call_deferred("add_child", grenade_instance)

View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Assets/Weapons/GrenadeLauncher/Grenade.gltf" type="PackedScene" id=1]
[node name="GrenadeMesh" instance=ExtResource( 1 )]