Purpose

This component is intended to store and represent qualitative parameters for the instructions, like the direction of displacements or axis of rotations among others.

Schema

  • attribute name: n/a
    • description: qualitative property such as direction of movement or axis of rotation
    • type: string
    • default: up
    • oneOf: up, down, left, right, forward, backward (more to be added)

Usage

The entity this component is attached to must be children of another entity with the component ide as this one is aware of if it’s a child of an instruction and needs to have a reference to the ide entity to reparent to it when extracted from the instruction.

If you want to attach an argument to an instruction on your scene, don’t nest the argument inside the instruction but set the proper attribute of the instruction component and it will create the argument during it’s initialization.

Implementation

The argument component has primarly two states:

  • Attached to an instruction: On this case, during the initialization, the entity will have the components ammo-body (static, emit collision events) and ammo-shape attached to it, as well as a ‘collidestart’ event handler that reparents the entity to the ide in case that it collides with another entity with the class finger, which is intended to be used on the index fingers of the hands.
  • Attached to the ide: The entity will have the components ammo-body (dynamic, zero-gravity), ammo-shape, grababble and draggable attached to it, and if it’s dropped near an instruction, it will be attached to it (this behaviour is implemented on the instruction component).

This flowchart sums up the states of this component:

Examples

Simplest scene for VR headset featuring three parameters (play with it here)

  <a-scene physics="driver: ammo">
    <a-entity ide="" position="0 0.75 -0.5">
      <a-entity position="-0.4 0.4 0" argument="left" class="collidable"></a-entity>
       <a-entity position="  0 0.4 0" argument="up" class="collidable"></a-entity>
       <a-entity position="0.4 0.4 0" argument="right" class="collidable"></a-entity>
    </a-entity>
    <a-entity>
      <a-entity camera=""></a-entity>
      <a-entity sphere-collider="objects:.collidable" hand-controls="hand:left" super-hands ammo-body="type:kinematic" ammo-shape="type:sphere;fit:manual;sphereRadius:0.01">
      <a-entity sphere-collider="objects:.collidable" hand-controls="hand:right" super-hands ammo-body="type:kinematic" ammo-shape="type:sphere;fit:manual;sphereRadius:0.01">
    </a-entity>
  </a-scene>