Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Car Control Panel(gauges)  (Read 2032 times)

0 Members and 1 Guest are viewing this topic.

wiyyyy

  • Newbie
  • *
  • Posts: 2
    • View Profile
Car Control Panel(gauges)
« on: March 13, 2015, 09:16:45 pm »
Hello SFML community

My school give projects and it is making car control panel aka. gauges.

I want to implement acceleration for speed calculating but i couldnt figured out.

I am using this library for graphics and events and ofc easy-to-use.

So far i tried sf::Time and sf::Clock but didint reach success.

Can you help me about acceleration things.   

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
AW: Car Control Panel(gauges)
« Reply #1 on: March 13, 2015, 09:37:55 pm »
Sounds more like you haven't figured out the needed math.
Take a piece of paper, a pen and some physics formula booklet and try to solved the problem on paper first, before getting lost in some code.

Or at least explain what your actually issue is. "Help with acceleration things" is not informative.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

wiyyyy

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Car Control Panel(gauges)
« Reply #2 on: March 13, 2015, 09:48:21 pm »
so i have main class named Car and it has speedUp function

Car::speedUp()
{
      speed++;// but i want some real formula not a constant values at the start of program.
      // speed += acc * dt  should do it but i am not able to calculate acc rate and dt.
}

for now i am only able to do speed up one by one when i press the key. i looked other projects topics etc.
but they have constant values at the start of program.

ps: eng is not my native lang if you dont understand pls tell me

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Re: Car Control Panel(gauges)
« Reply #3 on: March 14, 2015, 02:21:19 pm »
Like eXpl0it3r said it is basic vector math for this kind of thing.  I think the search is Vector Acceleration Game Math.  Since normal physics equations aren't in game calculation setup by default searching for how to convert them over is easy enough.  You might not run into this issue with a simple movement equation based on player input though so no need to worry about it.  :)


The first 3 or 4 have useful information:
https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=Vector+Acceleration+Game+Math
I have many ideas but need the help of others to find way to make use of them.

 

anything