Added a physics capable model on the fly.
3 posters
Added a physics capable model on the fly.
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
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
Re: Added a physics capable model on the fly.
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,
Cheers,
re-adding a physics based object
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
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
Re: Added a physics capable model on the fly.
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: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?
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.matthew wrote:also, how do I make a 3d object "invisible or visible" using sio2?
Best,
Matt
Similar topics
» 28 FPS with particle system added to Tutorial06?
» physics object inside another physics object
» model disappears when doing sio2ObjectSoftCopy
» Problem in tutorial 02 using my own model
» Using Md5 model format
» physics object inside another physics object
» model disappears when doing sio2ObjectSoftCopy
» Problem in tutorial 02 using my own model
» Using Md5 model format
Permissions in this forum:
You cannot reply to topics in this forum