[ODE] AMotor question
Terence Lewis
slyterence at yahoo.com
Fri Apr 9 11:01:25 MST 2004
Hi,
First, although it's a bit late, I'd like to say
thanks for the timely responses to my last question to
the list (about 4-6 weeks ago already?).
Now, I have a couple of new questions :). First,
looking back through the archives (a painful process
in notepad), I've seen this question asked, but
haven't been able to find an answer. I need to attach
an AMotor to a single body. I.e, between the body and
the world.
The reason is as follows. I'm writing a 2D game, an
aircraft game, like the old 1942 games for the Atari.
I'm not interested in a realistic physical simulation,
I want speed and an easy to use collision detection
library.
Now, the problem I'm having is that when my plane
moves left or right, I'd like to have it bank. So I
added a torque around the y-axis, and everything was
fine, until the plane flew upside down, and then
continued rotating around.
So, for a while, I threw ODE away for this type of
situation (using a flag to use ODE for position, but
not for Rotation). I wrote an interpolator to change
the correct Euler angle for the rotation I wanted, and
got a constant angular velocity, until I hit a maximum
rotation around the Y-Axis, which I could specify.
However, this approach always felt like a 'cheap hack'
to me, and I'd like to go back to using ODE. So I read
through the user guide and found a section on angular
motors that seem to have just what I need. I can
specify maximum and minimum positions for rotation
around the Y-Axis, and ODE will handle the rest for
me.
However, I get an assert when I attempt to add this
motor, because I'm trying to attach it to the world,
which the manual says is possible (or at least, the
manual isn't clear on which joints/motors need two
bodies).
Also, currently, when the user presses say, the up
arrow, I'm adding a force in the plane's relative
y-direction, to provide some acceleration. I see in
the manual however, that direct application of forces
isn't a good idea, and so I'd like to know if I can
use slider's for this? Again, they'd need to be
attached to only one body.
I'd like to try this approach, because I'm not
impressed with the handling of the plane at present,
and I believe being able to set the velocity to zero
in one time-step (when the user releases the up-arrow)
will provide me with much better (though I admit far
from realistic) handling.
The next question I have is in regards to timestep. As
this is a game that needs to run in realtime, I find
that large fluctuations in framerate can cause certain
weapons (projectiles fired from the player's ship) to
misbehave.
I've got a weapon that works fine when there's not too
many enemies in the game, but the second there's more
than about 5, it suddenly manages to disappear. I
presume it's being given a large velocity and is being
driven off the top of the screen between time-steps.
Can anybody provide suggestions to get around this? Is
it very bad to run the physics in non-constant
timesteps? If so, does anyone know how I can run at
fixed intervals in a game, and still keep graphics and
physics synchronised?
I've tried StepFast1 as well, but I'm not sure yet if
this alleviates the problem (I changed the level file
so that there's not so many enemies at once).
My last question is in regards to the archives. I've
had much trouble trying to browse through the old
posts because I'm using Notepad. I read in one of the
posts that Netscape can read the format and
significantly enhance the output. Is this true? Do I
need anything special for Netscape, like some kind of
plug-in, or will it just work as is if I download it
(Netscape 7.1, full install).
Thanks for taking the time to read this rather
long-winded post, and I'd appreciate any help
regarding any of the questions I've posed.
Thanks
$£¥
=====
We scratch, our eternal itch
A twentieth century bitch
And we are grateful for
Our Iron Lung
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/
More information about the ODE
mailing list