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

Camera Collision Not Working: A-Frame 1.4.0 #5434

Closed
mrunmayeejagtap opened this issue Jan 22, 2024 · 2 comments
Closed

Camera Collision Not Working: A-Frame 1.4.0 #5434

mrunmayeejagtap opened this issue Jan 22, 2024 · 2 comments

Comments

@mrunmayeejagtap
Copy link

Description:
I'm facing difficulties with camera collision in A-Frame version 1.4.0. Despite applying the collide attribute to the a-box entity and experimenting with a raycaster for the camera entity, the camera still passes through objects in the scene without triggering the expected collision behavior.

  • A-Frame Version: 1.4.0
  • Platform / Device: Windows OS with updated browser
  • Expected Behavior:
    I expect the camera to collide with objects in the A-Frame scene, preventing it from passing through and providing a realistic virtual reality experience.
  • Actual Behavior:
    The camera continues to move through objects without triggering the anticipated collision detection.
  • Code Snippet:
<html>
<head>
    <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
    <script src="https://unpkg.com/aframe-extras/dist/aframe-extras.min.js"></script>
</head>

<body>
    <a-scene>
        <a-box position="0 0 -5" rotation="0 45 0" scale="2 2 2" collision color="tomato"></a-box>
        <a-sky color="#EEEEFF" material="src: ./sky.jpg" geometry=""></a-sky>
        <a-entity id="cameraEntity" camera="" universal-controls="" kinematic-body=""
            mouse-controls="pointerlockEnabled: false" data-aframe-inspector-original-camera="" position="0 1.6 0"
            grabbable look-controls wasd-controls>
            <a-entity id="cursorImage" cursor="fuse: true; fuseTimeout: 1000" position="0 0 -1"
                scale="0.00001 0.00001 0.00001" geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03"
                material="color: red; shader: flat" light="type: ambient; intensity: 1.2" raycaster="">
            </a-entity>
        </a-entity>
    </a-scene>
</body>
</html>

I appreciate any guidance or insights on resolving this camera collision problem.

@vincentfretin
Copy link
Contributor

Be sure to use latest versions, aframe 1.4.2 or 1.5.0 and aframe-extras 7.2.0.
The universal-controls was renamed to movement-controls a long time ago, you will also need to adapt your code to use a rig entity.
kinematic-body doesn't exist anymore, it has been removed. You will have to use a navmesh.
Look at the Castle example from aframe-extras repo that has a navmesh.
I also wrote some comments about navmesh here.

@vincentfretin
Copy link
Contributor

@dmarcos This is not an aframe issue, but an aframe-extras support question, so you can close it.
@mrunmayeejagtap If have additional question about navmesh, please reach out to the community on WebXR Discord aframe channel.

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

No branches or pull requests

2 participants