switched flight controls to controller, started working on acceleration gizmo
parent
7cdb194810
commit
fe3e33865d
|
@ -0,0 +1,10 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://doj16325e56qm"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cywlxpcb22pgp" path="res://General/T_TestGrid.png" id="1_78t2d"]
|
||||
[ext_resource type="Shader" path="res://General/S_TestGridUV.gdshader" id="1_iaos4"]
|
||||
|
||||
[resource]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_iaos4")
|
||||
shader_parameter/uv_scale = Vector2(100, 100)
|
||||
shader_parameter/albedo = ExtResource("1_78t2d")
|
|
@ -1,6 +1,6 @@
|
|||
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://bts702ltutin6"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cywlxpcb22pgp" path="res://Environment/T_TestGrid.png" id="1_uabna"]
|
||||
[ext_resource type="Texture2D" uid="uid://cywlxpcb22pgp" path="res://General/T_TestGrid.png" id="1_uabna"]
|
||||
|
||||
[resource]
|
||||
albedo_texture = ExtResource("1_uabna")
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://byqft1h0ys7v8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dy766wl2cvjf" path="res://General/SM_CubeSphere.blend" id="1_4o3hn"]
|
||||
[ext_resource type="Material" uid="uid://doj16325e56qm" path="res://General/M_TestGridUV.tres" id="2_julkn"]
|
||||
|
||||
[node name="SM_CubeSphere" instance=ExtResource("1_4o3hn")]
|
||||
|
||||
[node name="Cube" parent="." index="0"]
|
||||
surface_material_override/0 = ExtResource("2_julkn")
|
Binary file not shown.
|
@ -0,0 +1,48 @@
|
|||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dy766wl2cvjf"
|
||||
path="res://.godot/imported/SM_CubeSphere.blend-0ed41a56b53a9ddf3c0b514354d012ea.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://General/SM_CubeSphere.blend"
|
||||
dest_files=["res://.godot/imported/SM_CubeSphere.blend-0ed41a56b53a9ddf3c0b514354d012ea.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type="Node3D"
|
||||
nodes/root_name="Scene Root"
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/embedded_image_handling=1
|
||||
blender/nodes/visible=0
|
||||
blender/nodes/punctual_lights=true
|
||||
blender/nodes/cameras=true
|
||||
blender/nodes/custom_properties=true
|
||||
blender/nodes/modifiers=1
|
||||
blender/meshes/colors=false
|
||||
blender/meshes/uvs=true
|
||||
blender/meshes/normals=true
|
||||
blender/meshes/tangents=true
|
||||
blender/meshes/skins=2
|
||||
blender/meshes/export_bones_deforming_mesh_only=false
|
||||
blender/materials/unpack_enabled=true
|
||||
blender/materials/export_materials=1
|
||||
blender/animation/limit_playback=true
|
||||
blender/animation/always_sample=true
|
||||
blender/animation/group_tracks=true
|
Binary file not shown.
|
@ -0,0 +1,8 @@
|
|||
shader_type spatial;
|
||||
|
||||
uniform sampler2D albedo : source_color,filter_nearest_mipmap_anisotropic;
|
||||
uniform vec2 uv_scale;
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = texture(albedo, UV * uv_scale).xyz;
|
||||
}
|
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 197 B |
|
@ -3,15 +3,15 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cywlxpcb22pgp"
|
||||
path="res://.godot/imported/T_TestGrid.png-ebd533d215a8ac8ec541cf0294a0054c.ctex"
|
||||
path="res://.godot/imported/T_TestGrid.png-393ac48eeed82835ca57c5131d7d9a96.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Planetside/Environment/T_TestGrid.png"
|
||||
dest_files=["res://.godot/imported/T_TestGrid.png-ebd533d215a8ac8ec541cf0294a0054c.ctex"]
|
||||
source_file="res://General/T_TestGrid.png"
|
||||
dest_files=["res://.godot/imported/T_TestGrid.png-393ac48eeed82835ca57c5131d7d9a96.ctex"]
|
||||
|
||||
[params]
|
||||
|
|
@ -1,8 +1,14 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://mffl7glgme2h"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://mffl7glgme2h"]
|
||||
|
||||
[ext_resource type="Script" path="res://Spaceflight/Scripts/FlightController.cs" id="1_t3b02"]
|
||||
[ext_resource type="PackedScene" uid="uid://diixaewdb6uws" path="res://Spaceflight/UI/SK_Axes.blend" id="2_h1fcl"]
|
||||
|
||||
[node name="SpacePlayer" type="Node3D"]
|
||||
script = ExtResource("1_t3b02")
|
||||
|
||||
[node name="MainCamera" type="Camera3D" parent="."]
|
||||
|
||||
[node name="CockpitBase" type="Node3D" parent="."]
|
||||
|
||||
[node name="SK_Axes" parent="CockpitBase" instance=ExtResource("2_h1fcl")]
|
||||
transform = Transform3D(0.05, 0, 0, 0, 0.05, 0, 0, 0, 0.05, -0.0765332, -0.0404728, -0.0689048)
|
||||
|
|
|
@ -4,25 +4,23 @@ using System;
|
|||
public partial class FlightController : Node3D {
|
||||
Camera3D PlayerCam;
|
||||
Vector3 AngularVelocity;
|
||||
|
||||
Vector3 LinearVelocity;
|
||||
|
||||
public override void _Ready() {
|
||||
this.PlayerCam = this.GetNode<Camera3D>("MainCamera");
|
||||
this.PlayerCam.Current = true;
|
||||
Input.MouseMode = Input.MouseModeEnum.Hidden;
|
||||
}
|
||||
|
||||
|
||||
public override void _Process(double deltaSeconds) {
|
||||
Vector2 currentMousePos = GetViewport().GetMousePosition();
|
||||
Vector2I center = GetViewport().GetWindow().Size / 2;
|
||||
Vector2 centerFloat = new(center.X, center.Y);
|
||||
Vector2 delta = (currentMousePos - centerFloat) * (float)deltaSeconds;
|
||||
Input.WarpMouse(center);
|
||||
float FlightPitch = Input.GetAxis("FlightPitch-", "FlightPitch+");
|
||||
float FlightYaw = Input.GetAxis("FlightYaw-", "FlightYaw+");
|
||||
float FlightRoll = Input.GetAxis("FlightRoll-", "FlightRoll+");
|
||||
Vector3 FlightSpin = new Vector3(-FlightPitch, FlightYaw, FlightRoll) * (float)deltaSeconds;
|
||||
|
||||
if (delta != Vector2.Zero) {
|
||||
if (FlightSpin != Vector3.Zero) {
|
||||
Quaternion quat = new Quaternion(this.GlobalTransform.Basis);
|
||||
Vector3 LocalAccel = new Vector3(delta.Y, delta.X, 0f) * 3f * (float)deltaSeconds;
|
||||
Vector3 LocalAccel = FlightSpin * 100f * (float)deltaSeconds;
|
||||
if (quat.GetAxis().LengthSquared() != 0f) {
|
||||
this.AngularVelocity -= LocalAccel.Rotated(quat.GetAxis().Normalized(), quat.GetAngle());
|
||||
}
|
||||
|
@ -30,6 +28,7 @@ public partial class FlightController : Node3D {
|
|||
this.AngularVelocity -= LocalAccel;
|
||||
}
|
||||
}
|
||||
|
||||
this.AngularVelocity *= (float)(1.0 - deltaSeconds * 2.0);
|
||||
if (this.AngularVelocity.Length() > 0f) {
|
||||
Quaternion rotationThisFrame = Quaternion.FromEuler(this.AngularVelocity * (float)deltaSeconds);
|
||||
|
@ -37,8 +36,28 @@ public partial class FlightController : Node3D {
|
|||
this.GlobalRotate(rotationThisFrame.GetAxis().Normalized(), rotationThisFrame.GetAngle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float FlightStrafe = Input.GetAxis("FlightStrafe-", "FlightStrafe+");
|
||||
float FlightElevate = Input.GetAxis("FlightElevate-", "FlightElevate+");
|
||||
float FlightThrust = Input.GetAxis("FlightThrust-", "FlightThrust+");
|
||||
Vector3 FlightMovement = new Vector3(FlightStrafe, FlightElevate, -FlightThrust) * (float)deltaSeconds;
|
||||
|
||||
if (FlightMovement != Vector3.Zero) {
|
||||
Quaternion quat = new Quaternion(this.GlobalTransform.Basis);
|
||||
Vector3 LocalAccel = FlightMovement * 100f * (float)deltaSeconds;
|
||||
if (quat.GetAxis().LengthSquared() != 0f) {
|
||||
this.LinearVelocity += LocalAccel.Rotated(quat.GetAxis().Normalized(), quat.GetAngle());
|
||||
}
|
||||
else {
|
||||
this.LinearVelocity += LocalAccel;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.LinearVelocity.Length() > 0f) {
|
||||
Vector3 movementThisFrame = this.LinearVelocity * (float)deltaSeconds;
|
||||
this.GlobalTranslate(movementThisFrame);
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event) {
|
||||
base._Input(@event);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://681x341bmq7u"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://681x341bmq7u"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://mffl7glgme2h" path="res://Spaceflight/Prefabs/SpacePlayer.tscn" id="1_cwxy4"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgqhmlshc8pu" path="res://Spaceflight/Environment/SM_SpaceSkybox.blend" id="2_3sifq"]
|
||||
[ext_resource type="PackedScene" uid="uid://byqft1h0ys7v8" path="res://General/Mesh_CubeSphere.tscn" id="3_bhtq2"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_owpo5"]
|
||||
|
||||
|
@ -14,3 +15,6 @@ environment = SubResource("Environment_owpo5")
|
|||
|
||||
[node name="SM_SpaceSkybox" parent="." instance=ExtResource("2_3sifq")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.221079, 0, 0.640379)
|
||||
|
||||
[node name="SM_CubeSphere" parent="." instance=ExtResource("3_bhtq2")]
|
||||
transform = Transform3D(100, 0, 0, 0, 100, 0, 0, 0, 100, 118.458, 0, -175.593)
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,48 @@
|
|||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://diixaewdb6uws"
|
||||
path="res://.godot/imported/SK_Axes.blend-b853d1f65a4a9ed68cae3f7ded63e8de.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Spaceflight/UI/SK_Axes.blend"
|
||||
dest_files=["res://.godot/imported/SK_Axes.blend-b853d1f65a4a9ed68cae3f7ded63e8de.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type="Node3D"
|
||||
nodes/root_name="Scene Root"
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/embedded_image_handling=1
|
||||
blender/nodes/visible=0
|
||||
blender/nodes/punctual_lights=true
|
||||
blender/nodes/cameras=true
|
||||
blender/nodes/custom_properties=true
|
||||
blender/nodes/modifiers=1
|
||||
blender/meshes/colors=false
|
||||
blender/meshes/uvs=true
|
||||
blender/meshes/normals=true
|
||||
blender/meshes/tangents=true
|
||||
blender/meshes/skins=2
|
||||
blender/meshes/export_bones_deforming_mesh_only=false
|
||||
blender/materials/unpack_enabled=true
|
||||
blender/materials/export_materials=1
|
||||
blender/animation/limit_playback=true
|
||||
blender/animation/always_sample=true
|
||||
blender/animation/group_tracks=true
|
Binary file not shown.
|
@ -17,3 +17,66 @@ config/features=PackedStringArray("4.1", "C#", "Forward Plus")
|
|||
[dotnet]
|
||||
|
||||
project/assembly_name="spes"
|
||||
|
||||
[input]
|
||||
|
||||
FlightPitch+={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
FlightPitch-={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
FlightYaw+={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
FlightYaw-={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
FlightRoll+={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
FlightRoll-={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
FlightThrust+={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
FlightThrust-={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
FlightStrafe+={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
FlightStrafe-={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
FlightElevate+={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
FlightElevate-={
|
||||
"deadzone": 0.33,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue