Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Slot car physics

Discussion in 'Works In Progress - Archive' started by W-Walter, Jan 17, 2015.

  1. W-Walter

    W-Walter

    Joined:
    Dec 14, 2013
    Posts:
    14
    Hey everyone, I have spent a lot of time working on the physics for a slot car game. It's kinda hard with unity and the inner workings aren't pretty. Anyway, I would like feedback on how the physics seem and feel to other people (since I've probably spent hours doing loops). I am actually near giving up with the project because I can't seem to get the physics responding any better and I'm not really satisfied with them myself.
    Please only comment only on the physics, everything else is just for testing.

    It won't take long to try it out
    Controls: Press the RIGHT arrow key to go. Thats the only control :D
    Webplayer: http://bytesoftwaretech.com/SlotCarsWebplayer.html (excuse the slow website ;) )

    Big thanks to anyone who gives me feedback :)
     
  2. MickM

    MickM

    Joined:
    Nov 19, 2012
    Posts:
    166
    Had a quick go.... I actually found it really fun! What were you not satisfied with regarding the physics? I think it performed pretty damn well to be honest!
     
  3. Not_Sure

    Not_Sure

    Joined:
    Dec 13, 2011
    Posts:
    3,541
    Ha!
    Neat!
     
  4. W-Walter

    W-Walter

    Joined:
    Dec 14, 2013
    Posts:
    14
    I'm maby a bit of a perfectionist ;) Anyway I'm wondering what everybody thinks of the 'break' forces etc. Like at which point the car will flip off the track.
    Thanks a lot for your feedback :)
     
  5. MickM

    MickM

    Joined:
    Nov 19, 2012
    Posts:
    166
    It is easy to flip it but I think it is about right.... If you go flat out around the whole track it makes sense that it will flip.
    It sticks to the track pretty well if you floor it up to just shy of the corner then hit it again on the way out (can slide from corner to corner and maintain speed that way)

    I really like it eh! Do you have any other tracks to test it on?
     
  6. W-Walter

    W-Walter

    Joined:
    Dec 14, 2013
    Posts:
    14
    Yea I've done a lot more work than I have released in that cheap test scene. I've actually finished multiplayer completely, but I'm considering going back and rewriting it myself with UDP sockets because of how inefficient the Unity network system seems. (I've got 1 server running many client games... Which is not the unity server model at all). Thanks for the great feedback! :)
     
  7. MickM

    MickM

    Joined:
    Nov 19, 2012
    Posts:
    166
    If you are concerned about the physics side of it, it may be worth doing up a bit bigger test track including some longer straights, S bends etc (I am assuming you have set the track editing up fairly easy for yourself?)

    Otherwise from the provided demo.... I would be pretty happy with it!
    One thing I think would assist (if not already included) is support for partial acceleration (eg. joystick throttle etc)
     
  8. W-Walter

    W-Walter

    Joined:
    Dec 14, 2013
    Posts:
    14
    I'm trying to make it realistic (ish) like real slot car racing (eg, it will flip easily at corners with full throttle). Im actually only a student but I loved slot car racing till my set got destroyed so I simply wanted to recreate the thrill of simple control racing with pleasing looking physics (eg the car spins out nicely).
    Also I wouldn't mind your comment on one of my planned monetization strategy: Players can pay to enter a race (eg $1) and then the winner actually takes home money (say $3 for a 4 player track). Of coarse this is only one possible monetization strategies and I realize it has never been attempted before.
     
  9. W-Walter

    W-Walter

    Joined:
    Dec 14, 2013
    Posts:
    14
    Yes, track editing is fairly simple... (Ish :/). I haven't got variable throttle, but my target platform is mobile and so I was aiming for simplicity. Also, it would have to be a screen slider on a touch screen and that's always hard to play with in my opinion.
     
  10. MickM

    MickM

    Joined:
    Nov 19, 2012
    Posts:
    166
    Fair enough re: mobile - works very nicely as is (in my opinion)
    If there is scope to include track editor (maybe for PC version) then that can create a lot more re playability (and fun to share between friends).

    re: Monetization.... I actually know someone that is working on an esports gambling idea similar to what you mentioned but it comes with significant issues... eg. In your case, what happens when someone loses wifi for a moment and crashes? What if someone manages to hack your game etc.

    My personal preference for mobile games is free with IAP for full uninterrupted; eg. Free with ads (not too many though!) or free for a few tracks, SP only.
     
  11. W-Walter

    W-Walter

    Joined:
    Dec 14, 2013
    Posts:
    14
    Thanks for your feedback its extremely helpful! Yes... That monetization method might be little to ambitious for a single student dev because of hacking possibilies. Also I may get pissed off players because of lag. In my case I can only use interpolation because the car changes velocity so quickly causing extrapolation to be spastic. I will probably start off with IAP for tracks as you suggested.

    I think I'll continue development now lol
     
  12. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    This is very cool, I think the car could stick to the track a bit more, or lower the throttle a bit as I tended to fly out too easily (or give option to adjust throttle/power in game?), but this is a really cool idea, well done.
     
  13. W-Walter

    W-Walter

    Joined:
    Dec 14, 2013
    Posts:
    14
    I'll create another larger test track and see how it is after that. The figure 8 is quite tight really but you may be right.
     
  14. Kavorka

    Kavorka

    Joined:
    Sep 15, 2012
    Posts:
    247
    Feels like you are adding constant force instead of constant power.
     
  15. W-Walter

    W-Walter

    Joined:
    Dec 14, 2013
    Posts:
    14
    I can't really understand the difference. Are you saying that it will accelerate faster and faster because I'm using constant force? (Which its actually not. The force applied changes in relation to the velocity)... Or am I not following any of this.
     
  16. Kavorka

    Kavorka

    Joined:
    Sep 15, 2012
    Posts:
    247
    OK, it felt that way, but if your force goes as P / v - C * v^2, then I was wrong.
     
  17. W-Walter

    W-Walter

    Joined:
    Dec 14, 2013
    Posts:
    14
    I don't even understand that math :/ I'm using an animation curve to change the force based on velocity... which is probably an amateur way to achieve that.
     
  18. Magic73

    Magic73

    Joined:
    Jun 23, 2015
    Posts:
    127
    the link isn't available anymore.
    may you republish the demo?
     
  19. SuperPox

    SuperPox

    Joined:
    Apr 29, 2020
    Posts:
    12
    Well 5 years later... and I'm curious how you achieved the slot car effect. I'm trying to use real physics and my colliders (between the rails and guide peg) are breaking even though I turned up all the detection settings
     
  20. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    I wouldn't use colliders to keep the car on path I would use a script and constrain the point to the path with forces, thats what I did for my Rigidbody path following script in the video below.