We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

How to Move Objects in a Scene without Using Animations

Home Forums Programming How to Move Objects in a Scene without Using Animations

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1062
    jem
    Customer

    I hope this post can provide a useful hint to other users.

    I have a project where I need to move objects in a scene to arbitrary coordinates. I could not use animations. I wanted to use puzzles as much as possible, but there is no set_position operation block today.

    I was able to call the Three.js code from my puzzle move the objects to the proper coordinates. It was easy. Here is my function.

    	//Set the absolute positions of an array of objects to an absolute coordinate
        v3dApp.ExternalInterface.set_leg_pos = function(objs, x, y, z) {
    		for (var i = 0; i < objs.length; i++) {
    			var obj = v3dApp.scene.getObjectByName(objs).position.set(x, y, z);			
    		}
        };

    This function is called by a “call JS function” block.

    -Jem

    Jeremy Wernick

    #1063
    jem
    Customer

    oops. My square bracket notation after “v3dApp.scene.getObjectByName(objs” was eaten by the forum’s parser.

    See screen shot for a better view of this code.

    Jeremy Wernick

    #1065

    Hi Jem,

    Thanks for providing this example. Your feedback helps us to prioritize features too.

    Chief 3D Verger | LinkedIn | Twitter

    #1071
    Will Welker
    Customer

    This is cool. :good:
    Opening up the vast array of existing three.js features is an important part of Verge3D.

    #1077

    implemented ‘set object transform’ puzzle; also ‘snap to object’ to do it without numbers

    Attachments:
    You must be logged in to view attached files.

    Chief 3D Verger | LinkedIn | Twitter

    #1080
    jem
    Customer

    Awesome!
    -Jem

    Jeremy Wernick

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.