Closed Elettrotecnica closed 6 months ago
Dear @vincentfretin, I have implemented your suggestions. I have also a small refactoring in my stash that should improve the array allocation situation, I could push it here directly, rather than in a new PR, as you wish :-)
You should put this.needsUpdate = false;
in init()
, not true, otherwise it will execute update twice initially.
Let's first merge this PR, then you can create other PRs after that one. Thanks!
Or rename update to something else, and create an update method that just set this.needsUpdate = true
and don't initialize it in init.
I went with not initializing at all, should work as intended
Oh sorry, it probably wasn't an issue because you set this.needsUpdate = false;
in the end of update()
.
Ok good let's merge this.
I threw in an extra little improvement: we skip the match altogether if we are already supposed to update.
I see, even better!
Actually there is something that bother me, calling update() on needsUpdate, will execute again
this.lastPosition = null;
and the this.xzOrigin = ...
lines that are not needed.
so probably better to have the this.objects
and this.excludes
in a separate method. What do you think?
I have to admit that I wouldn't know the full consequences of recomputing those two values, but let's stay on the safe side: I have split the objects update from the actual component's update.
Thank you.
Dear maintainers,
I have implemented reacting to child attached/detached on simple-navmesh-constraint for my own use case. I understand this was somewhat on the todo list, so I leave it here :-)
All the best