I found a way to make RayHelper update in an unexpected way: reassigning the underlying ray’s origin vector (instead of updating it in place).
Looking at the source for RayHelper, the reason this happens seems pretty clear; the _renderPoints array is only updated inside of show().
Suspect this must be a known behavior and not considered something that needs to be fixed. (Reassigning the ray origin seems like a bad idea in most cases anyway.)
I’m mostly just curious as to why RayHelper needs/wants to store the two points in the _renderPoints array instead of updating the line mesh based off of the ray itself (in _render() in a new array).
it is more for GC protection. we do not want to recreate arrays during rendering
OK. Thanks @Deltakosh!
GC concerns makes sense.
Would you consider copying from ray.origin to _renderPoints in the _render() function? (around this line in the source)
// ***** Add here: ********************************
// ***** Make sure first point is synced up *****
Mesh.CreateLines("ray", this._renderPoints, this._scene, true, this._renderLine);
Or would that be too much work to protect too few cases?
Sorry to obsess over this. It’s just that I originally assumed I could update the ray-helper ray at will–I see now that using ‘attach to mesh’ is a better way to go.
I will consider it gladly
wanna do a PR?
Excellent. Yes, I’ll do a pull request for this. Thanks.