Redo main scene
Much simpler XR setup based on Bastiaan Olij's Dev stream 58 Correctly applied bone deformation in Mi-2 model
This commit is contained in:
parent
9ebb025f8a
commit
4ddccdaf62
15 changed files with 181 additions and 104 deletions
19
project/aircraft/aircraft.gd
Normal file
19
project/aircraft/aircraft.gd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
extends Node3D
|
||||
|
||||
@onready var connector = $MarshConnector
|
||||
@onready var skeleton = $"Mi-2/Armature/Skeleton3D"
|
||||
@onready var attitude_root = $AttitudeRoot
|
||||
|
||||
@onready var bone_cg: int = skeleton.find_bone("BodyCG")
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var target: Transform3D = connector.get_aircraft()
|
||||
position = target.origin
|
||||
|
||||
# Add the rotation to the bone
|
||||
var rest = skeleton.get_bone_rest(bone_cg).basis.get_rotation_quaternion()
|
||||
var attitude = target.basis.get_rotation_quaternion()
|
||||
skeleton.set_bone_pose_rotation(bone_cg, attitude * rest)
|
||||
|
||||
# Rotate other children (not using BoneAttachment3D due to jitter)
|
||||
attitude_root.rotation = target.basis.get_euler()
|
||||
Loading…
Add table
Add a link
Reference in a new issue