This commit is contained in:
PajamaBee 2025-07-19 20:18:32 -05:00
parent 8f4b0602fd
commit 23d6a5b516
21 changed files with 425 additions and 0 deletions

27
objects/Guitar.tscn Normal file

File diff suppressed because one or more lines are too long

26
objects/Rotatable.gd Normal file
View file

@ -0,0 +1,26 @@
extends RigidBody3D
@export var initialMass:float = 3
@export var yTorqueMult:float = 100
@export var zTorqueMult:float = 100
var prev_mouse_position
var next_mouse_position
func _ready() -> void:
mass = initialMass
func _process(delta):
if GlobalVariables.selectedObject == self:
next_mouse_position = get_viewport().get_mouse_position()
var torque = Vector3()
torque.y = (next_mouse_position.x - prev_mouse_position.x) * yTorqueMult * delta
torque.z = (next_mouse_position.y - prev_mouse_position.y) * zTorqueMult * delta
prev_mouse_position = next_mouse_position
apply_torque(torque)
func _on_input_event(camera: Node, event: InputEvent, event_position: Vector3, normal: Vector3, shape_idx: int) -> void:
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
prev_mouse_position = get_viewport().get_mouse_position()
GlobalVariables.selectedObject = self

1
objects/Rotatable.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://cvqlceaui3krb

27
objects/Rotatable.tscn Normal file
View file

@ -0,0 +1,27 @@
[gd_scene load_steps=5 format=3 uid="uid://du8lkrvnc16gl"]
[ext_resource type="Script" uid="uid://cvqlceaui3krb" path="res://objects/Rotatable.gd" id="1_vn420"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_vn420"]
friction = 0.26
[sub_resource type="BoxShape3D" id="BoxShape3D_vn420"]
size = Vector3(1, 1.22449, 1.01085)
[sub_resource type="BoxMesh" id="BoxMesh_gxu5i"]
[node name="Rotatable" type="RigidBody3D"]
physics_material_override = SubResource("PhysicsMaterial_vn420")
script = ExtResource("1_vn420")
yTorqueMult = 30.0
zTorqueMult = 30.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.66452, 0.0126419)
shape = SubResource("BoxShape3D_vn420")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.676347, 0)
mesh = SubResource("BoxMesh_gxu5i")
[connection signal="input_event" from="." to="." method="_on_input_event"]

24
objects/horse.tscn Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,18 @@
[gd_scene load_steps=3 format=3 uid="uid://dqu5h8wloab26"]
[ext_resource type="PackedScene" uid="uid://du8lkrvnc16gl" path="res://objects/Rotatable.tscn" id="1_6b465"]
[sub_resource type="BoxShape3D" id="BoxShape3D_6b465"]
size = Vector3(1, 1, 5.99051)
[node name="Rotatable" instance=ExtResource("1_6b465")]
initialMass = 6.0
yTorqueMult = 200.0
zTorqueMult = 80.0
[node name="CollisionShape3D" parent="." index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.66452, -0.00264168)
shape = SubResource("BoxShape3D_6b465")
[node name="MeshInstance3D" parent="." index="1"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 5.96618, 0, 0.676347, 0)

View file

@ -0,0 +1,17 @@
[gd_scene load_steps=4 format=3 uid="uid://cbl4jcbilihv"]
[ext_resource type="PackedScene" uid="uid://du8lkrvnc16gl" path="res://objects/Rotatable.tscn" id="1_w404d"]
[sub_resource type="SphereShape3D" id="SphereShape3D_5yy8w"]
[sub_resource type="SphereMesh" id="SphereMesh_rq261"]
[node name="Rotatable" instance=ExtResource("1_w404d")]
yTorqueMult = 20.0
zTorqueMult = 20.0
[node name="CollisionShape3D" parent="." index="0"]
shape = SubResource("SphereShape3D_5yy8w")
[node name="MeshInstance3D" parent="." index="1"]
mesh = SubResource("SphereMesh_rq261")

24
objects/shark.tscn Normal file

File diff suppressed because one or more lines are too long