-
Notifications
You must be signed in to change notification settings - Fork 26
StaticObject
Alessandro Febretti edited this page Feb 8, 2014
·
4 revisions
module cyclops extends Entity wraps cyclops::StaticObject
Represents an instance of a loaded 3D model.
Method(s) | Description |
---|---|
static StaticObject create(string modelName)
|
Creates an object using a loaded model with the specified name |
# Load a torus model
mi = ModelInfo()
mi.name = "torus"
mi.path = "cyclops/test/torus.fbx"
scene.loadModel(mi)
# Create a green torus
t1 = StaticObject.create("torus")
t1.setPosition(Vector3(-1, 0, 0))
t1.setEffect("colored -d green")
# Create a red torus
t1 = StaticObject.create("torus")
t1.setPosition(Vector3(1, 0, 0))
t1.setEffect("colored -d red")
# Same as the previous example, but uses asynchronous loading
mi = ModelInfo()
mi.name = "torus"
mi.path = "cyclops/test/torus.fbx"
# After this call control returns immediately to the script.
# onTorusLoaded() will be called once the model is done loading.
scene.loadModelAsync(mi, "onTorusLoaded()")
def onTorusLoaded():
# Create a green torus
t1 = StaticObject.create("torus")
t1.setPosition(Vector3(-1, 0, 0))
t1.setEffect("colored -d green")
# Create a red torus
t1 = StaticObject.create("torus")
t1.setPosition(Vector3(1, 0, 0))
t1.setEffect("colored -d red")