3d elements in an overlay - Please Help!

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
Arkos
Gremlin
Posts: 157
Joined: Wed Apr 26, 2006 12:30 am
Location: Michigan, United States

3d elements in an overlay - Please Help!

Post by Arkos » Fri May 12, 2006 7:51 am

Hello All,

in the manual it says:
manual wrote:Within an overlay, you can include any number of 2D or 3D elements. You do this by defining a nested block headed by:

'element'
if you want to define a 2D element which cannot have children of it's own
'container'
if you want to define a 2D container object (which may itself have nested containers or elements)

The element and container blocks are pretty identical apart from their ability to store nested blocks. .
So the manual goes on to tell you how put 2d elements in an overlay, but as far as I can tell it does not tell you how to put a 3d element into an overlay. Am I missing something.

Basically I would like to have a 3d mesh rotating in an overlay. Would the coordinates for positioning be the same with 3d? Please help!!
0 x

User avatar
celic
Gnome
Posts: 363
Joined: Wed Mar 23, 2005 11:05 am
Location: Chisinau/Moldova
Contact:

Post by celic » Fri May 12, 2006 8:31 am

AFAIK, you should create manually the sceneNode.
I guess this thread will help you:

http://www.ogre3d.org/phpBB2/viewtopic. ... y++element

ps: use the search feature before asking questions.
0 x

User avatar
Arkos
Gremlin
Posts: 157
Joined: Wed Apr 26, 2006 12:30 am
Location: Michigan, United States

Post by Arkos » Sat May 13, 2006 9:14 pm

Thanks celic, that helped a lot.

The link contains the code:

entity = mSceneMgr->createEntity(name,mesh);
node = mSceneMgr->createSceneNode(name);
node->attachObject(entity);

OverlayManager& overlayMgr = OverlayManager::getSingleton();
Ogre::Overlay* overlay = overlayMgr.create("WeaponOverlay");
overlay->add3D(node);
overlay->show();

Note that the scene node must be created manually. The ogre api search for "add3D" was helpful :)
0 x

User avatar
Arkos
Gremlin
Posts: 157
Joined: Wed Apr 26, 2006 12:30 am
Location: Michigan, United States

Post by Arkos » Tue May 16, 2006 9:26 pm

ok so I found out that when you call add3D() to add a 3d element to an overlay, ogre attaches that object to your current camera. So when you are flying around, the object follows with the camera.

As an example, if you had a multiplayer fps game and one character was looking at another, the first character would see a 3d object floating in front of the second player's head. The second player would also see this object floating around his head but since it moves with the camera, it would appear as a stationary part of his hud. I am rather surprised OGRE works like this, I had expected other players not to be able to see the 3d hud elements of others.

Anyways I have decided to use render to texture for my application. I render the 3d mesh somewhere in my world and have a camera focused on it. Then I have that camera RTT and I use that texture in a CEGUI window. The demo gui has a great example of this!
0 x

User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
Contact:

Post by pjcast » Tue May 16, 2006 9:36 pm

In a multiplayer game you do not need to have the other player (or all players) share the exact same scene node hierarchy.

Note, that I am neither for or against the current implementation, i have not used it, nor looked at it, it may well need some fixes.
0 x
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/

Post Reply