[gameprogrammer] Re: Odometer

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

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: