Continuously Update Value on Click

Hello everyone,

In the PG below, the “value” number of a mesh is decreasing over time. However, I’m not sure how to keep this number updating continuously once the mesh is selected. For example, the mesh would be selected once with a click, then the decreasing value numbers are displayed continuously.

https://www.babylonjs-playground.com/#4UUDKU

Any help or suggestions would be greatly appreciated :smiley: :+1:

https://www.babylonjs-playground.com/#4UUDKU#1

2 Likes

This works perfectly :smiley: :+1: Thanks @Pryme8!

I have a follow-up question for @Pryme8 or anyone who might know. If the sphere in the previous PG is disposed of, how would I get “lockedTarget” to reset? New PG: https://www.babylonjs-playground.com/#4UUDKU#2

lockedTarget = false or null
Before the dispose

I see. I created a new PG that’s closer to what’s happening in my project. It involves meshes from an array that will be disposed of after a random amount of time. Notice that even when a selected mesh is disposed of, it still remains “lockedTarget.” I’m not sure how to set lockedTarget to false for all of the meshes in the array before they are disposed of at different times. Thanks again for helping with this!

https://www.babylonjs-playground.com/#4UUDKU#3

Update: solved!
Here’s the new PG in case it helps someone else:
https://www.babylonjs-playground.com/#4UUDKU#4