📷 Adds setting for fixing camera on robot
This commit is contained in:
@@ -27,7 +27,8 @@
|
|||||||
|
|
||||||
let settings = {
|
let settings = {
|
||||||
'Trace feet':true,
|
'Trace feet':true,
|
||||||
'Trace points': 30
|
'Trace points': 30,
|
||||||
|
'Fix camera on robot': true
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
const visibility = panel.addFolder('Visualization');
|
const visibility = panel.addFolder('Visualization');
|
||||||
visibility.add(settings, 'Trace feet')
|
visibility.add(settings, 'Trace feet')
|
||||||
visibility.add(settings, 'Trace points', 1, 1000, 1)
|
visibility.add(settings, 'Trace points', 1, 1000, 1)
|
||||||
|
visibility.add(settings, 'Fix camera on robot')
|
||||||
}
|
}
|
||||||
|
|
||||||
const cacheModelFiles = async () => {
|
const cacheModelFiles = async () => {
|
||||||
@@ -142,6 +144,10 @@
|
|||||||
|
|
||||||
renderTraceLines(toes)
|
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.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);
|
robot.rotation.z = lerp(robot.rotation.z, degToRad($mpu.heading + 90), 0.1);
|
||||||
modelTargetAngles = $servoAngles;
|
modelTargetAngles = $servoAngles;
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ export default class SceneBuilder {
|
|||||||
|
|
||||||
public startRenderLoop = () => {
|
public startRenderLoop = () => {
|
||||||
this.renderer.setAnimationLoop(() => {
|
this.renderer.setAnimationLoop(() => {
|
||||||
|
this.controls.update();
|
||||||
this.renderer.render(this.scene, this.camera);
|
this.renderer.render(this.scene, this.camera);
|
||||||
this.handleRobotShadow();
|
this.handleRobotShadow();
|
||||||
if (this.callback) this.callback();
|
if (this.callback) this.callback();
|
||||||
|
|||||||
Reference in New Issue
Block a user