Successful test with motion platform and VR together
This commit is contained in:
parent
416aa8a392
commit
2824f77450
4 changed files with 18 additions and 7 deletions
|
|
@ -2,9 +2,9 @@ extends Node3D
|
|||
|
||||
## Rotation of cyclic stick model for full control deflection, in degrees
|
||||
@export var range_cyclic: float = 30
|
||||
|
||||
## Main rotor speed, in revolutions per minute
|
||||
@export var rotor_rpm: float = 500
|
||||
@export var track_platform: bool = false
|
||||
|
||||
## Current angle of rotor rotation
|
||||
var _rotor_azimuth: float = 0
|
||||
|
|
@ -12,7 +12,8 @@ var _rotor_azimuth: float = 0
|
|||
@onready var connector: MarshConnector = $MarshConnector
|
||||
@onready var skeleton: Skeleton3D = $"Mi-2/Armature/Skeleton3D"
|
||||
@onready var attitude_root: Node3D = $AttitudeRoot
|
||||
@onready var tracker_mount: Node3D = $AttitudeRoot/PilotEyes/PilotFloor/TrackerMountChair
|
||||
@onready var tracker_mount_chair: Node3D = $AttitudeRoot/PilotEyes/PilotFloor/TrackerMountChair
|
||||
@onready var tracker_mount_platform: Node3D = $AttitudeRoot/PilotEyes/PilotFloor/TrackerMountPlatform
|
||||
@onready var xr_origin: XROrigin3D = $AttitudeRoot/PilotEyes/PilotFloor/XROrigin3D
|
||||
@onready var tracker: XRController3D = $AttitudeRoot/PilotEyes/PilotFloor/XROrigin3D/ViveTracker
|
||||
|
||||
|
|
@ -48,6 +49,7 @@ func _process(delta: float) -> void:
|
|||
skeleton.set_bone_pose_rotation(bone_rotor, rotor_rest * rotor_att)
|
||||
|
||||
if tracker.get_has_tracking_data():
|
||||
var tracker_mount = tracker_mount_platform if track_platform else tracker_mount_chair
|
||||
xr_origin.transform = tracker_mount.transform * tracker.transform.affine_inverse()
|
||||
else:
|
||||
xr_origin.transform = Transform3D.IDENTITY
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue