Creating and removing many meshes (animation?)

Dear BabylonJSers,

I am creating an animation (or sort of) in which many lines and spheres are created and removed, continuously. Hundreds or thousands of lines and spheres are created
and removed all the time deterministically given initial user input (parameters).

The easiest way to make this with my current knowledge seems to be adding and removing meshes in the scene, without relying on BabylonJS’s animation framework directly.

It also occurs to me that it might be a good idea to create all these objects and position them
in and out of the scene as convenient.

I don’t need smooth transitions of positions, sizes or orientations, only abrupt creation and deletion of lines and simple shapes such as spheres (abrupt resizing might be convenient instead of some of the deletion and creation).

I apologize for not posting a link for a working gadget or at least a script, yet.
I will probably do so soon. I am trying to find out the answer to this question
before diving in.

I will keep this post documented if helpful to the community.

Any directions in mind?

Best regards and thanks,

You are right about animations. They are not suited for that

Except if you have enough performance because then you could animate visibility. But this could lead to bad fps if you have really a lot of sphere.

I would recommend to enable/disable meshes using mesh.setEnabled()

Thanks for the recommendation.

I was also thinking on making the spheres transparent.

Anyway, the number of lines is much greater then the spheres,
and the spheres might be held constant.

How would you assure frames per second (FPS)
in the canvas without using the animation framework?

May the animation framework be used in a context
of only abrupt creation and deletion and resizing?

As you do not need animations, animation engine will not help

FPS will be managed by the engine so you should be fine

1 Like

ok. I did not see in 101 tutorial any relation of the non-animation resources to FPS

let’s try and report back here any issue you may face :slight_smile: