Added a physics capable model on the fly.

View previous topic View next topic Go down

Added a physics capable model on the fly.

Post  matthew on Mon Nov 17, 2008 8:23 pm

Hello All,

Does anybody know (and can You please tell me) the best way to add a "New" 3d object to a scene with physice. I'd like to implement a 3-d shoot game where i can add an object (bullet, bomb, whatever) in front of an object on the fly. From my research, it looks like I need to add a 3d object from a file I exported from Blender, then get it from a file using the SIO@ rsrc manager. Then I can add velocity & direction using Bullet (correct?). Also how do I tag a 3d object for so I can locate it in software?

Thanks in advance for any help,
Cheers.

Matthew

matthew

Posts : 64
Join date : 2008-11-12

View user profile

Back to top Go down

Re: Added a physics capable model on the fly.

Post  sio2interactive on Tue Nov 18, 2008 4:45 am

Checkout the sio2ObjectDuplicate method, what you can do is preload all your objects and put them invisible and then duplicate them on the fly and turn them visible. Browse the forum for and example on how to do it (I post it somewhere but don't remember where...)

Cheers,
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

re-adding a physics based object

Post  matthew on Tue Nov 18, 2008 2:03 pm

thank you very much for you're reply. i still have a question though.
i noticed in the demo tutorials that there is a templateLoading() routine.

i thought i would be called one at startup time, but its called every time a frame is rendered instead.
it looks like it opens a file, retrieves some 3d objects, etc.
coudn't performance be enhanced by doing this just 1 once during the app initialization process?

also, how do I make a 3d object "invisible or visible" using sio2?

cheers

matthew

Posts : 64
Join date : 2008-11-12

View user profile

Back to top Go down

Re: Added a physics capable model on the fly.

Post  matt on Tue Nov 18, 2008 3:36 pm

matthew wrote:i thought i would be called one at startup time, but its called every time a frame is rendered instead.
it looks like it opens a file, retrieves some 3d objects, etc.
coudn't performance be enhanced by doing this just 1 once during the app initialization process?
From my understanding, the sole purpose of this particular implementation is to demonstrate how some kind of progress display could be implemented. Displaying a simple frame doesn't cost very much but keeps the user entertained while loading.

matthew wrote:also, how do I make a 3d object "invisible or visible" using sio2?
Try sio2EnableState( &yourObject->flags, SIO2_OBJECT_GHOST ); - but note that this makes an object invisible but still lets it interact with the physics world. If you want to disable that, too, remove it using sio2PhysicRemoveObject. Note that under certain circumstances, you need to unmap the VBO using sio2ObjectUnmapBuffer in order to access the vertex information before adding an object to the physics world.

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

thanks for replying.

Post  matthew on Tue Nov 18, 2008 4:02 pm

thank you very much for the reply matt.

matthew

Posts : 64
Join date : 2008-11-12

View user profile

Back to top Go down

Re: Added a physics capable model on the fly.

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