How to add an entity dynamically?

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
caoyanfeng
Gnoblar
Posts: 3
Joined: Mon Jul 25, 2022 2:33 pm

How to add an entity dynamically?

Post by caoyanfeng »

I have read the official guide, such as https://ogrecave.github.io/ogre/api/lat ... scene.html.
I want to know how to dynamically create a node and add a entity. Is it added in this callback ?

Code: Select all

bool frameStarted(const Ogre::FrameEvent& evt)

If the answer is yes,I doubt whether adding too much code will cause frame delay ?

Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Re: How to add an entity dynamically?

Post by Lax »

Hi,

you can add your entity where you want. If you derive from FrameListener, you can add your entity each frame in the FrameStarted function. Or you write your own game loop and call RenderOneFrame from Ogre and add your entity...

See also this page for some tutorials:
https://wiki.ogre3d.org/Tutorials

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

Post Reply