[gameprogrammer] Re: Odometer

  • From: Ryan Hanlon <ryan@xxxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Fri, 30 Sep 2005 00:55:33 -0700 (PDT)

Okay, on second... maybe third reading, I started thinking you might actually be asking about the calculations involved in *displaying* the odometer. My impression now is that you're thinking of a model made up of rollers with digits on them and you want to know the best way to rotate those rollers to display the number correctly?

If that's the case, you would want an equation for each roller that decides the degrees of rotation based on the number being displayed. Each equation would basically just look at the corresponding digit, and in some cases one of the neighboring digits, and set the roller at the appropriate rotation for each frame. This would be roughly 36 degrees times the digit value, plus some offsets that would probably require a little trial and error to get right.

But that's just another guess. If it's not what you're looking for, I guess you'll have to give more details :)

Ryan


On Fri, 30 Sep 2005, Ryan Hanlon wrote:

This simpler method also usually works in situations like car games where speed is known at all times:

Every frame (or whatever unit you decide to use)
<accumulated distance> = <current speed> x <time elapsed>

Ryan


On Fri, 30 Sep 2005, Alan Wolfe wrote:

 calculate the measurement? for a car game or something?

 Do you know the distance formula?

 2d: Distance = squareroot((x2-x1)^2+(y2-y1)^2)

 3d: Distance = squareroot((x2-x2)^2+(y2-y1)^2+(z2-z1)^2)

 that answer your question?


On 9/30/05, jorgefm@xxxxxxxxx <jorgefm@xxxxxxxxx> wrote:
> > Well, the openGL code is no problem. I've yet all the source
> to load texture, draw it, and so on working. I was thinking in
> a component with the odometer behaviour, to know how the
> 'acumulative' scroll could be done. For every digit position
> you can draw a textured number and translate it for an amount
> at every constant time. How to calculate this messurements are
> my question.
> > > > gameprogrammer-bounce@xxxxxxxxxxxxx escribi� el 30/09/2005 16:58:52:
> > > > On 30 Sep, 2005, at 8:01 AM, jorgefm@xxxxxxxxx wrote:
> > > > > Hi all,
> > > > > > Anybody knows how implement a graphical odometer with SDL, openGL,
> > > etc ?
> > > Or knows a link to a odometer component in C/C++ ?
> > > > > > Thanks
> > > Jorge
> > > > I've not done it myself, but I imagine that it's probably a simply
> > matter of determining a set of textures for the numbers, then the
> > space you want them to go, and finally keeping track of the distance
> > traveled, and cutting off the floating-point value, and then parsing
> > the integer into a string of numbers, and drawing those into their
> > appropriate locations using the appropriate number-texture. So, I
> > guess it comes down to how much OpenGL code do you know? (ie: can
> > you load textures and keep track of them?)
> > > > So IF you understand what I just rambled about (I'm REALLY bad at
> > explaining things to people), then maybe you can clarify at what
> > point you can no longer figure this out the rest of the way, and I
> > can try to give you some code. ^_^ I just don't want to teach/
> > exemplify stuff that you already know.
> > > > --Ben
> > > > > > ---------------------
> > To unsubscribe go to http://gameprogrammer.com/mailinglist.html
> > > > > >


Other related posts: