feature/moving-platforms #6
@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://ewovs6ns5y3k"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://ewovs6ns5y3k"]
|
||||
|
||||
[ext_resource type="Script" path="res://assets/core/networking/NetworkManager.gd" id="1_kki4t"]
|
||||
[ext_resource type="Texture2D" uid="uid://gymb0tju4y67" path="res://addons/kennysprototypetextures/Dark/texture_black (1).png" id="1_l0osb"]
|
||||
[ext_resource type="PackedScene" uid="uid://c6w0ivy4hetrl" path="res://assets/core/player-controller/scenes/player.tscn" id="2_q510b"]
|
||||
[ext_resource type="PackedScene" uid="uid://c7mtmmke1anxp" path="res://assets/core/ships/test-ship.tscn" id="4_feinw"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_yg2er"]
|
||||
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
@ -53,3 +54,6 @@ shape = SubResource("WorldBoundaryShape3D_4238x")
|
||||
[node name="Player" parent="." instance=ExtResource("2_q510b")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
joystick_camera_sens_multiplier = 5.0
|
||||
|
||||
[node name="TestShip" parent="." instance=ExtResource("4_feinw")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.24218, 0.563903, 0)
|
||||
|
@ -10,11 +10,6 @@ radius = 0.35
|
||||
|
||||
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("camera")]
|
||||
script = ExtResource("1_bv7t4")
|
||||
speed = null
|
||||
acceleration = null
|
||||
jump_height = null
|
||||
camera_sens = null
|
||||
joystick_camera_sens_multiplier = null
|
||||
camera = NodePath("Neck/Camera3D")
|
||||
|
||||
[node name="PlayerTag" type="Label3D" parent="."]
|
||||
|
@ -23,6 +23,8 @@ var walk_vel: Vector3 # Walking velocity
|
||||
var grav_vel: Vector3 # Gravity velocity
|
||||
var jump_vel: Vector3 # Jumping velocity
|
||||
|
||||
var current_ship: Ship
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
capture_mouse()
|
||||
@ -59,6 +61,9 @@ func _input(event):
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if current_ship != null:
|
||||
global_transform.basis = current_ship.global_transform.basis
|
||||
|
||||
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
_handle_joypad_camera_rotation(delta)
|
||||
velocity = _walk(delta) + _gravity(delta) + _jump(delta)
|
||||
@ -111,3 +116,15 @@ func _jump(delta: float) -> Vector3:
|
||||
return jump_vel
|
||||
jump_vel = Vector3.ZERO if is_on_floor() else jump_vel.move_toward(Vector3.ZERO, gravity * delta)
|
||||
return jump_vel
|
||||
|
||||
|
||||
func player_entered_ship(ship_global_position: Vector3, ship: Ship):
|
||||
current_ship = ship
|
||||
print(ship.ship_id)
|
||||
print(global_position)
|
||||
|
||||
|
||||
func player_exited_ship(ship_global_position: Vector3, ship: Ship):
|
||||
current_ship = null
|
||||
print(ship.ship_id)
|
||||
print(global_position)
|
||||
|
41
assets/core/ships/test-ship.tscn
Normal file
41
assets/core/ships/test-ship.tscn
Normal file
@ -0,0 +1,41 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://c7mtmmke1anxp"]
|
||||
|
||||
[ext_resource type="Script" path="res://assets/core/ships/test_ship.gd" id="1_yql7r"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_tkeg5"]
|
||||
size = Vector3(5, 0.25, 10)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_fs34p"]
|
||||
size = Vector3(5, 0.25, 10)
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_oqio3"]
|
||||
radius = 1.401
|
||||
height = 7.405
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_7jr0u"]
|
||||
size = Vector3(5.14063, 6.07324, 10.1924)
|
||||
|
||||
[node name="TestShip" type="RigidBody3D" node_paths=PackedStringArray("ship_area")]
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource("1_yql7r")
|
||||
ship_area = NodePath("Area3D")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("BoxMesh_tkeg5")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("BoxShape3D_fs34p")
|
||||
|
||||
[node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 5.12542, 0)
|
||||
mesh = SubResource("CapsuleMesh_oqio3")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.99997, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
||||
shape = SubResource("BoxShape3D_7jr0u")
|
||||
|
||||
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]
|
||||
[connection signal="body_exited" from="Area3D" to="." method="_on_area_3d_body_exited"]
|
21
assets/core/ships/test_ship.gd
Normal file
21
assets/core/ships/test_ship.gd
Normal file
@ -0,0 +1,21 @@
|
||||
class_name Ship
|
||||
|
||||
extends RigidBody3D
|
||||
|
||||
@export var ship_area: Area3D
|
||||
|
||||
var ship_id: String = "1a"
|
||||
|
||||
func _physics_process(delta):
|
||||
global_rotation.x = lerpf(global_rotation.x, 0, 0.01)
|
||||
global_rotation.z = lerpf(global_rotation.z, 0, 0.01)
|
||||
|
||||
|
||||
func _on_area_3d_body_entered(body):
|
||||
if body is Player:
|
||||
body.player_entered_ship(global_position, self)
|
||||
|
||||
|
||||
func _on_area_3d_body_exited(body):
|
||||
if body is Player:
|
||||
body.player_exited_ship(global_position, self)
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user