This week began with adding some finishing touches to the project design document, (~2 hours) , coming up with a plan for implementing the alpha prototype (~5 hours), and then the rest of the week was spent starting to implement that plan (~3 hours).
There are a few important element to this camera entity, but the biggest problem solver was the look-controls component with the "pointerLockEnabled" property set to true as this allows the window to lock the mouse cursor to the window which enables the camera to be moved with mouse movement rather than clicking and dragging. The super-hands component is from the aframe-super-hands-component package and it is a relatively powerful, but complex implementation of grabbing objects in A-Frame.
With the environment complete and the modularity functionality begun we are well on track for completing our alpha prototype.
We decided that the biggest hurdle for this project is going
to be creating pieces of furniture that can snap together to create a single
piece of furniture, so this is what we want to have completed for the alpha
prototype. There are a couple approaches
that could be made to achieve this effect, and most of the planning was spent
trying to determine what worked best for us in terms of effort, functionality, and
modularity.
The first option was to try
and use some existing functionality from an existing component, but the best existing library we found is the aframe-snapto-component, which doesn't quite have the functionality we are looking for in that the snapping can cause performance hits if performed continuously, and the documentation seems to imply that the snapping cannot be turned on and off or triggered by events. I have not had a chance to fully test this component yet, so we may find that we can make it work in the end.
Another option is a custom implementation of a snapping component that is not constantly searching for a snap point and instead only snaps in response to certain triggers. This implementation would rely on invisible spherical or hemispherical collision objects placed on the surfaces of objects at points where a snap can occur. When two snap points collide they will trigger an event that has handlers that check whether the two 'colliding' objects are compatible (probably by comparing two identifying properties on the snap point entities), and, if they are compatible, this will trigger the snap, otherwise nothing will happen. This implementation is likely to draw from the existing aframe-snapto-component if there is a lot of transferable code.
However, before any of the snapping could really be investigate I had to create an A-Frame environment that supported testing this kind of functionality, and that turned out to be a lot more work than expected. This environment needed to include a few things:
- A simple physics system
- Grabbing and moving objects with a mouse (and eventually a controller)
- Free camera movement and rotation
<a-entity camera wasd-controls look-controls="pointerLockEnabled:true" position="0 1.2 1.5" capture-mouse raycaster="objects: .grabbable" cursor="rayOrigin:mouse" static-body="shape: sphere; sphereRadius: 0.001" super-hands="colliderEvent: raycaster-intersection; colliderEventProperty: els; colliderEndEvent:raycaster-intersection-cleared; colliderEndEventProperty: clearedEls;"> </a-entity>
There are a few important element to this camera entity, but the biggest problem solver was the look-controls component with the "pointerLockEnabled" property set to true as this allows the window to lock the mouse cursor to the window which enables the camera to be moved with mouse movement rather than clicking and dragging. The super-hands component is from the aframe-super-hands-component package and it is a relatively powerful, but complex implementation of grabbing objects in A-Frame.
With the environment complete and the modularity functionality begun we are well on track for completing our alpha prototype.
Comments
Post a Comment