Added tank model for player

This commit is contained in:
Paul Black 2022-03-10 13:28:56 -07:00
parent 46398bd8fa
commit 5437b1c6f3
17 changed files with 66235 additions and 14 deletions

View file

@ -23,7 +23,7 @@ func _physics_process(delta):
if Input.is_action_just_pressed("shoot"):
var b = Bullet.instance()
owner.add_child(b)
b.transform = $CollisionShape/Tank/BulletGenerator.global_transform
b.transform = $CollisionShapeTop/Top_tank/BulletGenerator.global_transform
b.velocity = -b.global_transform.basis.z * b.muzzle_velocity
var space_state = get_world().direct_space_state
@ -33,7 +33,7 @@ func _physics_process(delta):
var intersection = space_state.intersect_ray(rayOrigin, rayEnd) # Set variable for cursor position
if not intersection.empty(): # Make sure there is a intersection with raycast
var pos = intersection.position
$CollisionShape.look_at(Vector3(pos.x, pos.y, pos.z), Vector3(0,1,0))
$CollisionShapeTop.look_at(Vector3(pos.x, pos.y, pos.z), Vector3(0,1,0))
if direction != Vector3.ZERO:
direction = direction.normalized()

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,13 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Objects/Player-tank/Player.gd" type="Script" id=1]
[ext_resource path="res://Objects/Player-tank/model/Bottom_tank.dae" type="PackedScene" id=2]
[ext_resource path="res://Objects/Player-tank/model/Top_tank.dae" type="PackedScene" id=3]
[sub_resource type="BoxShape" id=1]
extents = Vector3( 1.29, 1, 2.428 )
[sub_resource type="CubeMesh" id=2]
[sub_resource type="SpatialMaterial" id=3]
albedo_color = Color( 1, 0, 0, 1 )
[sub_resource type="BoxShape" id=2]
[node name="PlayerTank" type="KinematicBody"]
script = ExtResource( 1 )
@ -15,13 +15,18 @@ script = ExtResource( 1 )
[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 20.7405, -7.28392e-07 )
[node name="CollisionShape" type="CollisionShape" parent="." groups=["player", "tank"]]
[node name="CollisionShapeBottom" type="CollisionShape" parent="." groups=["player", "tank"]]
shape = SubResource( 1 )
[node name="Tank" type="MeshInstance" parent="CollisionShape" groups=["tank"]]
mesh = SubResource( 2 )
skeleton = NodePath("../..")
material/0 = SubResource( 3 )
[node name="Bottom_tank" parent="CollisionShapeBottom" instance=ExtResource( 2 )]
transform = Transform( -1.44248e-06, 0, 33, 0, 33, 0, -33, 0, -1.44248e-06, 0, -1.90625, 0 )
[node name="BulletGenerator" type="Position3D" parent="CollisionShape/Tank"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0032903, 0.375606, -1.3599 )
[node name="CollisionShapeTop" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.572825, 0 )
shape = SubResource( 2 )
[node name="Top_tank" parent="CollisionShapeTop" instance=ExtResource( 3 )]
transform = Transform( -1.44248e-06, 0, 33, 0, 33, 0, -33, 0, -1.44248e-06, 0, -2.74403, 0 )
[node name="BulletGenerator" type="Position3D" parent="CollisionShapeTop/Top_tank"]
transform = Transform( -1.32459e-09, 0, -0.030303, 0, 0.030303, 0, 0.030303, 0, -1.32459e-09, 0.124162, 0.0831104, -9.97006e-05 )