diff --git a/gui/src/components/widgets/IMUVisualizerWidget.tsx b/gui/src/components/widgets/IMUVisualizerWidget.tsx index a1072d3c4f..69096cd424 100644 --- a/gui/src/components/widgets/IMUVisualizerWidget.tsx +++ b/gui/src/components/widgets/IMUVisualizerWidget.tsx @@ -5,11 +5,12 @@ import { Typography } from '../commons/Typography'; import { formatVector3 } from '../../utils/formatting'; import { Canvas, useLoader } from '@react-three/fiber'; import * as THREE from 'three'; -import { PerspectiveCamera } from 'three'; +import { PerspectiveCamera, Vector3 } from 'three'; import { Button } from '../commons/Button'; import { QuatObject } from '../../maths/quaternion'; import { useLocalization } from '@fluent/react'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'; +import { Vector3Object } from '../../maths/vector3'; const groundColor = '#4444aa'; @@ -25,10 +26,12 @@ export function TrackerModel({ model }: { model: string }) { } function SceneRenderer({ - quat: { x, y, z, w }, + quat, + vec, model, }: { quat: QuatObject; + vec: Vector3Object; model: string; }) { return ( @@ -41,11 +44,33 @@ function SceneRenderer({ > - + + + + + @@ -127,6 +156,7 @@ export function IMUVisualizerWidget({ tracker }: { tracker: TrackerDataT }) { { tracker.setRotation(rot17) @@ -297,7 +298,8 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker is UDPPacket4Acceleration -> { tracker = connection?.getTracker(packet.sensorId) if (tracker == null) return - tracker.setAcceleration(packet.acceleration) + // Switch x and y around to adjust for different axes + tracker.setAcceleration(Vector3(packet.acceleration.y, packet.acceleration.x, packet.acceleration.z)) } is UDPPacket10PingPong -> { if (connection == null) return