From f7ec57998a1c3d0cf91c1fb017fd5a91bb1e0b96 Mon Sep 17 00:00:00 2001 From: dusoleil Date: Sun, 9 Oct 2022 04:45:45 -0400 Subject: Rework Buoyancy physics Simplify creating a buoyant object to just extending a class and setting the water plane. Implement a new buoyancy estimation that should be a bit more accurate. --- Main.tscn | 56 +++++++++++--------------------------------------------- 1 file changed, 11 insertions(+), 45 deletions(-) (limited to 'Main.tscn') diff --git a/Main.tscn b/Main.tscn index 42f64d4..24c21f5 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,10 +1,8 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=14 format=2] [ext_resource path="res://character/fps_controller/fps_controller.tscn" type="PackedScene" id=1] [ext_resource path="res://ship/ship/ship.tscn" type="PackedScene" id=2] [ext_resource path="res://water/Water.tscn" type="PackedScene" id=3] -[ext_resource path="res://Float.tscn" type="PackedScene" id=4] -[ext_resource path="res://ship/ship/crate.tscn" type="PackedScene" id=5] [ext_resource path="res://world/World.tscn" type="PackedScene" id=6] [ext_resource path="res://Ship.gd" type="Script" id=7] [ext_resource path="res://FPS.gd" type="Script" id=8] @@ -18,6 +16,9 @@ [sub_resource type="SpatialMaterial" id=21] albedo_color = Color( 0.941176, 0.658824, 0.215686, 1 ) +[sub_resource type="BoxShape" id=23] +extents = Vector3( 10, 5, 55 ) + [sub_resource type="CapsuleShape" id=22] radius = 11.4853 height = 97.7559 @@ -72,12 +73,19 @@ acceleration = 10.0 [node name="ShipRigidBody" type="RigidBody" parent="."] collision_layer = 2 collision_mask = 8 +mass = 10000.0 can_sleep = false axis_lock_linear_x = true axis_lock_linear_z = true linear_damp = 2.0 angular_damp = 2.0 script = ExtResource( 7 ) +water = NodePath("../Water") + +[node name="BuoyancyBounds" type="CollisionShape" parent="ShipRigidBody"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3, 0 ) +shape = SubResource( 23 ) +disabled = true [node name="CollisionShape" type="CollisionShape" parent="ShipRigidBody"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.78898, 0 ) @@ -85,48 +93,6 @@ shape = SubResource( 22 ) [node name="ship" parent="ShipRigidBody" instance=ExtResource( 2 )] -[node name="Float" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -9.77011, -3.30323, 53.0825 ) - -[node name="Float2" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -9.77011, -3.30323, 33.0751 ) - -[node name="Float3" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -9.77011, -3.30323, 15.7992 ) - -[node name="Float4" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -9.77011, -3.30323, 0 ) - -[node name="Float5" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -9.77011, -3.30323, -13.8797 ) - -[node name="Float6" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -9.77011, -3.30323, -28.8669 ) - -[node name="Float7" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -9.77011, -3.30323, -48.8743 ) - -[node name="Float8" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 9.77011, -3.30323, 52.7872 ) - -[node name="Float9" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 9.77011, -3.30323, 33.2966 ) - -[node name="Float10" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 9.77011, -3.30323, 16.0946 ) - -[node name="Float11" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 9.77011, -3.30323, 0 ) - -[node name="Float12" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 9.77011, -3.30323, -14.1012 ) - -[node name="Float13" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 9.77011, -3.30323, -29.0883 ) - -[node name="Float14" parent="ShipRigidBody" instance=ExtResource( 4 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 9.77011, -3.30323, -49.022 ) - [node name="fps_controller" parent="ShipRigidBody" instance=ExtResource( 1 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 17, 44 ) -- cgit v1.2.3