Creating new instances programmatically

View previous topic View next topic Go down

Creating new instances programmatically

Post  josgraha on Sat Feb 07, 2009 11:13 pm

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

View user profile

Back to top Go down

Re: Creating new instances programmatically

Post  sio2interactive on Sat Feb 07, 2009 11:46 pm

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,
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Creating new instances programmatically

Post  josgraha on Sun Feb 08, 2009 12:41 am

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

View user profile

Back to top Go down

Re: Creating new instances programmatically

Post  sio2interactive on Sun Feb 08, 2009 12:47 am

Heuuuuuu ya man... sio2ObjectDuplicate is exactly what you are looking for... Check tutorial06_1 for more info...
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Creating new instances programmatically

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum