Moving a node based on rotation

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.
Ameise

Moving a node based on rotation

Post by Ameise »

Ok, so, I have a node (a camera), and I can rotate it. However, I want it, so when I apply THRUST (stored in variable speed) it will move in the direction of it's rotation. To make it more complex, the speed of it's movement should be based on SPEED. Every integer (IE, speed = 1) is one unit / second.

Any ideas?
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Re: Moving a node based on rotation

Post by rt »

Ameise wrote:Ok, so, I have a node (a camera), and I can rotate it. However, I want it, so when I apply THRUST (stored in variable speed) it will move in the direction of it's rotation. To make it more complex, the speed of it's movement should be based on SPEED. Every integer (IE, speed = 1) is one unit / second.

Any ideas?
read this thread http://irrlicht.sourceforge.net/phpBB2/ ... .php?t=843
Guest

Post by Guest »

Aye, I adapted that and it works, however, I have a new problem.

I modified the FPS camera to technically allow you to move the camera beyond x = 90, -90, but it has a problem. If I go to either of those, the camera flips, then starts going back around. It is really wierd.

Also, you quit by pressing q, but it forces a hard crash.

http://www.kuattech.com/project.rar

my source is also in there, plus the FPS cam source with my mods.

BTW, I can't rotate the camera on the Z axis either?
Ameise

Post by Ameise »

I'm sure SOMEBODY knows...
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

succes!

Post by Phunk »

SUCCES!!!!! hahaha, it worked for me, I created a cam that does not flip, here is the link:
http://www.freewebs.com/therealsoundofm ... acecam.zip(do not pay attention to the website itself, its for my school.) it is the source of my current project, where you can play a split screen game, it works with a usb/ps2 mouse and a serial one(connect the serial one when windows has booted) No debugging/cleaning done whatsoever, use it just for the 'spacecamera' code.

Maybe someone can tell me in return how I can make the testbox rotate, so the 'front' is always in the direction of the target(but I do not like sin/cos, there should be a way without using them) Its going to be a head that floates in space

Greets Robin
Ameise

Post by Ameise »

I am downloading your camera right now... your site is slow (1kb/s).


Before I open it though, I must ask, does it have the movement type mine does? Ie, move the mouse to the right, you keep moving to the right until you move it left?
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

yeah, I just noticed too that my site is sloooow, srry about that(if you know a better site, just tell me, ill upload it to there), but it does not do that precise movement, you can implement it verry easely though, just add a global var or someting, that you use instead of the delta mouse x,y Then with some simple if()'s you should be able to make it move like you want. Just tell me if you cannot get it to work, cause I think I could do it for you in an hour max(but where's the fun in that?)
much luck with your project
greets Robin
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Re: succes!

Post by rt »

Phunk wrote:Maybe someone can tell me in return how I can make the testbox rotate, so the 'front' is always in the direction of the target(but I do not like sin/cos, there should be a way without using them)
how can you not like sin/cos? they are fundamental to understanding the world we live in!
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

:-) let me rephrase that, I do like them, but not in my 3d math calculations, I feel that there are enough compicated calc's allready in the code, and when i also need to use this kind of complex(for the processor) calc's in my movement routine(wich is updated every frame) I just get the feeling there is a more elegant solution to it all.(mainly because I came this far with just +,-, and *)
Guest

Post by Guest »

I can find no easy way to implement your code into mine... and why do you need a mouse driver?
Ameise

Post by Ameise »

You didn't include half of the source. You didn't include the DLL changes, you didn't explain HOW your camera is working (there is no easy way to port it), plus, it wont compile in Dev-CPP.
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

well, I DID include the full source, (I just have one cpp file, because I just used example 2 as reference,

and if you look at the includes, you see that its 3 files: windows.h, stdio.h and irrlicht.h, and the first two just come with visual C++)

I did NOT changed the dll!!!!

And I just gave you the source, THAT explaines how the cam works.(and it works!) it is not my fault YOU cant understand it(and compile it, its written in visual c++),

just use it or dont, if you just look at the animateFPSCam function(and you understand C++), you should be able to understand what I'm doing, and if you do, you can recreate it in several minutes

I dont need this poop, I try to help you, and jou don't even try to work something out yourself, you just complain. what did you think? that the solution is carried to you on a platter? well I'm not helping anymore, do it yourself(and really you should be able to, I just tried for weeks to get it to work, but Im a novice programmer) just dont tell me I did something wrong, when you are just too lazy to try to do it yourself
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

I can find no easy way to implement your code into mine... and why do you need a mouse driver?
well dunnow about the implementing of the code(wrote it in visual C++) but its just the animateFPScam function that is interesting(it is the original source of the prog that I'm working on, so ignore the rest:split-screen, serial mouse), its not a class or anything.(i will do that later, but for now ill use this) and this function is verry similar to the FPScam in the irrlicht source(just adapted it for my cams, controlled by separate mouses) look after '// set target ' here is where the stuff takes place.
Ameise

Post by Ameise »

I would have prefered an explanation to why it worked rather then source code w/ no explanation.

Also, any time I try to port your camera code, I get a variety of errors that make no sense to me. For instance, what is

core::vector3df target = oldtarget[player-1];
core::vector3df upvec = oldupv[player-1];
core::vector3df lvec = oldlvec[player-1];

?
Ameise

Post by Ameise »

Oh, and your DLL must be different, because:
1. It's half the size of mine.
2. It doesn't crash with the beforesaid functions, the Dev C++ compiled one does.

Did you change anything in the DLL? Or is it standard VC++ compiled?
Post Reply