Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intersection crosswalk options #993

Merged
merged 9 commits into from
Dec 30, 2024

Conversation

ewei2406
Copy link
Contributor

@ewei2406 ewei2406 commented Dec 27, 2024

Towards having intersections with crosswalk options, this PR changes the crosswalk design of the intersection to use a selection instead of a boolean and adds the new crosswalks requested by Marc:

old school 2 lines, rainbow option, piano key option, mural option, raised (in particular on a side street) with color or emphasis.

  • The available options are: no crosswalk, normal zebra stripe, double stripe, rainbow, piano keys, mural, or raised.

Implementation

  • The crosswalk type is stored in the intersection component as a number that is mapped to the corresponding crosswalk type in the object CROSSWALKS defined in intersection.js
  • Since each crosswalk entity/mixin has different size and orientation, there is a special CROSSWALK_TRANSFORMS object that defines a unique transformation that each crosswalk entity can have, so that they can all be oriented correctly.
  • Currently, the options for a crosswalk are: none, raised crosswalk, original crosswalk, and crosswalk-box entity.
  • The textures for the new crosswalks are in the PR for the assets repo: Add crosswalk textures 3dstreet-assets-dist#36
  • Renamed the existing mixin for street-element-crosswalk-raised to just crosswalk-raised for consistency with other crosswalks.
Screenshot 2024-12-27 at 4 00 21 PM Screenshot 2024-12-27 at 4 10 58 PM

@ewei2406
Copy link
Contributor Author

While working on this PR, I noticed a bug with the sidewalk width parameter where the sidewalk does not correctly align with the intersection if the intersection width/length is not the default value; I'll draft a fix in a separate PR.

@ewei2406 ewei2406 marked this pull request as ready for review December 28, 2024 00:14
@ewei2406 ewei2406 changed the title [WIP] Intersection crosswalk options Intersection crosswalk options Dec 28, 2024

const transformImageCrosswalk = (entity, length, rotZ) => {
entity.setAttribute('rotation', { z: rotZ });
entity.setAttribute('scale', { y: length / 12, x: 1.5 });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define all three x y z. Although that somehow works on aframe 1.5.0, setting a partial vec3 is not a valid usage and sometimes won't work properly (setting missing values to 0 and not 1 as you expect for scale) on aframe 1.6.0 or later depending on if you insert the entity in DOM first.

},
'crosswalk-raised': (entity, length, rotX) => {
entity.setAttribute('rotation', { x: rotX, y: 90, z: 90 });
entity.setAttribute('scale', { x: length / 7, z: 1.5 });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here please define full the vec3 with y: 1

none: function () {},
'crosswalk-zebra': (entity, length, rotZ) => {
entity.setAttribute('rotation', { z: rotZ });
entity.setAttribute('scale', { y: length / 12 });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here please define full the vec3 with x: 1, z: 1

src/assets.js Outdated
@@ -211,13 +211,17 @@ function buildAssetHTML(assetUrl, categories) {
<a-mixin shadow id="temporary-traffic-cone" scale="1 1 1" rotation="0 0 0" gltf-part="src: #dividers; part: traffic-cone"></a-mixin>
<a-mixin shadow id="temporary-jersey-barrier-plastic" scale="1 1 1" rotation="0 0 0" gltf-part="src: #dividers; part: jersey-barrier-plastic"></a-mixin>
<a-mixin shadow id="temporary-jersey-barrier-concrete" scale="1 1 1" rotation="0 0 0" gltf-part="src: #dividers; part: jersey-barrier-concrete"></a-mixin>
<a-mixin shadow id="street-element-crosswalk-raised" scale="1 1 1" rotation="0 0 0" gltf-model="url(${assetUrl}sets/uoregon/gltf-exports/draco/crosswalk-raised.glb)"></a-mixin>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably keep the original id because there may be users who have existing scenes with street-element-crosswalk-raised id

cw1.setAttribute('mixin', 'markings crosswalk-zebra');
cw1.setAttribute(
'mixin',
'markings ' + CROSSWALKS_REV[crosswalklArray[0]]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of markings now and just set the mixin to the crosswalk value

@kfarr kfarr merged commit 1a0d046 into 3DStreet:main Dec 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants