the DLL is the standard VC++ compiled, wich came with the irrlicht SDK ver. 4.2. I cant even compile the DLL myself because I do not have the DIRECTX sdk. You must use the dll that is in bin\visualstudio\irrlicht.dll, instead of the one in bin\devcpp\irrlicht.dll, because my example EXE is compiled in vc++.
I use 3 vectors to represent the orientation of the cam, one for,
UP: represented by upvec and oldupv, ignore the [player1-], it just there to let me use the same function for different cams, because my prog is split screen with 2 cams remember?
LEFT: lvec and oldlvec, is a vector that points to the left of the cam(tough could be right, its just a name)
FRONT: target and oldtarget, they point in front of the cam.
I rote the cam, by transforming the target(where the cam always looks at)
trough a value given by my mouse(X,Y, but only the difrence between the currend and last position.) multiplied by the corresponding vector(lvec,upvec and target), this is stored in a new vector wich I use with the rotate() function from the matrix class. After that I use transform() to create the new target. The oldupv etc. i use to multiply the mouse with next time round(these are vars that exist, and keep their data out of the animateloop).
Maybe there is a better way(most probably) but hey, it works
Moving a node based on rotation
-
Ameise
you can just use the devcpp/irrlicht.dll with your defcpp code, its just not compatible with the exe that I compiled. try it, it will work if you do everything right(I've tried it myself).
The problems you are having are based on the fact that the cam->upvector is alway pointing upward in relation to the world x,y,z. So when the targetvector is pointing full up or down(so you look at the sky, or at your feet) the cam is programmed to rotate itself, so that the cam is never upside down. I tried to change only the upvector, so it will never rotate, but if you try this, the cam does not behave right anymore, and then it rolls around the (world!)X axis instead of the Y axis, so you just shift the problem. But you can experiment with it to come up with a better solution. I do not think you can use the FPS cam for this, because some func's arent working correct(settarget). And you cannot get the data to transform the upvector verry easy(but I could be wron here)
So its all in the UpVector. Just experiment like I did, and if you find a solution wich works better for this problem, please let me know.
The problems you are having are based on the fact that the cam->upvector is alway pointing upward in relation to the world x,y,z. So when the targetvector is pointing full up or down(so you look at the sky, or at your feet) the cam is programmed to rotate itself, so that the cam is never upside down. I tried to change only the upvector, so it will never rotate, but if you try this, the cam does not behave right anymore, and then it rolls around the (world!)X axis instead of the Y axis, so you just shift the problem. But you can experiment with it to come up with a better solution. I do not think you can use the FPS cam for this, because some func's arent working correct(settarget). And you cannot get the data to transform the upvector verry easy(but I could be wron here)
So its all in the UpVector. Just experiment like I did, and if you find a solution wich works better for this problem, please let me know.
-
[dx/x]=HUNT3R
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
Ameise, you might want to check out the camera modifications I made to Irrlicht for my game Supa G. They are all in the CCameraSceneNodeFPS.cpp and you can download my whole Irrlicht v0.4.1 modified source code in the downloads section of my website. But my SupaG.dll and SupaG.lib are made for MS VC++6.0 so you'll have to recompile the source for Dev C++ if that's what you're using.
-
[dx/x]=HUNT3R
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
Phunk I sent you a PM too but I'll post here as well. Actually I've been working on that for a few months now. My other programmers were supposed to take care of it and never did. I've been trying for a while to save a left vector to use to recalc the up vector and I've posted the problem in the forum many times in the past, but I wasn't sure of how to do the mat.setRotationDegrees until I saw how you did it in your example. I already put your name on my thank you list, just haven't got there yet. I just around to thanking Cleves for his font he gave me about 4 months ago
So yes, thank you for posting that. I'm working on a rotation control right now that will allow the player to rotate left and right sideways in order to level off if they get turned all upside down and everything. I'll of course post the code to that too when I get around to it.
