There is a weird small visual glitch happening with the navmesh agents. Not sure what is the problem, but I can replicate the issue with a playground. Take a look at this:
What is wrong with this, you might ask? Well, it is a subtle jagged movement that happens from time to time. In the following picture I try to illustrate what I mean:
Sometimes when you click a point (T as Target in the picture) and the cube starts moving, it kind of switches position a bit to previous one, I think. I think this is showing now, since the camera is locked to the target cube and all the small ānudgesā are really visible. It is even more visible when you have a fully fledged animated character in your scene instead of the cube
I couldnāt repro ā¦or my eyes are not efficient enough
The only thing I can see is the deltatime that is not really what it should be.
By default, timesteps and fixed, you can try with this variable timestep: Navmesh agent jagged movement | Babylon.js Playground
Could this have anything to do with my monitor, it is 120hzā¦ Also tried with timestep set to 0, and I get the same result. This is really tricky to reproduce, but if you stare it long enough you might notice it too Also tricky to capture on videoā¦
Kind of wondering if this is navmesh problem after all or something deeper I used a simple animation example with cube and I get the jagged movement here as well. Not sure if the camera or the animation are the culprit? Really confused now!
I can clearly see the problem here!
I think animation and camera and working correctly ā¦ but not together.
Might be because of order of operation (camera computation before animation, or the reverse)
Do you have an idea on whatās causing that? @sebavan@Evgeni_Popov
And finally, how would we use the raw Vector3 in this playground? In line 76 we set the target camera to mesh, but using its position does nothingā¦ https://playground.babylonjs.com/#6AE0RP#4
I had looked at the TargetCamera doc, not ArcRotateCameraā¦
Indeed, ArcRotateCamera.setTarget also allows to pass an AbstractMesh.
Replacing this._targetHost.absolutePosition by this._targetHost.getAbsolutePosition() line 713 here fixes the problem, but Iām not confident enough with everyting related to the camera/input system to make the change. @Deltakosh and @PolygonalSun what do you think?
Yeah I think I see the problem too without the setTarget, but Iām not 100% sure Starting to feel like a lunaticā¦
But in my real use case, the game I am making, I am using setTarget to attach the camera to the player that is controlled by nav mesh. Would be nice to see if it looks better with the code changes to the arc rotate camera
Also @Evgeni_Popov , in the line 712, there is the call for this._targetHost.getAbsolutePosition but shouldnāt that be this._targetHost.getAbsolutePosition() ? Or why is it missing the () at the end?