Hello, I’m just create a like temple run game. But I can’t realize how can I load models and don’t know which way is correct for this. I’ve lots of models converted with .awd format. But still don’t know how can I setup all models and position objects correcly.
sorry for english isn’t my mother tongue. and thank you so much!
Here is my simple approach something like this
Main class:
var models:LoadModels = new LoadModels();
models.loadModel("player.awd");
models.loadModel("banana.awd");
models.loadModel("coin.awd");
models.loadModel("mountains.awd");
models.loadModel("ground.awd");
LoadModels class :
private var modelDictionary:Dictionary;
private var loader:Loader3D;
public function LoadModels()
{
modelDictionary = new Dictionary();
}
public function loadModel(path:String):void
{
Parsers.enableAllBundled();
loader = new Loader3D();
loader.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete);
loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
loader.load(new URLRequest("models/"+path));
}
private function onResourceComplete(event:LoaderEvent):void
{
trace("loaded resource");
}
private function onAssetComplete(event:AssetEvent):void
{
trace("loaded assets");
}