three.js swap objects

  • Started
  • Last post
  • 1 Response
  • wwfc

    hoping that someone/anyone might know how to easily swap cube instances for spheres?

    i am trying to replace multiple cubes for spheres - but can't work it out - i tried (the lump hammer to crack a nut) find and replacing all 'cube' for 'sphere' refs... but i am still getting cubes on the stage!

    is there any catch all code that would simply swap the cubes created for spheres?

    i am easily able to change a single cube for a single sphere in a canvas - but the swapping of geometry in the other document just won't seem to work :-(

    any pointers as to what i should be looking at or reading?

    can't find any tuts on the process... so maybe i am barking up the wrong tree!!

  • section_0140

    I haven't used this framework, but I've done a fair bit of 3d programming.

    Swapping these objects should be as easy as:

    1. Get the Vector (x,y,z) location of the cubes
    2. Destroy the cubes
    3. Draw Spheres at the location you stored in step 1