Jump to content

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


Dad72
 Share

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

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...