Collision HELP!

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
[BROKEN]
Posts: 12
Joined: Thu Mar 03, 2005 11:56 am

Collision HELP!

Post by [BROKEN] »

Hi, I'm pretty new to Irrlicht...

I did the collision tutorial, and it makes pretty gd sense to me, but I have a few questions:

1) Is collision only that easy when its a bsp map? bacause when i replaced it with a .x world, i fell through the floor

2) How would i set collision with objects in the world, such as the faeries in the tutorial?

3) whats the best way to do user input, like if escape is pressed, exit? Cause the input tutorial showed a very bad method of user input and didnt make much sense

THANKS!!!!
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

1) It should be that easy as every format is internally just a bunch of vertices and other geometry data. I think you're modifying the Collision tutorial (nr 7)? Then your problem could be caused by the "q3node->setPosition(core::vector3df(-1370,-130,-1400));" line. Try removing it.

2) This has been described previously already somewhere in the forums. Try searching.

3) Maybe have a look at the Techdemo, it's shows how to do this.
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
[BROKEN]
Posts: 12
Joined: Thu Mar 03, 2005 11:56 am

Post by [BROKEN] »

Thanks mate, sorry but I have another question.

I'm making a small wrapper around irrlicht for a game, but in my classes, I can never use smgr(scene manager) even though its declared in main.cpp

This is prob a real newb question, sorry.
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

Its only got scope for the main.cpp. This means that you will have to pass it to other functions as a parameter, I usually take a copy of it in classes where it is going to be used alot.

I'd tell you a little more about scope, but you should be able to find information about it within a help file, and if not then you defo can at MSDN within there help files.[/quote]
[BROKEN]
Posts: 12
Joined: Thu Mar 03, 2005 11:56 am

Post by [BROKEN] »

ok so i make a function in sum cpp file like

int getSmgr()
{
scene::ISceneManager* smgr = whetever;
return smgr;
}

and i call that and store it in an smgr variable in each source i wanna use it in?
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

Well you'd get a compiler error if you tried to compile that because your returning an ISceneManager rather than an integer.
ISceneManager* getSmgr()
{
ISceneManager::* smgr = mp_Device->getSceneManager();
return smgr;
}
Not sure whether thats really the best way to do because you've got the overhead of calling the get function everytime you want the Smgr, and aslo your creating a new instance of it everytime as well. Also it wouldn't work because you need the device, so that would have to be passed in all the time too... Its kinda getting compilcated even as I'm thinking about it.
[BROKEN]
Posts: 12
Joined: Thu Mar 03, 2005 11:56 am

Post by [BROKEN] »

Oh i got it, place the definitions in a cpp file, and put the externs calling them in a header and declare that wherever i need em, thanks a bunch!
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

It depends whether your writing an Object Orientated system or not, personally I wouldn't have them as externs, but it may be appropriate for what your doing...
Post Reply