Skip to content
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.

Methods

Method(s) Description
static StaticObject create(string modelName) Creates an object using a loaded model with the specified name

Examples

Sync model loading and creation

	# 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")

Async model loading and creation

	# 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")
Clone this wiki locally