Given that https://github.com/heycam/webidl/pull/750 forces optional dictionary arguments to specify a default, we can no longer distinguish between "direction was not specified" and "direction was specified as {0, 0, 0, 1}".
Unfortunately, {0, 0, 0, 1} is not a valid direction value! The w coordinate should be zero; and ideally we should throw for nonzero w (which is what Chrome does, despite being unspecced). But we can't tell the difference between "direction unspecified" and "direction is {0, 0, 0, 1}", so this would end up throwing for new XRRay({...}) with an unspecified direction.
We'd like to default it to the -Z axis instead. We should use a new dictionary here. We should also potentially handle the w coordinate in origin instead of ignoring it.
(Previously https://github.com/immersive-web/hit-test/pull/83)
Currently the XRRay vector constructor is specified as
however, this is no longer allowed by the current WebIDL spec, it needs to be
(https://github.com/heycam/webidl/pull/750 forces us to default to
{}
)Given that https://github.com/heycam/webidl/pull/750 forces
optional
dictionary arguments to specify a default, we can no longer distinguish between "direction was not specified" and "direction was specified as{0, 0, 0, 1}
".Unfortunately,
{0, 0, 0, 1}
is not a valid direction value! Thew
coordinate should be zero; and ideally we should throw for nonzerow
(which is what Chrome does, despite being unspecced). But we can't tell the difference between "direction unspecified" and "direction is{0, 0, 0, 1}
", so this would end up throwing fornew XRRay({...})
with an unspecified direction.We'd like to default it to the -Z axis instead. We should use a new dictionary here. We should also potentially handle the
w
coordinate inorigin
instead of ignoring it.