Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Early WIP Bike Physics.

Discussion in 'Made With Unity' started by WonkyWooGames, Nov 2, 2011.

  1. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    Here are my bike physics, that are equally suited to skateboard,snowboard or skiing simulations. It is WIP so apologies for the programmer graphics.

    Playable here.

    These are a continuation from my car physics. That forum can be found here.

    Keep watching for more developments, AI, games, etc.
     
  2. dondiego

    dondiego

    Joined:
    Oct 30, 2011
    Posts:
    7
    Why so crappy controls? Use WASD or the arrow keys, but don't mix them. Oo
     
  3. Duskling

    Duskling

    Joined:
    Mar 15, 2011
    Posts:
    1,196
    I love it!

    Great job!
     
  4. MCHammond

    MCHammond

    Joined:
    May 15, 2009
    Posts:
    74
    A good start but,
    As a bike owner you need to addrease the following:

    At really slow speeds you dont bank to turn, you use the front wheel to steer. The turning circle can be tiny at this speed, some bikes can turn there front wheel 90degrees so when they turn, the rear wheel stays static "use this for when the bike is stopped".

    At medium speeds the bike behaves well, and skids almost like it should. Although it does seem to skid a little bit all the time, a real bike only skids when the tire has lost traction. Try implementing a sharp falloff for the traction so if you push past a piont it skids.

    At High speed the bike is total inaccurate, the steering needs to be a lot more sensitive so you turn alot sharper. think of all thouse country roads you see bikers drive down at 100mph. They lean so far out they scuff there knees on the tarmak.

    All the time the brakes need to be sharper and stop you alot quicker, if this was a real bike you would die the first time you went out after you failed to stop at a red light and got side swiped by an 18 wheeler. even at top speeds a bike can stop in a few secounds.

    Hope that helps.
     
  5. MCHammond

    MCHammond

    Joined:
    May 15, 2009
    Posts:
    74
    I was also thinking that the controls although not normal work. But I was thinking you could have:
    W = Accelerate
    S = Reverse
    Q = Back Brake
    E = Front Brake
    LArrow = TurnLeft
    RArrow = TurnRight
    UpArrow = Leanfoward
    DownArrow = LeanBack

    So that when you do jumps you can ballance the bike in the air with the arrows and use the diffrent brakes "front and back" to do stunts and proper bike handling like donuts and wheelies.
     
  6. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    r resets the bike, but no way to get yourself back on the course if you fall off.

    Not bad as is. Reminds me of the skating/biking games from the gamecube/ps2 era.
     
  7. bug5532

    bug5532

    Joined:
    Aug 16, 2011
    Posts:
    307
    are you using wheel colliders to do this? Looks really promising :)
     
  8. FoxUmkov

    FoxUmkov

    Joined:
    Aug 31, 2009
    Posts:
    39
    Nice work!
     
  9. SEG-Veenstra

    SEG-Veenstra

    Joined:
    Sep 3, 2010
    Posts:
    326
    Looks very decent to me. Has a good feel to it, but kinda arcade-isch, which I actually like a lot!
     
  10. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    Hey, thanks for all the feedback. Much appreciated, keep it coming.

    Currently the bike physics are designed to be arcade like, so I hope people have realised they can do 360s and back flips etc, whilst in the air. Just use the pitch and steering controls.

    @dondiego : Sorry for control layout, this is my preference as I don't like the groupings to be near each other. I understand that a lot of people prefer WASD or all arrow keys. I'll make sure it is configurable in any future game.

    @MCHammond : Thanks for your detailed feedback. Currently, I'm only implementing an arcade style handling hence the sliding, but I'll certainly start looking at your points, especially the high speed turning. This needs to be checked on a winding road terrain as it could be a perception thing. The bike does travel 200mph at the moment and I think the grip and turning is correct, but I could be wrong. So need to check on a better landscape/terrain. As I'm not a bike rider, prefer cycling, my cues have been how MotoGP and dirt bike riders ride and my knowledge and experience limited to writing car (mainly F1 games) physics.

    @MCHammond : Yes, the brakes aren't good enough. Will fix.

    @MCHammond : I like your idea for separate brakes, this would be a good addition for a simulation. Need to think how this could be applied over various control devices, i.e. XBox360 and PS3 pads, iPhone, iPad, Wii remote, etc, etc. The inout controls need a lot of thought and user testing.

    @MakerOfGames: Yes, my fault, disabled in code and forgot to re-enable. Previously, the terrain was in the middle so falling off was less of an issue. Will enable on the next release. Yes, snowboarding, skating are all in mind with these physics.

    @Bug5532 : No, not using wheel colliders. My system is using ray casts. The physics initially written in C++ outside Unity, and work on a variety of Physics Middleware, i.e. PhysX, Havok and Bullet or any other rigid body physics system available.

    Again, thanks for all you feedback and keep it coming.
     
  11. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    Bump.

    Improved the brakes and added reset when falling off the world.

    Don't forget to clear your browser cache :)
     
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I really like the feel of this.
     
  13. Broken-Toy

    Broken-Toy

    Joined:
    Jan 16, 2010
    Posts:
    455
    Likewise. This is promising.
    I'd put the brakes and reverse on separate keys though, and have skid marks and/or smoke appear when braking ;)
     
  14. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    Thanks for the nice comments people.

    @Werewraith : I'm not actually interested in the graphics at this point, gameplay is more important to me. However, having been in the game industry over 16 years I know that adding great graphics will elevate peoples perception of the whole thing. Graphics sells, gameplay doesn't. My programmer graphics will be removed once the projects move out of the prototyping phase.
     
  15. Broken-Toy

    Broken-Toy

    Joined:
    Jan 16, 2010
    Posts:
    455
    I wouldn't go so far as to say graphics are the end-all, be-all, but I find they're extremely important to convey information. Like how you used shapes to have a visual representation of a motorcycle at all. Having some cue of when skidding happens would help too.

    By the way, I noticed the skidding does happen when simply twisting the motorcycle, just saying the behavior could be exaggerated and given even more emphasis. If that's where you want to take this gameplay to, of course.
     
  16. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    I understand where you are coming from, but I don't just want to drop in a placeholder effect as this would or could have a negative impact also. Need to invest sufficient time so they are of the same standard as the actual physics. I think I'm at the point where I'm happy with the physics so I can now invest some time on the graphics side of things.

    So you would like skid marks and particle effects.
     
  17. lordaddament

    lordaddament

    Joined:
    Nov 9, 2010
    Posts:
    98
    Beast mode....... please add more hills....
     
  18. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    @lordaddament : I'm currently putting together a list of all potential racing game modes/environments and Hill Climbing is on there (I assume that is what you mean, or do you mean a massive dirt bike environment) .
     
  19. LS16BMX

    LS16BMX

    Joined:
    Nov 11, 2011
    Posts:
    94
    Dude i'm so diggin your tests, I've got into 3D because of my love of bikes and the lack of any decent games (well games that live up to my high expectations anyways)
    I have been developing a bmx game for starters and have just started with unity but the lack of decent tutorials is killing me :(
    Wana team up haha

    Peace

    Matt
     
  20. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    @LS16BMX : Thanks for you comments. Keep plugging away with Unity, it'll click into place one day. Thanks for your offer of teaming up but we've got a talented team already.

    Cheers...
     
  21. TehWut

    TehWut

    Joined:
    Jun 18, 2011
    Posts:
    1,577
    So much fun! I was able to land a backflip :p

    I really like the feel of this, it feels so polished! there is a slight glitch when barely tapping W. the front wheel kinda spazzes out.
     
  22. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    @TehWut : Yes, working on this front wheel glitch and a few others. Thanks for the bug though :)
     
  23. LS16BMX

    LS16BMX

    Joined:
    Nov 11, 2011
    Posts:
    94
    if theirs anything you ever need fella, I work in film and tv, do quite a bit of bike racing stuff like BSB etc :)

    Good luck !
     
  24. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,251
    Very cool!
    Put it on the asset store when finished!
     
  25. Yusuf-AKDAG

    Yusuf-AKDAG

    Joined:
    May 13, 2009
    Posts:
    280
    I really enjoyed while playing with it. Well done mate!
     
  26. oxl

    oxl

    Joined:
    Nov 21, 2008
    Posts:
    325
    Nothing to complain ..really nice ! Would buy it immediately.

    --
    oxl
     
  27. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    Thanks everyone for all your kind comments.

    Currently working on a skiing extension, so stay tuned for this.

    However, it's unlikely that the code will be for sale on the asset store. Looking to tout it around to motorcycle or mountain bike manufacturers, but struggling for contacts at the moment. Marketing/selling not my strong point. If this doesn't happen, will be developing own games.
     
  28. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    Hopefully, this will turn into a very short development blog of experience of developing a bike racing game. Here is the latest version of our bike physics. Time spent ironing out some bugs and implementing, although basic, some requested features such as skid marks. Its a lot more solid and an example of where we are heading. Maybe kick-starter funding is the way to go. Anyway, here is the demo : http://www.wonkywoogames.co.uk/wonkywoogames/In_Development_Bike_Physics.html

    W - accelerate
    S - brake
    left and right arrow steering (and in air)
    up and down arrow (in air pitch control)

    Any feedback is appreciated.

    We'll keep updating the car and skiing physics threads as we go also.

    Cheers...

    Darren
     
  29. jessee03

    jessee03

    Joined:
    Apr 27, 2011
    Posts:
    729
    I managed to get stuck in the ground lol... but overall I think this little demo is a ton of fun !
     
  30. tatelax

    tatelax

    Joined:
    Feb 4, 2010
    Posts:
    1,168
    fantastic!
     
  31. Immi

    Immi

    Joined:
    Jun 2, 2011
    Posts:
    81
    Really nice..
     
  32. holyjewsus

    holyjewsus

    Joined:
    Mar 7, 2011
    Posts:
    624
    super fun
     
  33. ShadoX

    ShadoX

    Joined:
    Aug 25, 2010
    Posts:
    260
    Love the gameplay, but the controls could use some work. :) Or at last let the player choose the buttons (s)he want to use. Also, at one point the tires just disappeared.. not sure if they went underneath the terrain or if thats intentional. Heck, playing that made me want to do something like that.. D:

    Reminds me a lot of Motorstorm which is one of the rare racing games that I actually like. :)
     
  34. bug5532

    bug5532

    Joined:
    Aug 16, 2011
    Posts:
    307
    I want! please sell this!
     
  35. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    Thanks for all your feedback.

    Looking into the wheel stuck under the floor bug, but for now press "r" and the bike will be reset.
     
  36. bug5532

    bug5532

    Joined:
    Aug 16, 2011
    Posts:
    307
    I dont know if this will help, but I found increasing the physics solver iteration count helped stop this on one of my games :)
     
  37. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    @Bug5532 - Thanks for the tip, but I've already tried that. Changed from ray collision to sphere collision casts but again no luck. I suspect it is a problem in my suspension code, probably the rebound dampening. I have one more thing to try, test on a static mesh instead of the terrain. I can add a small collider at axel level and this stops the wheel going through, but causes a huge collision force on the occasions it does.

    It is strange that I don't have these problems when using Bullet and Havok outside of Unity. Could be a c++ to c# porting problem.
     
  38. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    Wheel going through the floor is now fixed. Let me know of any other bugs.

    Cheers...
     
  39. ShadoX

    ShadoX

    Joined:
    Aug 25, 2010
    Posts:
    260
    Just played around again.. Noticed that the camera tends to clip through the terrain if your going backwards and that if you are rolling down a hill backwards and try to use the S key(drive back..) that the bike stops and then starts to move again.. a little weird when your still rolling down a hill trying to go down faster and the bike slows down(it actually seems to come to a full stop) by actually driving in the direction that your already rolling into.. (not sure if thers the same problem if your going forward.. tried it out but didn't notice anything like that)
     
    Last edited: Dec 1, 2011
  40. WonkyWooGames

    WonkyWooGames

    Joined:
    Dec 31, 2010
    Posts:
    63
    @ShadoX - Thanks for the feedback. I have no collision on the camera at the moment will implement soon. I'll look at the rolling backwards and the "S" key bug. Seems vey odd.

    Cheers...
     
  41. LS16BMX

    LS16BMX

    Joined:
    Nov 11, 2011
    Posts:
    94
    I notice you mention your developing this outside of unity is this correct ?
    If so I would be very interested how I could look into doing this myself as I am having no luck using unity to achieve even the most basic of working prototypes for my bike game.

    Any advice you can give would be most appreciated as i'm heading into brick walls constantly :(
     
  42. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Would also be interested in a bit more on implementing a 3rd party physics option as well. Be mighty handy.

    thanks,
    Brendan
     
  43. doomprodigy

    doomprodigy

    Joined:
    Dec 12, 2010
    Posts:
    87
    Just Gave this a go, Really digging the bike physics. It's suprising no one has made some before in Unity from my understanding.

    Peace,
     
  44. Hossain

    Hossain

    Joined:
    Jan 22, 2012
    Posts:
    6
    Really love the general feel of the bike. I look forward to seeing a game come out of this. :)
     
  45. LS16BMX

    LS16BMX

    Joined:
    Nov 11, 2011
    Posts:
    94
    I have now managed to make a working prototype for my own bike physics however I have gone down a slightly different route.
    Would I be right in thinking that your bike is using more translate, rotate functions rather than pure add force comands ?
    I have managed to create a fully on the fly physics simulation however its definitely wip at the moment but perhaps I will need to combine some trickery at some point.
     
  46. doomprodigy

    doomprodigy

    Joined:
    Dec 12, 2010
    Posts:
    87
    I figure the only way to judge bike physics is based upon air control and bike weight distribution. Currently the bike physics in this have no Air control based upon a real offroad motorcycle. I tried to do a whip,scrub etc etc in the air but due to the bike control.

    My suggestions thus far.

    Apply the break during air stops the wheel spin so bike kicks backwards. Apply throttle during air brings bike forward to a steady level but not far forward. Going left and right in the air needs to lean the bike and not rotate it.

    The way games such as Mx vs Atv do it is have leaning buttons and turning buttons. That way you can lean, Forward, Backward, Left and Right. While also being able to turn left and right and apply throttle and break. This works for a system of being able to lean during the air where turning is impossible to be done fast and lean left and forward whilst a little bit of turning to be able to pull of a scrub/whip.

    Then when the bike is further turned in the air so more mass area is showing to the speed direction you slow down due to the wind force.

    The main competitors in any bike racing game are the Mx vs Atv franchise from my understanding has been let go due to THQs fail, and thus the last competitor for PC's is Mx Simulator which is F***ing ridiculous to play, Unless your like my younger sibling who plays it for hours on end just to learn how to go around the track without falling off.

    - I think I might have gone to far in my post. I'm just excited for some people working on bike physics.

    Peace,
     
  47. Deleted User

    Deleted User

    Guest

    I really like it! Lots of fun, even in this simple state. I think it would be fun if player could do wheelies by pressing the up/down arrows while on the ground.
     
  48. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    Hehe nice.
    Can anyone else land a 900 while ramping over the hill :D
     
  49. LS16BMX

    LS16BMX

    Joined:
    Nov 11, 2011
    Posts:
    94
    This is my attempt if anybody's interested ........

     
  50. doomprodigy

    doomprodigy

    Joined:
    Dec 12, 2010
    Posts:
    87
    Did you just post that in every bike topic on unity.....

    Its alright. Show me if with a proper camera going around a track though. With Unity demo.

    Then we can judge >:D

    Peace,