Position issue with ArcRotateCamera on babylonjs 4


#1

Hi,
encountered some issue when testing babylon 4 alpha version (25).
Created small example but could not reproduce issue there.
PG

So for me after updating camera target position, camera don’t update. Managed to find out that absolute position of camera target is not updated its still 0,0,0.

After trying to access it to log out it is updated and camera jumps to correct position.

This issue / fix was introduced between alpha version 2 and 3.

Any ideas ?

Thank you.


#2

Hi @Hersir

I think you confused Mesh.CreateBox with MeshBuilder.CreateBox
The Mesh constructor doesn’t take options object.

https://www.babylonjs-playground.com/index.html#3HRWMF#1


But i’m unable to reproduce your issue, are you sure you’re using the latest alpha? (maybe browser cache?)
There was a bug in the arcRotateCamera a few days ago which was fixed.


#3

Hi, @aWeirdo yes fixed typo, but it was not impacting anything.

I use babylon 4 alpha 25 from npm and this bug is there since babylon 4 alpha 3 from npm


#4

I cannot repro on the PG either so this could be related to the error I fixed recently.
Can you confirm that you repro in the PG linked by @aWeirdo ?


#5

I think I have also this issue on one of two scene after updating to the latest alpha.
The setPosition value are a bit off when they are launched from the code. If I reapply them everything is fine.

I will investigate this further tomorrow.


#6

Alright,

Just took some time to check it.
https://www.babylonjs-playground.com/index.html#3HRWMF#5
I think the issue comes from the setTarget function.

If the target is something else than a Vector3.Zero() there is some changes.
You can see what’s happening with the pg just by commenting the setTarget or not.

Hope this help :slight_smile:


#7

So far your PG seems to work ok for me:)

You call setTarget which means that the camera is locked on a target.
Then you move it so the camera will rotate to keep the target in the center of the screen

Whate are you seeing wrong in your PG? Or waht would have you expected to see?


#8

I use the same value with both setPosition().
We shouldn’t have a difference between the two.

If you comment setTarget() in the playground the result is the same for both setPosition call.

That’s why I thought there was a bug with the use of setTarget()


#9

oh woot! yeah… Didn’t see that

Let me check what is wrong


#10

Bug will be fixed with next nightly!

thanks for reporting it!


#11

Thank you !

You are the best :slight_smile: