raise walls so they dont clip the ground

This commit is contained in:
Kevin Ngo
2018-11-17 05:07:29 -08:00
parent e1065f7ec7
commit cdb9975893

View File

@@ -1,24 +1,27 @@
import {BEAT_WARMUP_OFFSET, BEAT_WARMUP_SPEED, BEAT_WARMUP_TIME} from '../constants/beat';
// So wall does not clip the stage ground.
const RAISE_Y_OFFSET = 0.1;
/**
* Wall speed and haptics.
* Wall to dodge.
*/
AFRAME.registerComponent('wall', {
schema: {
anticipationPosition: {default: 0},
durationSeconds: {default: 0},
height: {default: 1.3},
horizontalPosition: {default: 'middleleft', oneOf: ['left', 'middleleft', 'middleright', 'right']},
speed: {default: 1.0},
warmupPosition: {default: 0},
height: {default: 1.3},
width: {default: 1}
},
horizontalPositions: {
'left': -0.75,
'middleleft': -0.25,
'middleright': 0.25,
'right': 0.75
left: -0.75,
middleleft: -0.25,
middleright: 0.25,
right: 0.75
},
init: function () {
@@ -30,7 +33,7 @@ AFRAME.registerComponent('wall', {
const data = this.data;
el.object3D.position.set(
this.horizontalPositions[data.horizontalPosition],
data.height,
data.height + RAISE_Y_OFFSET,
data.anticipationPosition + data.warmupPosition + data.durationSeconds * data.speed / 2
);
el.object3D.scale.set(data.width * 0.30, 2.5, data.durationSeconds * data.speed);