Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Commit

Permalink
Record puppet/controller movement #4
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchirls committed Mar 7, 2017
1 parent f09149b commit 51f267c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ function animate(timestamp) {
c.update();

// todo: only use controllers if editing
if (c.visible) {
if (c.visible && isEditing) {
if (!c.userData.gamepad) {
c.userData.gamepad = c.getGamepad();
// loadController().then(obj => c.add(obj.clone()));
Expand All @@ -494,6 +494,24 @@ function animate(timestamp) {
puppet.position.copy(c.position).sub(world.position).divide(world.scale);
puppet.position.clamp(stageBounds.min, stageBounds.max);
// todo: constrain puppet on all sides, not just bottom

if (puppetShowRecorder && puppetShowRecorder.recording) {
const pos = puppet.position;
const rot = puppet.rotation;
puppetShowRecorder.recordEvent('puppet', {
puppet: i,
position: {
x: pos.x,
y: pos.y,
z: pos.z
},
rotation: {
x: rot.x,
y: rot.y,
z: rot.z
}
});
}
}
}
});
Expand Down

0 comments on commit 51f267c

Please sign in to comment.