防止相机“通过"aframe 对象 [英] Preventing camera from going 'through' aframe object

查看:26
本文介绍了防止相机“通过"aframe 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个圆柱模型,可以加载到我的 webvr 场景中.我怎样才能使物体坚固?IE.用户(相机视图)不能在对象内占据任何位置或穿过"对象.我怎样才能做到这一点?

Lets say I have a cylinder model that I load into my webvr scene. How can I make the object solid? I.e. the user (camera view) cannot take any position within the object or move 'through' the object. How can I achieve this?

<a-scene>
  <a-assets>
    <a-asset-item id="cube-obj" src="cube.obj"></a-asset-item>
  </a-assets>
  <a-entity id="cameraWrapper" position="0 2 10" rotation="0 0 0">
    <a-camera near="0.1" user-height="0" id="camera" listener></a-camera>
  </a-entity>
  <a-entity obj-model="obj: #cube-obj; mtl: #cube-mtl" scale="1 1 1" rotation="-90 0 0"></a-entity>
  <a-plane position="0 4 4" rotation="-90 0 -90" width="4" height="4" color="#7BC8A4"></a-plane>
  <a-sky color="#ECECEC"></a-sky>
</a-scene>

推荐答案

这取决于您计划支持哪些设备,以及您如何允许用户导航你的场景.对于大多数 VR 体验,请遵循最佳实践,并且仅根据用户的动作按比例移动相机.如果用户步在房间尺度空间中前进并且相机被阻挡",这是一个非常糟糕的经验.对于大多数 VR 应用程序,最好使用传送,设计您的场景以避开障碍物,或探索更多创意在世界范围内移动用户的方式.

This depends on what devices you plan to support, and how you allow users to navigate your scene. For most VR experiences, follow best practices and only move the camera proportionately to the user's motion. If the user steps forward in roomscale space and the camera is "blocked," this is a very bad experience. For most VR applications it's better to do locomotion with teleportation, design your scene to keep obstacles out of the way, or explore more creative ways of moving users through the world.

用于带有游戏手柄或 WASD 控件的非 VR 桌面体验,或用于 VR 场景如果相机在车内,您可以添加一个物理引擎防止通过障碍物移动.

For non-VR desktop experiences with a gamepad or WASD controls, or for VR scenes where the camera is inside a vehicle, you can add a physics engine to prevent movement through obstacles.

^我会尽快将其添加到 A-Frame 常见问题解答或文档中.这已添加到 A-Frame 常见问题.这是一个使用检查点的示例和一个使用物理引擎的示例.

^I'll try to get this added to the A-Frame FAQ or documentation soon. This has been added to the A-Frame FAQ. Here's an example using checkpoints, and an example using a physics engine.

这篇关于防止相机“通过"aframe 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆