Model IDs for creating objects


#1

A list of available model IDs can be found in the API documentation here.

To use it in your script you make calls like this:

var car = Scene.createItem('LP_Car', 0, 0, 0);
var rocket = Scene.createItem('LP_Rocket', 3, 0, 0);

#2

Hi! I see that the API document contains low poly and flexible objects - what about the new items that have been added to the library? (characters, other 3D objects, more objects)


#3

Hi @yvonne_c,

currently there’s no way to create custom-imported items or new items from the library (e.g. new characters and items in the ‘more objects’ category) with the function Scene.createItem(). Of course we’re looking into ways to make that possible :slight_smile:

If you want to duplicate items you can use the method Scene.copyItem(item: GameItem), which will create an exact copy of an item already existing in your scene. Below you can find an example of how to use this method.

Example code & scene
//We get the item we want to copy
var tiger = Scene.getItem("Tiger");

//We make a copy of the item
var tigerCopy = Scene.copyItem(tiger);

//We move the copy
tigerCopy.moveLinearLocal(2,0,0,0);
tigerCopy.say("I'm the copy!");

Keep in mind most properties of the item will be copied. That includes anything it says, its name, its position, scale, etc.

See the scene in action

Please note that this method is currently internal. Your code editor does not know the method at this time, but it will still work as intended. This method, along with others, will be made public soon.

Hope this helps!


#4

I see, thanks for your help!