Giter Site home page Giter Site logo

heldore / aframe-reset-on-collision Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kennardconsulting/aframe-reset-on-collision

0.0 0.0 0.0 4 KB

A-Frame component to prevent entities moving through walls

Home Page: http://blog.kennardconsulting.com/2017/02/virtual-reality-art-show.html

JavaScript 100.00%

aframe-reset-on-collision's Introduction

A-Frame: reset-on-collision

What Is It?

Resets an a-entity position to the 'last known good' position after any simple AABB collision. Will only work for axis-aligned entities (such as simple walls).

What's It Good For?

If attached to a camera, will prevent walking through walls using WASD controls and/or physically moving in a room-scale environment. For the latter, the world will appear to 'push back' against the user.

What Isn't It Good For?

Collision detection uses simple (but fast) AABB collision detection. So will only work for simple axis aligned primitives (such as a-plane or a-box used as walls). Also the positional reset is a bit janky, and it doesn't implement 'wall sliding' when using WASD controls.

Who Should Use It?

Anyone looking for a quick and dirty solution to stopping people walking through walls in environments where they shouldn't really be going anywhere near the walls in the first place. For example, it's not good for a First Person Shooter where people try to hug the walls (because it doesn't implement 'wall sliding'). But it's fine for an art gallery viewing application.

How Do I Use It?

Add to an a-entity. For example:

<a-entity camera reset-on-collision="with: .wall"/>

aframe-reset-on-collision's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.