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

[simple-navmesh-constraint] create a separate repo and publish to npm #6

Open
vincentfretin opened this issue Jul 14, 2023 · 5 comments
Assignees

Comments

@vincentfretin
Copy link
Member

Create a separate repo in c-frame organization to host simple-navmesh-constraint component and publish it to npm.
See AdaRoseCannon/aframe-xr-boilerplate#13 (comment)

example:
https://glitch.com/edit/#!/aframe-ada-simple-navmesh-constraint---1-4-1
doc:
https://github.com/AdaRoseCannon/aframe-xr-boilerplate#simple-navmesh-constraintjs

@vincentfretin vincentfretin self-assigned this Jul 14, 2023
@vincentfretin vincentfretin changed the title simple-navmesh-constraint: create a separate repo and publish to npm [simple-navmesh-constraint] create a separate repo and publish to npm Jul 14, 2023
@vincentfretin
Copy link
Member Author

You can sponsor $10 to vincentfretin fully or partially to work on this feature. Find other work you can sponsor at https://github.com/c-frame/sponsorship

@vincentfretin
Copy link
Member Author

@vincentfretin
Copy link
Member Author

vincentfretin commented Feb 18, 2024

The ground generated by the environment component works well with simple-navmesh-constraint but it currently needs to be set dynamically, I set it after 2s for it to work. We probably need to listen to object3dset event in simple-navmesh-constraint component to update the kept entities to check for navmesh.

It works well with cursor-teleport component too, just be sure to disable and enable simple-navmesh-constraint between navigation transition.

Code snippet below:

    AFRAME.registerComponent('character-controller', {
        init() {
          setTimeout(() => {
            const rig = document.getElementById('rig');
            rig.setAttribute(
              'simple-navmesh-constraint',
              'navmesh:.environmentGround,.environmentDressing;fall:10;height:0;exclude:.navmesh-hole;'
            );
          }, 2000);
        },
        events: {
          'navigation-start': function () {
            if (this.el.hasAttribute('simple-navmesh-constraint')) {
              this.el.setAttribute('simple-navmesh-constraint', 'enabled', false);
            }
          },
          'navigation-end': function () {
            if (this.el.hasAttribute('simple-navmesh-constraint')) {
              this.el.setAttribute('simple-navmesh-constraint', 'enabled', true);
            }
          },
        },
      });
<a-scene environment="preset: japan">
  <a-entity
      id="rig"
      character-controller
      cursor-teleport="cameraRig: #rig; cameraHead: #player; collisionEntities: .environmentGround; ignoreEntities: .clickable"
      movement-controls="camera:#player"
  >
    <a-entity id="player" class="camera" camera position="0 1.6 0" look-controls>
    </a-entity>
  </a-entity>
</a-scene>

@vincentfretin
Copy link
Member Author

With AdaRoseCannon/aframe-xr-boilerplate#27 the setTimeout 2s in my above comment to set simple-navmesh-constraint is not needed anymore.

@vincentfretin
Copy link
Member Author

Latest version is

<script src="https://cdn.jsdelivr.net/gh/AdaRoseCannon/aframe-xr-boilerplate@bca4792/simple-navmesh-constraint.js"></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Planned
Development

No branches or pull requests

1 participant