Page 1 of 1

collision with .irr maps

Posted: Thu Nov 15, 2007 2:00 pm
by xfreakk
Hi everyone I know that there is an example for collision in q3 maps but im not sure how to port this for an Irr map.

Posted: Thu Nov 15, 2007 2:26 pm
by rogerborg
I profess ignorance of all thing IrrEdit, but it strikes me as a very good idea to add an .irr to the sample media and to at least one of the example projects. Does anyone who uses IrrEdit fancy doing that?

Posted: Thu Nov 15, 2007 2:33 pm
by xfreakk
i use irredit because of simplicity. Im not an a mapper or modeler so i just need maps to test out my stuff. I guess i could test out my code on q3 maps.
But yea there is only one example on irr maps.

Posted: Thu Nov 15, 2007 5:15 pm
by hybrid
Example 15 already loads from .irr file and so we also have an example. Just no collision response there. But one can find mayn of such example in this forum.

Posted: Thu Nov 15, 2007 5:48 pm
by rogerborg
Oh, the cunningly titled "LoadIrrFile" example. I guess that demonstrates that not only do I not use IrrEdit, that I have some sort of hysterical blindness regarding it. ;)

Posted: Fri Nov 16, 2007 5:56 am
by Deuce
Check out the wiki at "http://www.irrlicht3d.org/wiki/index.ph ... gCollision" That has everything you need =), there is an error in the code, he uses "and" instead of "&&"

Posted: Fri Nov 16, 2007 9:00 am
by hybrid
That's not an error, it's just another keyword which can be used in place of &&. However, it's less known to C/C++ programmers.

Posted: Fri Nov 16, 2007 11:05 am
by rogerborg
hybrid wrote:That's not an error, it's just another keyword which can be used in place of &&. However, it's less known to C/C++ programmers.
Um... which C/C++ compilers treat 'and' as a keyword?

Posted: Fri Nov 16, 2007 11:33 am
by Saturn
Maybe gcc allows them, but Visual C++ and Borland don't. But it is indeed part of the C++ standard. ISO 14882 sections 2.5 and 2.11.

Posted: Fri Nov 16, 2007 5:40 pm
by vitek
Yes, these alternative tokens are indeed part of the C++ standard. Unfortunately the Microsoft compiler disables the functionality as an extension that is enabled by default.

If you compile with /Za to disable extensions or include iso646.h the alternative tokens work fine. You should not be required to include the header, but the Microsoft compiler uses this to allow them to disable the extension by default and still provide a way for users to have access to the language feature.

Here is the compile result [msvc7.1]

Code: Select all

C:\Documents and Settings\tvitek>type u.cpp
int main ()
{
  return 1 and 3;
}
C:\Documents and Settings\tvitek>cl /nologo t.cpp
t.cpp
t.cpp(218) : error C2146: syntax error : missing ';' before identifier 'and'
t.cpp(218) : error C2065: 'and' : undeclared identifier
t.cpp(218) : error C2143: syntax error : missing ';' before 'constant'

C:\Documents and Settings\tvitek>cl /nologo /Za t.cpp
t.cpp

C:\Documents and Settings\tvitek>
Here are links to the MSDN docs on the subject of extensions...
msvc71
msvc80

Travis

Posted: Fri Nov 16, 2007 6:24 pm
by rogerborg
Well, you live and learn. Thanks for the references, chaps. I guess I'm just an old fashioned C Luddite at heart. ;)

Posted: Fri Nov 16, 2007 6:31 pm
by bitplane
I didn't know that either, always nice to learn something new.
I've changed the example to use && though, to avoid future confusion :)

Posted: Fri Nov 16, 2007 6:36 pm
by vitek
Yeah, there are many things in the C++ standard that most guys don't know. I pick up some interesting tidbit every few days just reading the standard as part of my work.

Travis

Posted: Sun Nov 18, 2007 4:51 pm
by christianclavet
Hi. Not sure you have been answered. For quick response.

1. You will have to load your level as an OCCTREE in IRREDIT
2. Take this snippet code (working with IRRlicht 1.2 and 1.3.1)
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=23707

This snippet was created mostly by things learned from Vitek(Travis). I'm using it to load all my levels and apply collision to the environnement. The only thing that is neccessary is that you load your mesh as an OCCTREE in IRRedit (The snippet will search the scene graph and put all the OCCTREE in selector, add them to the metaselector that will be used in the collisionResponseAnimator for the camera).

Posted: Thu Nov 22, 2007 4:09 am
by Lorka
Christianclavet, if you've built a map in 3DS and import to Edit as an Octree, Edit won't light it. Whats the best way to light the scene before importing as an Octree?