📷 Adds setting for fixing camera on robot

This commit is contained in:
Rune Harlyk
2024-03-01 16:56:56 +01:00
parent 3f07a91ce8
commit 02871591fd
2 changed files with 8 additions and 1 deletions
+7 -1
View File
@@ -27,7 +27,8 @@
let settings = {
'Trace feet':true,
'Trace points': 30
'Trace points': 30,
'Fix camera on robot': true
}
onMount(async () => {
@@ -48,6 +49,7 @@
const visibility = panel.addFolder('Visualization');
visibility.add(settings, 'Trace feet')
visibility.add(settings, 'Trace points', 1, 1000, 1)
visibility.add(settings, 'Fix camera on robot')
}
const cacheModelFiles = async () => {
@@ -142,6 +144,10 @@
renderTraceLines(toes)
if (settings['Fix camera on robot']) {
sceneManager.controls.target = robot.position.clone()
}
robot.position.y = robot.position.y - Math.min(...toes.map(toe => toe.y));
robot.rotation.z = lerp(robot.rotation.z, degToRad($mpu.heading + 90), 0.1);
modelTargetAngles = $servoAngles;
+1
View File
@@ -197,6 +197,7 @@ export default class SceneBuilder {
public startRenderLoop = () => {
this.renderer.setAnimationLoop(() => {
this.controls.update();
this.renderer.render(this.scene, this.camera);
this.handleRobotShadow();
if (this.callback) this.callback();