Skip to content

Commit

Permalink
Merge pull request #321 from 3DStreet/intersection-issue
Browse files Browse the repository at this point in the history
fix saving issue
  • Loading branch information
kfarr authored Aug 3, 2023
2 parents 14758ce + 97ff91f commit 9edee80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
11 changes: 5 additions & 6 deletions src/aframe-streetmix-parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,13 @@ function createDriveLaneElement (variantList, positionX, segmentWidthInMeters, s
const params = carParams[carType];

const reusableObjectEl = document.createElement('a-entity');
reusableObjectEl.object3D.position.setX(positionX);
if (positionZ) {
reusableObjectEl.object3D.position.setZ(positionZ);
} else {
randomPosition(reusableObjectEl, 'z', streetLength, params['length']);

if (!positionZ) {
positionZ = randomPosition(reusableObjectEl, 'z', streetLength, params['length']);
}
reusableObjectEl.setAttribute('position', `${positionX} 0 ${positionZ}`);
reusableObjectEl.setAttribute('mixin', params['mixin']);
reusableObjectEl.object3D.rotation.set(0, THREE.MathUtils.degToRad(rotationY), 0);
reusableObjectEl.setAttribute('rotation', `0 ${rotationY} 0`);

if (animated) {
speed = 5; // meters per second
Expand Down
5 changes: 2 additions & 3 deletions src/json-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ function filterJSONstreet (removeProps, renameProps, streetJSON) {
});
// rename components
for (var renameKey in renameProps) {
const reKey = new RegExp(`"${renameKey}":`);
stringJSON = stringJSON.replace(reKey, `"${renameProps[renameKey]}":`);
const reKey = new RegExp(`"${renameKey}":`, 'g');
stringJSON = stringJSON.replaceAll(reKey, `"${renameProps[renameKey]}":`);
}
return stringJSON;
}
Expand Down Expand Up @@ -252,7 +252,6 @@ function getModifiedProperty (entity, componentName) {
// skip properties, if they exists in element's mixin
return null;
}

// If its single-property like position, rotation, etc
if (isSingleProperty(defaultData)) {
const defaultValue = defaultData.default;
Expand Down

0 comments on commit 9edee80

Please sign in to comment.