Skip to content

Commit

Permalink
Merge pull request #454 from 3DStreet/fix-incorrect-boundingbox-addit…
Browse files Browse the repository at this point in the history
…ional

fix boundingbox for tram and foodTruck elemtens
  • Loading branch information
kfarr authored Jan 16, 2024
2 parents cb12595 + 38bb07a commit 85dcdfb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/aframe-streetmix-parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ function createChooChooElement (variantList, objectMixinId, length, showVehicles
}
const rotationY = (variantList[0] === 'inbound') ? 0 : 180;
const placedObjectEl = document.createElement('a-entity');
placedObjectEl.setAttribute('class', objectMixinId);
const tramLength = 23;
placedObjectEl.setAttribute('rotation', '0 ' + rotationY + ' 0');
placedObjectEl.setAttribute('mixin', objectMixinId);
placedObjectEl.addEventListener('model-loaded', (model) => {
randomPosition(model.target, 'z', length);
}, { once: true });
placedObjectEl.setAttribute('class', objectMixinId);
const positionZ = randomPosition(placedObjectEl, 'z', length, tramLength);
placedObjectEl.setAttribute('position', '0 0 ' + positionZ);
return placedObjectEl;
}

Expand Down Expand Up @@ -471,12 +471,13 @@ function createFoodTruckElement (variantList, length) {
const foodTruckParentEl = document.createElement('a-entity');

const reusableObjectEl = document.createElement('a-entity');
const foodTruckLength = 7;
const rotationY = (variantList[0] === 'left') ? 0 : 180;
reusableObjectEl.setAttribute('rotation', '0 ' + rotationY + ' 0');
reusableObjectEl.setAttribute('mixin', 'food-trailer-rig');
reusableObjectEl.addEventListener('model-loaded', (model) => {
randomPosition(model.target, 'z', length);
}, { once: true });

const positionZ = randomPosition(reusableObjectEl, 'z', length, foodTruckLength);
reusableObjectEl.setAttribute('positon', '0 0 ' + positionZ);
foodTruckParentEl.append(reusableObjectEl);

return foodTruckParentEl;
Expand Down

0 comments on commit 85dcdfb

Please sign in to comment.