Creating new instances programmatically
2 posters
Creating new instances programmatically
Hey sorry if this is a dumb question but i'm still a noob. I was wondering if there was a way to create instances of an object that's been exported in a sio2 scene at runtime. An example would be to create new billboards to simulate flying over an area or to create instances of an enemy mesh. This would be where the position of the enemy may be determined randomly instead of it's position in relation to the scene. Hope this makes sense.
josgraha- Posts : 19
Join date : 2008-12-09
Re: Creating new instances programmatically
It's already implemented, you can basically duplicate whatever you want including physic objects... the only exception is that you cannot duplicate soft bodies cuz they need to have their own proper vertices buffer in order to update the simulation.
You can find an example in tutorial06_1, where Im using a tripple tap to duplicate the current selected object.
Cheers,
You can find an example in tutorial06_1, where Im using a tripple tap to duplicate the current selected object.
Cheers,
Re: Creating new instances programmatically
Sorry I didn't mean in blender, I meant when the scene is running on the device. I know you have some naming convention thing to do trick SiO2 when creating instances inside Blender. I think what I am looking for is sio2ObjectDuplicate and maybe there is a Lua peer function. I was thinking (earlier today) that if I wanted to create a bunch of enemies I would need to clone them at runtime and add one 'master' enemy and spawn off a bunch of children when the scene is running based on game events. Adding objects in blender is kinda nice when you have a finite scene to think about but in the case of this game there could N number of enemies based on how far you have progressed through the game.
josgraha- Posts : 19
Join date : 2008-12-09
Re: Creating new instances programmatically
Heuuuuuu ya man... sio2ObjectDuplicate is exactly what you are looking for... Check tutorial06_1 for more info...
Permissions in this forum:
You cannot reply to topics in this forum