Update DragControls array of objects

Just add the new object to the array. Something like this:

var controls = new DragControls( objects, ...);

// 5 minutes later ... add a new object to the list of draggable objects

objects.push( new_object ); 

Here is a live demo. Click the button to add a new draggable cube:

https://codepen.io/boytchev/full/zYJMgde

image

Off-topic advice

2 Likes