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
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
[node name="Aircraft" type="Node3D"]
|
||||
script = ExtResource("1_l4uib")
|
||||
track_platform = true
|
||||
|
||||
[node name="Mi-2" parent="." instance=ExtResource("1_mrxe8")]
|
||||
|
||||
|
|
@ -33,6 +34,13 @@ transform = Transform3D(-1, 8.74228e-08, -3.82137e-15, 0, -4.37114e-08, -1, -8.7
|
|||
[node name="ReferenceAxes" parent="AttitudeRoot/PilotEyes/PilotFloor/TrackerMountChair" instance=ExtResource("3_2bi7g")]
|
||||
transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, 0, 0)
|
||||
|
||||
[node name="TrackerMountPlatform" type="Node3D" parent="AttitudeRoot/PilotEyes/PilotFloor"]
|
||||
transform = Transform3D(-0.891006, -0.453991, 1.98446e-08, 0, -4.37114e-08, -1, 0.453991, -0.891006, 3.89471e-08, 0.4, 0.5, -0.7)
|
||||
|
||||
[node name="ReferenceAxes" parent="AttitudeRoot/PilotEyes/PilotFloor/TrackerMountPlatform" instance=ExtResource("3_2bi7g")]
|
||||
transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="XROrigin3D" type="XROrigin3D" parent="AttitudeRoot/PilotEyes/PilotFloor"]
|
||||
|
||||
[node name="XRCamera3D" type="XRCamera3D" parent="AttitudeRoot/PilotEyes/PilotFloor/XROrigin3D"]
|
||||
|
|
@ -42,6 +50,7 @@ tracker = &"/user/vive_tracker_htcx/role/camera"
|
|||
|
||||
[node name="ReferenceAxes" parent="AttitudeRoot/PilotEyes/PilotFloor/XROrigin3D/ViveTracker" instance=ExtResource("3_2bi7g")]
|
||||
transform = Transform3D(0.25, 0, 0, 0, 0.25, 0, 0, 0, 0.25, 0, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="Instruments" parent="AttitudeRoot" instance=ExtResource("3_5w717")]
|
||||
transform = Transform3D(-0.5, -1.27582e-08, 7.43353e-08, 4.33325e-10, 0.4923, 0.0874084, -7.5421e-08, 0.0874084, -0.4923, 0.00724897, -1.1581, 2.40391)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
extends Node
|
||||
|
||||
@export var browser_name: String = "browser"
|
||||
@export var url: String = "http://localhost:5555/pfd"
|
||||
@export var url: String = "http://192.168.1.2:5555/pfd"
|
||||
|
||||
# ==============================================================================
|
||||
# Create a single browser named "browser_name" that is attached as child node to $CEF.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue