Sign in to follow this  
Dad72

Variable reassign when moving meshes, cameras, lights...

Recommended Posts

I explain the problem: I record a first camera position in a variable. Then I move the camera to compare in the state the new position of the camera and the variable in the old position.

The problem is that the variable is reassigned in real time when the camera is moving, which I find very strange. The variable should not be changed.

See in this PG and the console. Click once on the button to save the variable. Then move the camera, the variable changes all alone. So at the second click on the button, the alert is never reached, because the variable has the same value as the new position of the camera, while the record was made on an old camera position.

https://www.babylonjs-playground.com/#XCPP9Y#744

If we look at this PG more simple, it's the same thing :

https://www.babylonjs-playground.com/#XCPP9Y#745

It's something I saw a long time ago, but that did not bother me, but here I can not record a camera position to compare it to a new position without the variable being rewritten by the Holy Spirit, LOL.

[Edite] : This does not seem to be related to Chrome 71. I have tried FireFox and Opera too and it's the same thing. So I think that the Babylon reassigns the variables that it has to assign, maybe the light as well as something else in Babylon reassigns the variables that it has to assign.  I will check it

Yes, the lights too. As soon as the light is moved, it rewritten the variable that it has assigned previously. I think that all entities in Babylon are rewritten the variables automatically.

https://www.babylonjs-playground.com/#XCPP9Y#746

So currently, we can no longer record transformations (position, rotation, scale and other modifications) in a variable to preserve previous states and compare them with new transformations. This is a big problem for the editor that one develops

 

Share this post


Link to post
Share on other sites

Ok, so we have to clone all the recordings that we make ?

I think it's something that should be indicated somewhere in the documentation, because it's not easy to know or not intuitive.

Thank you Sebavan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.