About Drag Event

Here is my code:
https://www.babylonjs-playground.com/#JZE1XK#2
I tried to make a new ball everytime I drag, but it seems that the old ones change to new location.
Maybe I attach it wrong? Thank you so much for helping out!

Hi @Ariel_Tan
You’re using the same vector3 for positioning :slight_smile:
You’ll have to copy it,

sphere.position.copyFrom(params.position);

Side-note, params.id will cause multiple of the same id’s,
dragging 2 spheres from sphere id 1, both new spheres will have id 2. (unsure if this was intentional)

https://www.babylonjs-playground.com/#JZE1XK#7

2 Likes

thank you!!!