Irrlicht basics tutorial [Note: HUGE POST]
[quote=humbrol]
ive got that part working but how do i make the nodes impassible, it tells if they touch each other but doesnt bar them from passing through each other.
[/quote]
You're kind of dumb, arent you?
you'd have to write your own code for that, so FIGURE IT OUT. Seriously, dude, my patience for you has expired. you need to:
1) Learn C++
2) Learn Irrlicht
3) Ask GOOD questions.
-Dudman
ive got that part working but how do i make the nodes impassible, it tells if they touch each other but doesnt bar them from passing through each other.
[/quote]
You're kind of dumb, arent you?
you'd have to write your own code for that, so FIGURE IT OUT. Seriously, dude, my patience for you has expired. you need to:
1) Learn C++
2) Learn Irrlicht
3) Ask GOOD questions.
-Dudman
Complete Irrlicht Beginners Tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
-
- Posts: 170
- Joined: Sun Jul 01, 2007 11:41 pm
- Location: Manchester, UK
-
- Posts: 28
- Joined: Thu Oct 04, 2007 9:03 pm
Hey thanks alot VioletAlixe!
Hehe, i kinda wish it was stickied but im sure theres a reason its not, hope i can improve it
-DudMan
Hehe, i kinda wish it was stickied but im sure theres a reason its not, hope i can improve it
-DudMan
Complete Irrlicht Beginners Tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
Oh, sorry about that, some users have been having problems with the code snippets because i used 1.2 for the code and not 1.3+.
To fix this error, you will need to replace:
with
and that should fix it
Sorry for any inconvienence!!!
-DudMan
To fix this error, you will need to replace:
Code: Select all
bool OnEvent(SEvent event) {
Code: Select all
virtual bool OnEvent(const SEvent& event) {
Sorry for any inconvienence!!!
-DudMan
Complete Irrlicht Beginners Tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
joshcryer & fireside,
yup, it's made to be quite simple, but it also fixes the key-repeat problem where holding down a key presses key once, then waits, then presses the rest of the time.
Thanks for reading/commenting on my tutorial
-dudMan
yup, it's made to be quite simple, but it also fixes the key-repeat problem where holding down a key presses key once, then waits, then presses the rest of the time.
Thanks for reading/commenting on my tutorial
-dudMan
Complete Irrlicht Beginners Tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
Hi dudMaN,
First of all, very nice tutorial!
I just started a new project using your tutorial. At the end of chapter 1, I compiled the code snippet and it gave me the following error:
'driver' undeclared identifier.'
This was the code I compiled:
If you change "video" in "driver" in this line:
IVideoDriver* video = device->getVideoDriver();
Everything should work fine
You might also wanna add "int argc, char **argv" in the argument body of the main:
int main(int argc, char **argv)
And adding "return 0" at the end of main() is good programming practice
Keep up doing the good work dudMaN!
Yustme
First of all, very nice tutorial!
I just started a new project using your tutorial. At the end of chapter 1, I compiled the code snippet and it gave me the following error:
'driver' undeclared identifier.'
This was the code I compiled:
Code: Select all
int main() {
IrrlichtDevice *device = createDevice(ETD_OPENGL);
IVideoDriver* video = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
while(device->run() && device) {
driver->beginScene(true, true, video::SColor(255,0,0,255));
smgr->drawAll();
driver->endScene();
}
}
If you change "video" in "driver" in this line:
IVideoDriver* video = device->getVideoDriver();
Everything should work fine
You might also wanna add "int argc, char **argv" in the argument body of the main:
int main(int argc, char **argv)
And adding "return 0" at the end of main() is good programming practice
Keep up doing the good work dudMaN!
Yustme
Thanks for the help yustme
-dudMan
-dudMan
Complete Irrlicht Beginners Tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
Hi I am new to irrlicht and was using your tutorial. I finished lesson 3 but when i run the program it only shows a black screen until i press A,S,W or D and after that it only shows a totally blue screen. please help me see the cube, here is my code so far copied and pasted to be sure.
#include <Irrlicht.h>
using namespace irr;
using namespace video;
using namespace core;
using namespace gui;
using namespace scene;
#pragma comment(lib, "Irrlicht.lib")
bool keys[irr::KEY_KEY_CODES_COUNT];
class MyEventReceiver : public IEventReceiver {
public:
virtual bool OnEvent(const SEvent& event) {
if(event .EventType == irr::EET_KEY_INPUT_EVENT){
keys[event.KeyInput.Key] = event.KeyInput.PressedDown;
return false;
}
return false;
}
};
int main()
{
IrrlichtDevice *device = createDevice(EDT_OPENGL);
IVideoDriver* video = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
MyEventReceiver rv;
device->setEventReceiver(&rv);
for(int x=0; x<irr::KEY_KEY_CODES_COUNT; x++) keys[x] = false;
ISceneNode* cube = smgr->addCubeSceneNode();
cube->setPosition(vector3df(0, 0, 5));
while(device->run() && device) {
if(keys[KEY_KEY_W]) {
cube->setPosition(cube->getPosition()+vector3df(0, 0, 5));
}
if(keys[KEY_KEY_S]) {
cube->setPosition(cube->getPosition()-vector3df(0, 0, 5));
}
if(keys[KEY_KEY_A]) {
cube->setPosition(cube->getPosition()-vector3df(5, 0, 0));
}
if(keys[KEY_KEY_D]) {
cube->setPosition(cube->getPosition()+vector3df(5, 0, 0));
}
video->beginScene(true, true, video::SColor(255,0,0,255));
smgr->drawAll();
video->endScene();
}
}
THANKS
#include <Irrlicht.h>
using namespace irr;
using namespace video;
using namespace core;
using namespace gui;
using namespace scene;
#pragma comment(lib, "Irrlicht.lib")
bool keys[irr::KEY_KEY_CODES_COUNT];
class MyEventReceiver : public IEventReceiver {
public:
virtual bool OnEvent(const SEvent& event) {
if(event .EventType == irr::EET_KEY_INPUT_EVENT){
keys[event.KeyInput.Key] = event.KeyInput.PressedDown;
return false;
}
return false;
}
};
int main()
{
IrrlichtDevice *device = createDevice(EDT_OPENGL);
IVideoDriver* video = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
MyEventReceiver rv;
device->setEventReceiver(&rv);
for(int x=0; x<irr::KEY_KEY_CODES_COUNT; x++) keys[x] = false;
ISceneNode* cube = smgr->addCubeSceneNode();
cube->setPosition(vector3df(0, 0, 5));
while(device->run() && device) {
if(keys[KEY_KEY_W]) {
cube->setPosition(cube->getPosition()+vector3df(0, 0, 5));
}
if(keys[KEY_KEY_S]) {
cube->setPosition(cube->getPosition()-vector3df(0, 0, 5));
}
if(keys[KEY_KEY_A]) {
cube->setPosition(cube->getPosition()-vector3df(5, 0, 0));
}
if(keys[KEY_KEY_D]) {
cube->setPosition(cube->getPosition()+vector3df(5, 0, 0));
}
video->beginScene(true, true, video::SColor(255,0,0,255));
smgr->drawAll();
video->endScene();
}
}
THANKS
I faced the same issue yesterday, but managed to sort it out by adding a camera scene node to the code.
add this before the while loop, and the code should work.
I suppose you are using version 1.4
Code: Select all
ICameraSceneNode* cam = smgr->addCameraSceneNode(0, vector3df(0,30,-45));
I suppose you are using version 1.4
Hi.
Your problem is because the cube is in the camera, making it appear black, due to the fact that the cube is black.
When you move it forward, it moves too far forward, making the screen appear blue again.
Add a camera scene node and change the move increments to 0.3 or something low instead of 5.0, and it should work better
-DudMan
Your problem is because the cube is in the camera, making it appear black, due to the fact that the cube is black.
When you move it forward, it moves too far forward, making the screen appear blue again.
Add a camera scene node and change the move increments to 0.3 or something low instead of 5.0, and it should work better
-DudMan
Complete Irrlicht Beginners Tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24898
It doesn't seem to work.or, another more "accurate" collision function:
Code:
bool collision(ISceneNode* one, ISceneNode* two) {
if(one->getBoundingBox().intersectsWithBox(two->getBoundingBox())) {
return true;
return false;
}
havent tested this one but it should work.
Add those lines to example 4:
Code: Select all
int lastFPS = -1;
anms->setDebugDataVisible(scene::EDS_FULL);
node->setDebugDataVisible(scene::EDS_FULL);
n->setDebugDataVisible(scene::EDS_FULL);
while(device->run())
{
if(n->getBoundingBox().intersectsWithBox(node->getBoundingBox()))
printf("Collision Detected");
dudMaN, (or anyone else), you know why it doesn't work?MasterGod wrote:It doesn't seem to work.or, another more "accurate" collision function:
Code:
bool collision(ISceneNode* one, ISceneNode* two) {
if(one->getBoundingBox().intersectsWithBox(two->getBoundingBox())) {
return true;
return false;
}
havent tested this one but it should work.
Add those lines to example 4:You'll see what I mean by doing it..Code: Select all
int lastFPS = -1; anms->setDebugDataVisible(scene::EDS_FULL); node->setDebugDataVisible(scene::EDS_FULL); n->setDebugDataVisible(scene::EDS_FULL); while(device->run()) { if(n->getBoundingBox().intersectsWithBox(node->getBoundingBox())) printf("Collision Detected");