fps weapon positioning

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
shabadam
Posts: 10
Joined: Sat Jul 03, 2004 11:39 am
Location: Italy

fps weapon positioning

Post by shabadam »

Anybody knows what is the simplest way to show a .md2 weapon in front of the fps camera , and keep it there while moving ? I'm a good c/c++ programmer , but I have no prior experience with 3d graphics. I would like to make a simple fps shooter , but I don't know how to place the weapon and the HUD. Please , help me !
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Attach the weapon model to the camera and it will follow the camera movements.
DanyATK
Posts: 32
Joined: Mon Mar 22, 2004 8:40 pm
Location: Italy
Contact:

Post by DanyATK »

Yes... :roll:
But... how i can attach the weapon model to the camera? CODE please :cry:
The best italian GM related site
www.gamemaker.it
Guest

Post by Guest »

DanyATK wrote:Yes... :roll:
But... how i can attach the weapon model to the camera? CODE please :cry:
I agree with DanyATK , what code do I need to create a child to ICameraSceneNodeFPS ? The documentation to irrlicht does not help very much...

Here is the question : I have created a IAnimatedMeshSceneNode called "gun" , with .md2 model and textures. The gun appears in the screen , and I can position it in the 3d space. But its position is obsiously fixed. How can I attach the model to the camera in order to make in follow my movements ?
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

It's so damn easy :)

camera = your camera, you don't need to add this new one
gunmesh = the mesh that contains your gun model
gun = your animated scene node

Code: Select all

camera = smgr->addCameraSceneNodeFPS(); 
gunmesh = smgr->getMesh("gunmodel.md2");  //your mesh is loaded here
gun = smgr->addAnimatedMeshSceneNode(gunmesh, camera, -1);  //this is the important line where you make "gun" child of the camera so it moves when the camera moves

//Tweak all these values, they're different for each model:
gun->setScale(core::vector3df(14,14,14));
gun->setPosition(core::vector3df(15,-10,30)); 
gun->setRotation(core::vector3df(180,0,180)); 
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

DanyATK wrote:Yes... :roll:
But... how i can attach the weapon model to the camera? CODE please :cry:
Try reading the API instead of acting like I said something idiotic. It is what it is there for.
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

I posted a tutorial on this a while back. Also someone about 2 days ago posted this same question. Would it've been too hard to do a search???

I post my case again, we should have posting guidelines for these forums:
http://irrlicht.sourceforge.net/phpBB2/ ... ting+rules

I'll make another post today. Frankly, i've been annoyed with some of the stuff on these boards. I've actually gotten to the point where i don't even read half the posts. ex. for the beginner's forum, i look at the topics, for half of them i think "its been answered before" and press mark all topics read. I firmly believe that if we have these rules, it'd make this forum 100% better, and the community will come off as much more knowledgeable as a whole. Currently using other engine's, every other one i've worked with is under the impression that the community is a bunch of newbies. I know that this commu. is not 100% newbies, and though there are some, the newbieish clutter could be eliminated by following those rules.

So, now that this thread is way off target....... Please...Please... for the good of this community begin to follow the rules :'(
The Robomaniac
Project Head / Lead Programmer
Centaur Force
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

You're right Robomaniac. It was me who answered exactly the same question 2 days ago. But, the search engine of this forum is also one of the crappiest I ever saw. No matter what you search for, you'll get +40 pages with stuff that doesn't matter.
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

creative use of AND (all caps, and not + like most other engines) narrows the search down, ex. a quick search of :

fps AND weapon turned up only 2 pages, most with the question answered somewhere

the search isn't shitty, just the keywords that ppl use are shitty. ex. searching for fps weapon would turn up every post in the forums with fps or weapon in them somewhere. as would fps + weapon and it'd also include everything w/ a + :D

AND, NOT, OR are the keys ;)
The Robomaniac
Project Head / Lead Programmer
Centaur Force
Post Reply