aframe-blink-controls icon indicating copy to clipboard operation
aframe-blink-controls copied to clipboard

bug: teleporting breaks when teleported to position with negative z-value,

Open coderofsalvation opened this issue 4 months ago • 2 comments

try teleporting to a mesh at 0,0,-10, you'll see that it throws some kindof computeBoundingSphere error.

coderofsalvation avatar Feb 13 '24 14:02 coderofsalvation

I also add the issue in one of my scene. I just moved up my whole scene to fix the issue. If I remember, the issue was with square of some negative number like Math.sqrt(-20) giving NaN. I think it was here https://github.com/jure/aframe-blink-controls/blob/4c53449a8410d42e7681d47c0c458b52e11e3456/src/index.js#L532 Not sure how we can solve that.

vincentfretin avatar Feb 14 '24 09:02 vincentfretin

kudos for having discovered the same (it took me a while to figure this bug out) Anyways, my tiny math-brain does not really know what p0 v0 and a mean (energy, velocity and amplitude?).

I'm trying to fiddle with it in the javascript browser-console, thinking whether simply wrapping values in Math.abs() will do the job (I mean the output of sqrt is always positive)

$('[blink-controls]').components['blink-controls'].parabolicCurveMaxRoot = function (p0, v0, a) {
    const root = (-v0.y - Math.sqrt( Math.abs(v0.y) ** 2 - 4 * (0.5 * Math.abs(a.y) ) * Math.abs(p0.y) ) ) / (2 * 0.5 * Math.abs(a.y) )
    return root
}

will test it asap

coderofsalvation avatar Feb 14 '24 10:02 coderofsalvation