Page 1 of 2

Spaceship Steering

Posted: Fri Nov 16, 2007 1:58 pm
by Biber
This thread is about the spaceship steering.

Project Page

I developed a class, which can steer a node. There are functions which rotate the node in every 6 directions plus a function, which moves the node forward. The speeds and acceleration in for every function are controlled by parameters.

Next I had to implement an interface, so that the functions can be controlled by user input such as keyboard and mouse.

Posted: Fri Nov 16, 2007 3:30 pm
by x3n
cool, I liked the steering you showed us on Wednesday.
I'm very interested how it will work with mouse-steering and in collaborating with the AI. :)

Posted: Thu Dec 13, 2007 2:06 pm
by 1337
This afternoon, I took the liberty of having a look at the steering code. And I came to the conclusion that now it is fine.

But I was able to fix the problem anyway. It was located in the initialisation of the input system. According to the Ogre tutorials on input (buffered or unbuffered), you have to set the "mouse clipping size" (whatever that means exactly). I did that just before the rendering starts and now it works.
Actually, one would have to do this every time the window size changes, so at the moment it is just a hacky fix.

The lines I added are the following:

Code: Select all

		unsigned int width, height, depth;
		int left, top;
		ogre_->getRoot()->getAutoCreatedWindow()->getMetrics(width, height, depth, left, top);

		const OIS::MouseState &ms = mouse_->getMouseState();
		ms.width = width;
		ms.height = height;

Posted: Thu Dec 13, 2007 7:18 pm
by x3n
Nice :)

Posted: Fri Dec 14, 2007 5:15 pm
by greenman
Great, thanks!

With my usb mouse it works fine (the acceleration is a bit too fast I think, though), but it doesn't seem to like my touchpad!?

And something else: I think key up(accelerate)/down(brake) are switched. Can anyone confirm that?

edit: I think there might be a camera problem, because the code for move_forward/backwards should be fine (had a short glance at it).

Posted: Fri Dec 14, 2007 7:26 pm
by x3n
Yes, reto inverted the camera coordinates (at least that's what I've seen in the commit-mail)

Posted: Fri Dec 14, 2007 9:58 pm
by Dorian
It depends on what you set the cam corrdinates in the level file (sample.oxw). Perhaps one should change this so that the steering checks for the right settings itself...

Posted: Fri Dec 14, 2007 10:24 pm
by 1337
Strange, I simply copied the code from the example framework. And what do these line have to do with the camera?

Posted: Fri Dec 14, 2007 10:36 pm
by x3n
I was talking about this (in rev511):
r511 wrote:- cam->setPosition(Vector3(0,0,+250));
+ cam->setPosition(Vector3(0,0,-250));

Posted: Sat Dec 15, 2007 6:05 pm
by 1337
?? I have not even seen this line yet.. so I can not help with this one.

Posted: Sun Dec 16, 2007 10:55 pm
by nicolasc
The camera should be behind the object, not in front of it and the z axis points into the screen.

Posted: Mon Dec 17, 2007 10:10 am
by greenman
Is it possible, that the steering only affects the camera at the moment? If I move the mouse I think, that I only see the same scene from a different angle?!

Posted: Tue Dec 18, 2007 6:07 pm
by 1337
That has been fixed by now.

I would like to conduct a little survey on the "invert axis" subject: Who actually likes the inverted y-axis?

Posted: Tue Dec 18, 2007 6:42 pm
by hofzge
It would maybe better to make e real poll about that. You can start polls by starting a new topic... just in case you didn't know. I don't think that many people will answer here.

I, for one, like uninverted mouse steering.

Posted: Tue Dec 18, 2007 7:01 pm
by beni
The question is only what should be the standard. Many people use the inverted mouse, so this is one of the first things that have to be made settable.