update to godot 4.2, wip works veh body

This commit is contained in:
ottona 2024-07-23 00:25:52 +02:00
parent aa60d84dd3
commit 5db8c566eb
16 changed files with 359 additions and 157 deletions

View File

@ -0,0 +1,22 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://cnakwks7dmbjs"
path="res://.godot/imported/tcannon.obj-52598f9225655a2d7df3b64869dc6b69.mesh"
[deps]
files=["res://.godot/imported/tcannon.obj-52598f9225655a2d7df3b64869dc6b69.mesh"]
source_file="res://blender/tcannon.obj"
dest_files=["res://.godot/imported/tcannon.obj-52598f9225655a2d7df3b64869dc6b69.mesh", "res://.godot/imported/tcannon.obj-52598f9225655a2d7df3b64869dc6b69.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true
force_disable_mesh_compression=false

22
blender/tround.obj.import Normal file
View File

@ -0,0 +1,22 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://cx4hyqrlto2v2"
path="res://.godot/imported/tround.obj-98d9155042ed36f73c783690616613cf.mesh"
[deps]
files=["res://.godot/imported/tround.obj-98d9155042ed36f73c783690616613cf.mesh"]
source_file="res://blender/tround.obj"
dest_files=["res://.godot/imported/tround.obj-98d9155042ed36f73c783690616613cf.mesh", "res://.godot/imported/tround.obj-98d9155042ed36f73c783690616613cf.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true
force_disable_mesh_compression=false

View File

@ -0,0 +1,22 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://1v4o4i4n63d3"
path="res://.godot/imported/tturret.obj-ff25697d22f53fd0fb82f5bc9d5bdce3.mesh"
[deps]
files=["res://.godot/imported/tturret.obj-ff25697d22f53fd0fb82f5bc9d5bdce3.mesh"]
source_file="res://blender/tturret.obj"
dest_files=["res://.godot/imported/tturret.obj-ff25697d22f53fd0fb82f5bc9d5bdce3.mesh", "res://.godot/imported/tturret.obj-ff25697d22f53fd0fb82f5bc9d5bdce3.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true
force_disable_mesh_compression=false

35
icon.png.import Normal file
View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://blcfqgxdt75uo"
path.s3tc="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View File

@ -1,34 +1,33 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=6 format=3 uid="uid://q8f3450js3f"]
[ext_resource path="res://tank-base.tscn" type="PackedScene" id=1]
[ext_resource path="res://icon.png" type="Texture" id=2]
[ext_resource type="PackedScene" uid="uid://dkh4ideujvyff" path="res://tank-base.tscn" id="1"]
[ext_resource type="Texture2D" uid="uid://blcfqgxdt75uo" path="res://icon.png" id="1_gaudu"]
[sub_resource type="PlaneShape" id=1]
[sub_resource type="WorldBoundaryShape3D" id="1"]
[sub_resource type="PlaneMesh" id=2]
size = Vector2( 2000, 2000 )
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_t0k4c"]
albedo_texture = ExtResource("1_gaudu")
uv1_triplanar = true
[sub_resource type="PlaneMesh" id="2"]
material = SubResource("StandardMaterial3D_t0k4c")
size = Vector2(2000, 2000)
subdivide_width = 10
subdivide_depth = 10
[sub_resource type="SpatialMaterial" id=3]
albedo_texture = ExtResource( 2 )
uv1_scale = Vector3( 2000, 2000, 1 )
[node name="Node3D" type="Node3D"]
[node name="Spatial" type="Spatial"]
[node name="Ground" type="StaticBody3D" parent="."]
[node name="Ground" type="StaticBody" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground"]
shape = SubResource("1")
[node name="CollisionShape" type="CollisionShape" parent="Ground"]
shape = SubResource( 1 )
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground"]
mesh = SubResource("2")
[node name="MeshInstance" type="MeshInstance" parent="Ground"]
mesh = SubResource( 2 )
material/0 = SubResource( 3 )
[node name="Sun" type="DirectionalLight" parent="."]
transform = Transform( -1, 0, -8.74228e-08, -5.82212e-08, 0.745976, 0.665973, 6.52153e-08, 0.665973, -0.745976, 0, 2.57678, 0 )
[node name="Sun" type="DirectionalLight3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, -5.82212e-08, 0.745976, 0.665973, 6.52153e-08, 0.665973, -0.745976, 0, 2.57678, 0)
light_color = Color(1, 0.388235, 1, 1)
directional_shadow_max_distance = 200.0
[node name="Tank" type="Spatial" parent="."]
[node name="Spatial" parent="Tank" instance=ExtResource( 1 )]
[node name="tank" parent="." instance=ExtResource("1")]

22
models/tbody.obj.import Normal file
View File

@ -0,0 +1,22 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://b50bramgbkeue"
path="res://.godot/imported/tbody.obj-981012dd1c01a8ea637f79ae2486fba1.mesh"
[deps]
files=["res://.godot/imported/tbody.obj-981012dd1c01a8ea637f79ae2486fba1.mesh"]
source_file="res://models/tbody.obj"
dest_files=["res://.godot/imported/tbody.obj-981012dd1c01a8ea637f79ae2486fba1.mesh", "res://.godot/imported/tbody.obj-981012dd1c01a8ea637f79ae2486fba1.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true
force_disable_mesh_compression=false

22
models/tcannon.obj.import Normal file
View File

@ -0,0 +1,22 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://cwpp5y8flclwp"
path="res://.godot/imported/tcannon.obj-2dbcc3667596b5ca5cb98d28ce9e610f.mesh"
[deps]
files=["res://.godot/imported/tcannon.obj-2dbcc3667596b5ca5cb98d28ce9e610f.mesh"]
source_file="res://models/tcannon.obj"
dest_files=["res://.godot/imported/tcannon.obj-2dbcc3667596b5ca5cb98d28ce9e610f.mesh", "res://.godot/imported/tcannon.obj-2dbcc3667596b5ca5cb98d28ce9e610f.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true
force_disable_mesh_compression=false

22
models/tround.obj.import Normal file
View File

@ -0,0 +1,22 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://jwocs7p3hvvx"
path="res://.godot/imported/tround.obj-7ba03cb9585ba0bfd65dc95a8649eed4.mesh"
[deps]
files=["res://.godot/imported/tround.obj-7ba03cb9585ba0bfd65dc95a8649eed4.mesh"]
source_file="res://models/tround.obj"
dest_files=["res://.godot/imported/tround.obj-7ba03cb9585ba0bfd65dc95a8649eed4.mesh", "res://.godot/imported/tround.obj-7ba03cb9585ba0bfd65dc95a8649eed4.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true
force_disable_mesh_compression=false

22
models/tturret.obj.import Normal file
View File

@ -0,0 +1,22 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://c31tpu0utqpej"
path="res://.godot/imported/tturret.obj-76c083a8ac4ac9a4d38b6bee8b4b9fc2.mesh"
[deps]
files=["res://.godot/imported/tturret.obj-76c083a8ac4ac9a4d38b6bee8b4b9fc2.mesh"]
source_file="res://models/tturret.obj"
dest_files=["res://.godot/imported/tturret.obj-76c083a8ac4ac9a4d38b6bee8b4b9fc2.mesh", "res://.godot/imported/tturret.obj-76c083a8ac4ac9a4d38b6bee8b4b9fc2.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true
force_disable_mesh_compression=false

22
models/wheel.obj.import Normal file
View File

@ -0,0 +1,22 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://cgbw2vktqkefj"
path="res://.godot/imported/wheel.obj-5022c7677129425bb8dc33cd7819833a.mesh"
[deps]
files=["res://.godot/imported/wheel.obj-5022c7677129425bb8dc33cd7819833a.mesh"]
source_file="res://models/wheel.obj"
dest_files=["res://.godot/imported/wheel.obj-5022c7677129425bb8dc33cd7819833a.mesh", "res://.godot/imported/wheel.obj-5022c7677129425bb8dc33cd7819833a.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true
force_disable_mesh_compression=false

View File

@ -6,27 +6,40 @@
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
config_version=5
[application]
config/name="Godot3 Tank Test"
run/main_scene="res://map.tscn"
config/features=PackedStringArray("4.2")
config/icon="res://icon.png"
[input]
ui_up={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
]
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
]
}
vehicle_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
]
}
vehicle_right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
]
}
vehicle_accel={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
]
}
vehicle_decel={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
]
}
[rendering]
environment/default_environment="res://default_env.tres"

View File

@ -1,10 +1,10 @@
extends VehicleBody
extends VehicleBody3D
# Member variables
var shotscene = preload("res://tank-round.tscn")
const STEER_SPEED = .35
const STEER_LIMIT = .4
@export var STEER_SPEED = 2.5
@export var STEER_LIMIT = .8
var steer_angle = 0
var steer_target = 0
@ -12,41 +12,8 @@ var view_sensitivity = 0.1;
func _process(delta):
if (Input.is_action_pressed("ui_left")):
steer_target = STEER_LIMIT
print("left")
elif (Input.is_action_pressed("ui_right")):
steer_target = -STEER_LIMIT
print("right")
else:
steer_target = 0
if (Input.is_action_pressed("ui_up")):
set_engine_force(50)
print("accel")
else:
set_engine_force(0)
if (Input.is_action_pressed("ui_down")):
#set_brake(1)
set_engine_force(-50)
print("decel")
#if (Input.is_action_pressed("driver_break")):
# set_brake(1.0)
#else:
# set_brake(0.0)
if (steer_target < steer_angle):
steer_angle -= STEER_SPEED*delta
if (steer_target > steer_angle):
steer_angle = steer_target
elif (steer_target > steer_angle):
steer_angle += STEER_SPEED*delta
if (steer_target < steer_angle):
steer_angle = steer_target
set_steering(steer_angle)
steering = move_toward(steering, Input.get_axis("ui_left", "ui_right") * STEER_LIMIT, delta * STEER_SPEED)
engine_force = Input.get_axis("ui_down", "ui_up") * 300
func _enter_tree():
#Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED);
@ -57,24 +24,22 @@ func _ready():
func _input(ie):
if ie is InputEventMouseMotion:
var turret = get_node("Turret")
var cannon = get_node("Turret/Cannon")
var plus_pitch = view_sensitivity * -ie.relative.y
var plus_yaw = fmod(view_sensitivity * -ie.relative.x,360)
var can_rot = cannon.get_rotation()
can_rot.z -= deg2rad(plus_pitch)
var can_elev = rad2deg(can_rot.z)
var can_rot = $turret_cshape/cannon_mesh.get_rotation()
can_rot.z -= deg_to_rad(plus_pitch)
var can_elev = rad_to_deg(can_rot.z)
#if can_elev < 7 and can_elev > -30:
cannon.set_rotation(can_rot)
$turret_cshape/cannon_mesh.set_rotation(can_rot)
#print(cannon.get_global_transform().get_rotation())
turret.rotate(Vector3(0,1,0), deg2rad(plus_yaw))
$turret_cshape.rotate(Vector3(0,1,0), deg_to_rad(plus_yaw))
elif ie is InputEventMouseButton:
if ie.button_index == BUTTON_LEFT and ie.is_pressed():
var shot = shotscene.instance()
if ie.button_index == MOUSE_BUTTON_LEFT and ie.is_pressed():
var shot = shotscene.instantiate()
get_parent().add_child(shot)
var shot_dir = get_node("Turret/Cannon/Aimpoint").get_global_transform().origin - get_node("Turret/Cannon").get_global_transform().origin
shot.set_transform(get_node("Turret/Cannon/Aimpoint").get_global_transform())
var shot_dir = $turret_cshape/cannon_mesh/Aimpoint.get_global_transform().origin - $turret_cshape/cannon_mesh.get_global_transform().origin
shot.set_transform($turret_cshape/cannon_mesh/Aimpoint.get_global_transform())
shot.set_linear_velocity(shot_dir.normalized() * 100.0)
#shot.set_linear_velocity(shot.get_rotation().normalized() * 10)
#shot.connect("body_enter", self, "shot_hit")

View File

@ -1,86 +1,100 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=8 format=3 uid="uid://dkh4ideujvyff"]
[ext_resource path="res://models/tbody.obj" type="ArrayMesh" id=1]
[ext_resource path="res://models/wheel.obj" type="ArrayMesh" id=2]
[ext_resource path="res://models/tturret.obj" type="ArrayMesh" id=3]
[ext_resource path="res://models/tcannon.obj" type="ArrayMesh" id=4]
[ext_resource path="res://tank-base.gd" type="Script" id=5]
[ext_resource type="ArrayMesh" uid="uid://b50bramgbkeue" path="res://models/tbody.obj" id="1"]
[ext_resource type="ArrayMesh" uid="uid://cgbw2vktqkefj" path="res://models/wheel.obj" id="2"]
[ext_resource type="ArrayMesh" uid="uid://c31tpu0utqpej" path="res://models/tturret.obj" id="3"]
[ext_resource type="ArrayMesh" uid="uid://cwpp5y8flclwp" path="res://models/tcannon.obj" id="4"]
[ext_resource type="Script" path="res://tank-base.gd" id="5"]
[sub_resource type="BoxShape" id=1]
extents = Vector3( 2.65981, 0.569, 1.02308 )
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_v0qos"]
points = PackedVector3Array(-2.5, -0.250026, -1, -2.04167, -0.650746, -0.492762, -2.5, -0.250026, 0.999979, -2.5, 0.249958, -1, 2.49971, -0.250026, -1, 1.62393, -0.650746, -0.492762, -2.04167, -0.650746, 0.49, -2.5, 0.249958, 0.999979, 2.49971, -0.250026, 0.999979, -2.19291, 0.520238, -0.877253, 2.49971, 0.249958, -1, 2.71994, -0.110759, -0.44284, 1.62393, -0.650746, 0.49, -2.19291, 0.520238, 0.877036, 2.49971, 0.249958, 0.999979, 2.71994, -0.110759, 0.442624, 1.42108, 0.520238, -0.877253, 2.71994, 0.110577, -0.44284, 1.42108, 0.520238, 0.877036, 2.71994, 0.110577, 0.442624)
[sub_resource type="CylinderShape" id=2]
height = 1.01006
radius = 0.790229
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_cn3u7"]
points = PackedVector3Array(-0.000146806, 0, -0.75, -0.146388, 0, -0.735611, -0.000146806, 0.274372, -0.75, 0.146241, 0, -0.735611, -0.146388, 0.274372, -0.735611, -0.28705, 0, -0.693031, -0.000146806, 0.48824, -0.58805, 0.146241, 0.274372, -0.735611, 0.286903, 0, -0.693031, -0.28705, 0.274372, -0.693031, -0.225088, 0.48824, -0.543414, -0.11482, 0.48824, -0.576744, -0.416699, 0, -0.623729, 0.114673, 0.48824, -0.576744, 0.224941, 0.48824, -0.543414, 0.286903, 0.274372, -0.693031, 0.416552, 0, -0.623729, -0.416699, 0.274372, -0.623729, -0.32684, 0.48824, -0.488941, -0.530345, 0, -0.530346, 0.326547, 0.48824, -0.488941, 0.416552, 0.274372, -0.623729, 0.530198, 0, -0.530346, -0.530345, 0.274372, -0.530346, -0.415818, 0.48824, -0.415821, -0.623728, 0, -0.416702, 0.415671, 0.48824, -0.415821, 0.530198, 0.274372, -0.530346, 0.623581, 0, -0.416702, -0.623728, 0.274372, -0.416702, -0.488939, 0.48824, -0.326697, -0.693031, 0, -0.287054, 0.488792, 0.48824, -0.326697, 0.623581, 0.274372, -0.416702, 0.692884, 0, -0.287054, -0.693031, 0.274372, -0.287054, -0.543412, 0.48824, -0.225093, -0.735611, 0, -0.146393, 0.543119, 0.48824, -0.225093, 0.692884, 0.274372, -0.287054, 0.735464, 0, -0.146393, -0.735611, 0.274372, -0.146393, -0.576742, 0.48824, -0.114825, -0.75, 0, -6.4373e-06, 0.576596, 0.48824, -0.114825, 0.735464, 0.274372, -0.146393, 0.75, 0, -6.4373e-06, -0.75, 0.274372, -6.4373e-06, -0.588048, 0.48824, -6.4373e-06, -0.735611, 0, 0.146233, 0.587901, 0.48824, -6.4373e-06, 0.75, 0.274372, -6.4373e-06, 0.735464, 0, 0.146233, -0.735611, 0.274372, 0.146233, -0.576742, 0.48824, 0.114666, -0.693031, 0, 0.286894, 0.576596, 0.48824, 0.114666, 0.735464, 0.274372, 0.146233, 0.692884, 0, 0.286894, -0.693031, 0.274372, 0.286894, -0.543412, 0.48824, 0.224933, -0.623728, 0, 0.416542, 0.543119, 0.48824, 0.224933, 0.692884, 0.274372, 0.286894, 0.623581, 0, 0.416542, -0.623728, 0.274372, 0.416542, -0.488939, 0.48824, 0.326537, -0.530345, 0, 0.530187, 0.623581, 0.274372, 0.416542, 0.488792, 0.48824, 0.326537, 0.530198, 0, 0.530187, -0.530345, 0.274372, 0.530187, -0.415818, 0.48824, 0.415661, -0.416699, 0, 0.623569, 0.415671, 0.48824, 0.415661, 0.530198, 0.274372, 0.530187, 0.416552, 0, 0.623569, -0.416699, 0.274372, 0.623569, -0.32684, 0.48824, 0.488781, -0.28705, 0, 0.692871, 0.326547, 0.48824, 0.488781, 0.416552, 0.274372, 0.623569, 0.286903, 0, 0.692871, -0.28705, 0.274372, 0.692871, -0.225088, 0.48824, 0.543108, -0.146388, 0, 0.735451, 0.224941, 0.48824, 0.543108, 0.286903, 0.274372, 0.692871, 0.146241, 0, 0.735451, -0.146388, 0.274372, 0.735451, -0.11482, 0.48824, 0.576584, -0.000146806, 0, 0.749987, 0.114673, 0.48824, 0.576584, 0.146241, 0.274372, 0.735451, -0.000146806, 0.274372, 0.749987, -0.000146806, 0.48824, 0.58789)
[node name="Spatial" type="Spatial"]
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 1.1205, 0 )
[node name="TankBody" type="VehicleBody" parent="."]
[node name="tank" type="VehicleBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4629, 0)
mass = 200.0
engine_force = 40.0
script = ExtResource( 5 )
brake = 100.0
script = ExtResource("5")
STEER_SPEED = 2.015
STEER_LIMIT = 0.67
[node name="CollisionShape" type="CollisionShape" parent="TankBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.134326, 0, -0.00275861 )
shape = SubResource( 1 )
[node name="body_cshape" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00692177, 0, -0.00248563)
shape = SubResource("ConvexPolygonShape3D_v0qos")
[node name="MeshInstance" type="MeshInstance" parent="TankBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00692177, 0, -0.00248563 )
mesh = ExtResource( 1 )
[node name="body_mesh" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00692177, 0, -0.00248563)
mesh = ExtResource("1")
[node name="Turret" type="MeshInstance" parent="TankBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.523891, 0 )
mesh = ExtResource( 3 )
[node name="turret_cshape" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.523891, 0)
shape = SubResource("ConvexPolygonShape3D_cn3u7")
[node name="Cannon" type="MeshInstance" parent="TankBody/Turret"]
transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0.161056, 0 )
mesh = ExtResource( 4 )
[node name="turret_mesh" type="MeshInstance3D" parent="turret_cshape"]
mesh = ExtResource("3")
skeleton = NodePath("../..")
[node name="Camera" type="InterpolatedCamera" parent="TankBody/Turret/Cannon"]
transform = Transform( -4.37114e-08, -0.0903545, 0.99591, 0, 0.99591, 0.0903545, -1, 3.94952e-09, -4.35326e-08, 0, 0.616, 0 )
[node name="cannon_mesh" type="MeshInstance3D" parent="turret_cshape"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0.161056, 0)
mesh = ExtResource("4")
skeleton = NodePath("../turret_mesh")
[node name="Camera3D" type="Camera3D" parent="turret_cshape/cannon_mesh"]
transform = Transform3D(-4.37114e-08, -0.0903545, 0.99591, 0, 0.99591, 0.0903545, -1, 3.94952e-09, -4.35326e-08, 4.59888, 0.616, 2.01023e-07)
current = true
fov = 60.0
near = 0.1
[node name="Aimpoint" type="Spatial" parent="TankBody/Turret/Cannon"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 0, 0 )
[node name="Aimpoint" type="Node3D" parent="turret_cshape/cannon_mesh"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 0, 0)
[node name="CollisionShape" type="CollisionShape" parent="TankBody/Turret"]
shape = SubResource( 2 )
[node name="Wheel FrontLeft" type="VehicleWheel" parent="TankBody"]
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.04618, -0.957658, -0.968059 )
use_as_traction = true
[node name="Wheel FrontLeft" type="VehicleWheel3D" parent="."]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.04618, -0.957658, -0.968059)
engine_force = 400.0
brake = 100.0
use_as_steering = true
suspension_stiffness = 7.805
[node name="MeshInstance" type="MeshInstance" parent="TankBody/Wheel FrontLeft"]
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0 )
mesh = ExtResource( 2 )
[node name="fl_wheel_mesh" type="MeshInstance3D" parent="Wheel FrontLeft"]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, -5.96046e-08, 0)
mesh = ExtResource("2")
[node name="Wheel FrontRight" type="VehicleWheel" parent="TankBody"]
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.04618, -0.957658, 0.954998 )
use_as_traction = true
[node name="Wheel FrontRight" type="VehicleWheel3D" parent="."]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 1.04618, -0.957658, 0.954998)
engine_force = 400.0
brake = 100.0
use_as_steering = true
suspension_stiffness = 7.805
[node name="MeshInstance" type="MeshInstance" parent="TankBody/Wheel FrontRight"]
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 )
mesh = ExtResource( 2 )
[node name="fr_wheel_mesh" type="MeshInstance3D" parent="Wheel FrontRight"]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0)
mesh = ExtResource("2")
[node name="Wheel BackLeft" type="VehicleWheel" parent="TankBody"]
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.36479, -0.957658, -0.968059 )
[node name="Wheel BackLeft" type="VehicleWheel3D" parent="."]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.36479, -0.957658, -0.968059)
engine_force = 40.0
brake = 100.0
use_as_traction = true
[node name="MeshInstance" type="MeshInstance" parent="TankBody/Wheel BackLeft"]
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0 )
mesh = ExtResource( 2 )
[node name="MeshInstance3D" type="MeshInstance3D" parent="Wheel BackLeft"]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0)
mesh = ExtResource("2")
[node name="Wheel BackRight" type="VehicleWheel" parent="TankBody"]
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.3645, -0.957658, 0.954998 )
[node name="Wheel BackRight" type="VehicleWheel3D" parent="."]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.3645, -0.957658, 0.954998)
engine_force = 40.0
brake = 100.0
use_as_traction = true
[node name="MeshInstance" type="MeshInstance" parent="TankBody/Wheel BackRight"]
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 )
mesh = ExtResource( 2 )
[node name="MeshInstance3D" type="MeshInstance3D" parent="Wheel BackRight"]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0)
mesh = ExtResource("2")
[node name="Camera" type="Camera" parent="TankBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.74436e-07, 0, 8.56609 )
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.74436e-07, 0, 8.56609)
[node name="Node3D" type="Node3D" parent="."]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 1.61282, 0)

View File

@ -1,4 +1,4 @@
extends RigidBody
extends RigidBody3D
var life_span = 0
@ -6,7 +6,7 @@ func _ready():
set_contact_monitor(true)
set_max_contacts_reported(5)
set_fixed_process(true)
connect("body_enter", self, "on_hit")
connect("body_enter", Callable(self, "on_hit"))
func _fixed_process(delta):
life_span += delta

View File

@ -2,15 +2,15 @@
[ext_resource path="res://models/tround.obj" type="ArrayMesh" id=1]
[sub_resource type="CapsuleShape" id=1]
[sub_resource type="CapsuleShape3D" id=1]
radius = 0.0575807
height = 0.184025
[node name="RigidBody" type="RigidBody"]
[node name="RigidBody3D" type="RigidBody3D"]
[node name="MeshInstance" type="MeshInstance" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = ExtResource( 1 )
material/0 = null
[node name="CollisionShape" type="CollisionShape" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource( 1 )

View File

@ -2,10 +2,10 @@
[ext_resource path="res://rock01.msh" type="Mesh" id=1]
[node name="MeshInstance" type="MeshInstance"]
[node name="MeshInstance3D" type="MeshInstance3D"]
_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 0.986554, 0.163435, 0, -0.163435, 0.986554, 0, 0, 0, 1, 0, 0, 0 )
_import_transform = Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform3D( 0.986554, 0.163435, 0, -0.163435, 0.986554, 0, 0, 0, 1, 0, 0, 0 )
layers = 1
geometry/visible = true
geometry/material_override = null
@ -24,10 +24,10 @@ mesh/mesh = ExtResource( 1 )
mesh/skeleton = NodePath("..")
material/0 = null
[node name="OmniLight" type="OmniLight" parent="."]
[node name="OmniLight3D" type="OmniLight3D" parent="."]
_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -13.0938, 7.65127, 0 )
_import_transform = Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, -13.0938, 7.65127, 0 )
layers = 1
params/enabled = true
params/editor_only = false
@ -46,10 +46,10 @@ operator = 0
params/radius = 2.0
params/attenuation = 1.0
[node name="Camera" type="Camera" parent="."]
[node name="Camera3D" type="Camera3D" parent="."]
_import_transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform( 0.11797, 0, -0.993017, 1.86265e-09, 1, 1.49012e-08, 0.993017, 0, 0.11797, -8.8291, 7.63259, 1.75589 )
_import_transform = Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
transform/local = Transform3D( 0.11797, 0, -0.993017, 1.86265e-09, 1, 1.49012e-08, 0.993017, 0, 0.11797, -8.8291, 7.63259, 1.75589 )
projection = 0
fov = 60.0
near = 0.1