If you must make a cursor you can attach a scenenode at the camera, then set its position with vector3df(0,0,1) and so you have a nice cursor!
But remember: cursor doesn't follow the precise movement of the camera when you "shake" her with sudden movements...
P.S: bt seems that crashes! Nikooooooooo!! I've done some mistake?
---
ILightSceneNode* nodoLuce;
ICameraSceneNode * camera = inizializzaVideoCamera( smgr );
ITextSceneNode * nodoCursore;
IGUIFont * carattere = guienv->getBuiltInFont();
if( camera )
{
eventManager.registraTelecamera( camera );
//impostazioni sul colore e la luce dell'ambiente
nodoLuce = smgr->addLightSceneNode( camera, vector3df(0,10,0.0f), SColorf(1.0f, 1.0f, 1.0f ), 200, -1 );
if( carattere )
{ nodoCursore = smgr->addTextSceneNode(carattere, L"x", SColor(100,255,0,0), camera, vector3df(0,0,1) ); }
}
Make Cursors for camera in a simple way
Make Cursors for camera in a simple way
"We work in the dark, we do what we can, we give what we have, Our doubt is our passion and our passion is our task. The rest: is art of Madness" (H.James)
Hi,
I do not know if I exactly understood your intention, but I did something similar by attaching a billboard to the camera as a child (after postitioned the billboard into the right "depth". There I can use every picture I like for the billboard (here as a crosshair-texture):
This doesn't crash. Maybe you have to initialize the billboard within the scene is drawn to let it be in the foreground, I don't know how to get this.
To do this with a text line as in your example, I had a closer look at the magic "font.bmp": Realise there are pics of the letters inbetween yellow and red points. I choose a letter I will not use in the game (the "@" e.g.),
and then draw an own picture (of a crosshair) instead of the letter.
The result looks better than an "x". There was no need to attach it to the camera, because it helds it's position.
I do not know if I exactly understood your intention, but I did something similar by attaching a billboard to the camera as a child (after postitioned the billboard into the right "depth". There I can use every picture I like for the billboard (here as a crosshair-texture):
Code: Select all
scene::ISceneNode* crosshair = 0;
crosshair = smgr->addBillboardSceneNode(crosshair,
core::dimension2d<f32>(50, 50));
crosshair->setMaterialFlag(video::EMF_LIGHTING, false);
crosshair->setMaterialTexture(0, driver->getTexture
("c:/key/crosshair.png"));
crosshair->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
crosshair->setPosition(core::vector3df(0,0,150));
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setPosition(core::vector3df(-50,50,-150));
camera->addChild(crosshair);
To do this with a text line as in your example, I had a closer look at the magic "font.bmp": Realise there are pics of the letters inbetween yellow and red points. I choose a letter I will not use in the game (the "@" e.g.),
and then draw an own picture (of a crosshair) instead of the letter.
The result looks better than an "x". There was no need to attach it to the camera, because it helds it's position.
![Image](http://www.dreams-2-illusion.com/images/cube_klein.gif)
-
- Posts: 395
- Joined: Fri Apr 08, 2005 8:46 pm
Little addon
If you set this flag,then others objekts dont came between cursor and camera ![Wink ;)](./images/smilies/icon_wink.gif)
Or you can do this:
Then you can use any model for cursor,(not tested)but i think it is posible to use animated .x or .md2 to change cursors states(on objent,pick,use,move etc..)
Good luck!
![Smile :)](./images/smilies/icon_smile.gif)
Code: Select all
scene::ISceneNode* crosshair = 0;
crosshair = smgr->addBillboardSceneNode(crosshair,
core::dimension2d<f32>(50, 50));
crosshair->setMaterialFlag(video::EMF_LIGHTING, false);
crosshair->setMaterialTexture(0, driver->getTexture
("c:/key/crosshair.png"));
crosshair->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
crosshair->setPosition(core::vector3df(0,0,150));
//---NEW-----------
crosshair->setMaterialFlag(video::EMF_ZBUFFER,false);
//-------------------
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setPosition(core::vector3df(-50,50,-150));
camera->addChild(crosshair);
![Wink ;)](./images/smilies/icon_wink.gif)
Or you can do this:
Code: Select all
scene::ISceneNode* crosshair = 0;
//change this to your mesh(animated hand or smf.)
crosshair = smgr->addTestSceneNode();
crosshair->setMaterialFlag(video::EMF_LIGHTING, false);
crosshair->setMaterialTexture(0, driver->getTexture("media/texture.jpg"));
//disable transparent if you dont neet it in your mesh
//crosshair->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
crosshair->setPosition(core::vector3df(0,0,150));
//rotate to look more interesting :)
crosshair->setRotation(core::vector3df(45.0f,45.0f,0));
//---NEW-----------
crosshair->setMaterialFlag(video::EMF_ZBUFFER,false);
//-------------------
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setPosition(core::vector3df(-50,50,-150));
camera->addChild(crosshair);
Good luck!