Crosshair help
Crosshair help
Hi,
This is my first post so be gentle.I am creating a little demo thing to see what I can do in irrlicht and I decided on a first person shooter where you just have one level, two guys and you control one and you shoot each other.I was thinking about the crosshair and I was wondering if I could use a billboard to make the crosshair? What do you think?
Thanks,
Alex
This is my first post so be gentle.I am creating a little demo thing to see what I can do in irrlicht and I decided on a first person shooter where you just have one level, two guys and you control one and you shoot each other.I was thinking about the crosshair and I was wondering if I could use a billboard to make the crosshair? What do you think?
Thanks,
Alex
Re: reply
3-4 days ago I asked exactly the same. You have to make your weapon child of the camera and then place it good.Gameswhiz wrote:So is there a way to change the cursor using a bitmap image like make it a + instead of an arrow or is this not possible? Also should I use a billboard for the weapon(s)?
Code: Select all
scene::ICameraSceneNode* camera = sm->addCameraSceneNodeFPS();
scene::IAnimatedMesh* weaponMesh;
scene::IAnimatedMeshSceneNode* weaponNode;
weaponMesh = sm->getMesh("ak47.x"); //Your Mesh is loaded here
weaponNode = sm->addAnimatedMeshSceneNode(weaponMesh, camera, -1); //optionaly here, you could set the initial pos, rot, and scale in that order
// Your animation speed may be different so play with the value
weaponNode->setAnimationSpeed(20);
// The next few lines are the ones that have to be hand
// tweaked and you may not at first see your weapon.
// The values below reflect my weapon setting to see
// it in front of me. My weapon had to be rotated 180
// degrees as thats how I modeled it and didnt want
// to rerig it and reanimate it.
weaponNode->setScale(core::vector3df(14,14,14));
weaponNode->setPosition(core::vector3df(15,-10,30));
weaponNode->setRotation(core::vector3df(180,0,180));
Re: Reply
What file format is the shotgun model?Gameswhiz wrote:Thanks for that I'll be able to do it now.I guess I can have some fun now with my shotgun model and the homer simpson model I got from polycount heh.I'll see you guys around and thanks for the help.
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
-Japanese Proverb
This is code I use to draw simple crosshair in my demo:
Code: Select all
driver->draw2DRectangle( irr::video::SColor(100,255,100,100), irr::core::rect<s32>(300,299,500,301) );
driver->draw2DRectangle( irr::video::SColor(100,255,100,100), irr::core::rect<s32>(399,200,401,400) );
Re: Reply
it is easyGameswhiz wrote:Really is that all the code you needed to add? Just draw to rectangls? Seems too easy really.
for example for a new cursor:
core::position2d<s32> m = device->getCursorControl()->getPosition();
driver->draw2DImage (cursor, core::position2d<s32>(m.X,m.Y), core::rect<s32>(0,0,64,64), 0, video::SColor(255,255,255,255), true);
is pretty much all you need (of course you have to hide the original cursor and load a texture for cursor
Raw data for raw nerves
My main PC: Athlon XP 2800+, 512MB RAM, ATI Radeon 9700 Pro 128MB, Win2k SP4
My secondary PC: Pentium III 500 Mhz, 256MB RAM, TNT2 64, Gentoo Linux
My main PC: Athlon XP 2800+, 512MB RAM, ATI Radeon 9700 Pro 128MB, Win2k SP4
My secondary PC: Pentium III 500 Mhz, 256MB RAM, TNT2 64, Gentoo Linux
Re: Reply
If you find it too easy you can always do it in more complicated wayGameswhiz wrote:Really is that all the code you needed to add? Just draw to rectangls? Seems too easy really.
Tomasz Nowakowski
Openoko - www.openoko.pl
Openoko - www.openoko.pl
Hi, I got the crosshair in the middle using draw2DRectangle but how do I resize the rectangle? Also I am still have trouble rendering the gun infront of the camera all the time.I have created the node and loaded the mesh and texture but now what?This is code I use to draw simple crosshair in my demo:
code:
--------------------------------------------------------------------------------
driver->draw2DRectangle( irr::video::SColor(100,255,100,100), irr::core::rect<s32>(300,299,500,301) );
driver->draw2DRectangle( irr::video::SColor(100,255,100,100), irr::core::rect<s32>(399,200,401,400) );
I learned this from other guys on this forum and they are so right: http://irrlicht.sourceforge.net/docu/index.html
re:
Code: Select all
driver->draw2DLine(position2d<320>, position2d<330>);