Search Unity

[RELEASED] Sportbike PRO kit (motorcycle physics)

Discussion in 'Assets and Asset Store' started by bcman, Sep 13, 2015.

  1. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139

    Sportbike PRO kit

    Hello riders and enthusiasts of bikesims.

    Before any words watch short trailer of features.



    Try playable web version
    (Firefox, Opera, IExplorer9)

    Try playable WebGL version
    (Chrome, Edge. Sorry for little buggy graphics in GL ;()




    There is main features you'll get:

    • Three motorcycles
    • Wheelie
    • Stoppie
    • Nice and looking good Suspension
    • Two independent brakes
    • Lowsides
    • Highsides
    • Trail braking
    • ESP
    • Pilot's weight transferring
    • IK head looking at
    • Pilot's IK animation and physics reaction to action
    • Sounds
    • Skidmarks
    • Reverse speed


    As a bike rider I've try to achieve the feeling of real motorcycle behavior.
    All my riding experience included in this package.
    Not only mathematical knowledge, but the thrill of riding a motorcycle and the behavior of bike in various situations.


    Features explain:
    Wheelie
    - when too much torque try to lift up front wheel
    Stoppie - when too much front braking try to turn bike over front wheel
    Two independed brakes - rear and front can be used separately for different effects
    Lowsides and Highsides - loosing friction with track and fall or crash of motorcycle
    Trail braking - technique of cornering with a slight rear wheel skid
    ESP - system for more arcade gameplay :) When turned on motorcycle is "overstabilized".
    Pilot's weight transferring - advanced technique when you might shift pilot position to load or unload front or rear wheel. It used for some stunts and wheelie/stoppie control(joystick is just necessary :))
    IK head - feature to look at any objects you like
    Pilot's IK animation and physics reaction to action - pilot inherits some inertia from any action with motorcycle.
    Reverse speed - you can push bike back when you are going wrong way











    P.S. Also, if you ask I have Unity4 version(with previous wheelCollider) which one even more stable, physical correct and smooth.

    Motocross bike added in 1.2 version

    I wish to improve my project more and more, so wait for suggestions.
    Ask anything :)
     
    Last edited: Oct 19, 2016
  2. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    fantastic work.
    I was planning to pick up the older version just been waiting payouts to come.
    this looks very advanced. I will shoot you a mail tomorrow if you unterested in swapping assets.

    want to adapt it for android platform, is there a performance difference with older version?
    the first wheel sinks a bit into ground, the wheel radius is off, right?

    one suggestion (but its not really realistic-driving related, but game-control related)
    the picture in the last row looks like a flip-over. if its like that, could be some landing-helper.
     
  3. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hi there, dibdab.

    1. What do you mean by "difference with older version" what is that "older" ?
    2. Visual mesh is really sinks. That's because new whellCollider(new I mean Unity5 with Phys 3.3) can go only up or down ignoring tilt of front forge. But visual mesh follow front forge angle. So, the solution is make visual mesh a little bit smaller than wheelCollider.
    3. The picture 3 is crash after collision with car(white object on ground) :) So, that's why bike is in air, upside down and biker began to fall.
     
  4. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    hello, I meant this one
    http://forum.unity3d.com/threads/sp...cs-that-feels-and-looks-like-real-one.347982/
    or it only works in UE4? *no, I see it uses 5.01
    3. okay :), but is it even possible to do a backflip? (not that it'd be a dealbreaker for me). how would the bike land after a jump?*

    *okay, the demos answered these questions for me.
    though when the bike is loosing control, or in air (this is rather about the starter kit), it tries to balance/regain control and I think it would be better if acting like a rigidbody, and switching back when touching ground (not sure how that would work though)
     
    Last edited: Sep 14, 2015
  5. Deleted User

    Deleted User

    Guest

    Did you switch to c#.....and when is it available?

    Can l buy that ww2 pilot mesh?, on your website?

    Patrick
     
  6. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    dibdab, both kits(starter and pro) is available for Unity5. If you need Unity4 version(with old wheelCollider) I can send it too.

    Backflip
    There is no mechanics to do backflip by your will.
    But If you need it, there is just few strings of code to make it possible.
    More strings you need to decide for rider when stunt goes wrong :) and he should fall.
    As it seems reasonable for me, you need make 3 joints: two at hands and one at... butt :) with breaking force. When acceleration too hard, or braking momentum too heavy(crash for example), he should break connection with bike and fall out.
     
  7. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    ForceVFX, rewrite it to c# is one of my goals. Can't say when...

    As for WW2 pilot - it's commercial work, I can't sell it once more :) Sorry about that.
     
  8. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
  9. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    So, motocross/motard bike type is in progress.
    Also, some minor bugs will be fixed in next version.


     
    Last edited: Nov 25, 2015
  10. shanxolin

    shanxolin

    Joined:
    Apr 15, 2015
    Posts:
    1
    Hello. racing logic, lap counter, positioning players are included?
     
  11. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hi there, shanxolin.

    The features you asking for is little bit far than bike physics.
    All you can get you can test at
    web demo.
    So, there is no any race logic and so on. Just everything you need to make your own bike game with logic or without :)
     
  12. Apfelbeck

    Apfelbeck

    Joined:
    Oct 25, 2015
    Posts:
    6
    This looks like a good kit but I have a couple of questions.

    What features does the pro kit have that the starter kit doesn't?

    Also, I see a mixture of javascript and C# files. Is the motorcycle code written in javascript? If so how straightforward would it be for me to rewrite it in C#?
     
  13. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hello, Apfelbeck.

    PRO version contains: two bikes for example different set ups, mecanim biker, ESP stabilization system, IK head orientation system, sounds(not just .wav files but sound script for control RPM mixing sound) and easy setup bike(curves instead of list of numbers).

    The bike's code written in JS.
    C# is for supporting scripts like camera movement code, scenes selection and so on.

    As for rewrite to C# it's all depends on knowledge of C#. Bike code is easy to read.
    In my plans is rewirite it in C# but I don't know when... now I'm working on Motard/Motocross bike and bike's damage system.
     
  14. Apfelbeck

    Apfelbeck

    Joined:
    Oct 25, 2015
    Posts:
    6
    Sounds good. I'm reasonably experienced with C#.

    You mentioned ESP stabilization, if I just turn that off is the bike going to be harder to control? For the idea I have in mind I want the bikes to be kinda of difficult to manage without making it artificially difficult.
     
  15. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hi there.
    You may try to turn it On and Off in web demo. Key "Z".

    Do you need to make controls MORE harder than "ESP off" ?
    What kind of "difficulties" you mean ?
    Keep manual balance ?
    Bad friction when cornering ?
     
  16. Apfelbeck

    Apfelbeck

    Joined:
    Oct 25, 2015
    Posts:
    6
    I was thinking manual balance and being able to make some surfaces slippery yes.

    Here’s the core of my idea, which might only appeal to me..
    .
    The game is a 1-vs-1 jousting contest on motorcycles. To complicate things the competition happens in arenas with different shapes and hazards and on bikes with separate front and rear brake control and manual balance.

    What I want to do is make a vs game with multiple interlocking skills:
    1. Skill interpreting the opponents’ actions and out thinking them tactically.
    2. Skill controlling the bike, which increases the players’ maneuverability and options.
    3. Skill understanding the arenas and how to best take advantage of their topologies.
     
  17. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    354
    Hi bcman,

    I'm considering to buy this, can you share the inspector for the bike controller. So I can see what type of control do we have over this?

    Also can you show how easy or complicated is it to change the car and player model. How is the workflow?
    Thanks
     
  18. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hi there.

    There is bike option screen




    The answer for you question "is it simple or not to change bike and rider" is depended on your Unity skills
    As for me it's very simple. To change bike graphics you only need to change 6 .FBX meshes of bike(body, front forge x2, rear pendulum and two wheels). If, for instance, word "mesh" afraid you :) it seems not so simple :)
    Understand me in right way - I don't know how familiar you to Unity.

    As for character change it's a little harder, because you need to setup mecanim skeleton and ragdoll for your character. It's very basic actions but you still need to know what is mecanim and what ragdoll means.

    Every step how it works and how to setup/change parts of this kit is described in kit's manual.
     
  19. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    354
    I'm familiar with those to a point, so it would be okay I think.

    I couldn't see a manouvre variable in the inspector, the demo feels a little hard to steer to left and right. I want to increase it. Is it possible somehow, if so, I will buy it. It's a great package
     
  20. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hello, hakankaraduman.

    There, on the bike_controls.jpg above you can see animation curve named Wheelbar_restrict_Curve.
    So, this is restriction for steering angle(in degrees). I've made it for keyboard because when you press left or right it turns wheelbar by let say 30 degrees at 10 km/h and it's good for nice turning.
    But when you try to turn wheelbar by 30 degrees at 100 kh/h it causes crash for sure.
    So, you may tune this animation curve to make bike more "turntable" and nervous :)
     
  21. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    354
    Thanks for the explanation. I have bought it and tested. It's the best bike physics package I have tested on asset store.
     
  22. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    354
    Hi again bcman,

    I took my time and converted all the scripts to c#, just because I hate having javascript code in my project :) and also tried to reduce memory allocation in the scripts. There was a lot of getComponent calls in the fixedupdate methods.

    If you need, I can send you all the scripts and a prefab of the c# bike. So you can test and also can use with your package. It's my way to thank you for this package if you will :) I tested and I believe the behaviour is the same as javascript version.
     
  23. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hi there.
    Thank you very much :)

    As for c#. Yes, I would glad to have c# code. I begun Java version so long ago and always thought what I started it in c# :)
    I've tried in Unity4 but when physics changes thought all my code ruined.
     
  24. hakankaraduman

    hakankaraduman

    Joined:
    Aug 27, 2012
    Posts:
    354
    I've sent you with pm the drive link for the c# package.
     
  25. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    hakankaraduman likes this.
  26. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    New motocross bike in 1.2 version !
     
  27. chrisabranch

    chrisabranch

    Joined:
    Aug 15, 2014
    Posts:
    146
    Does this kit have accelerometer and touch controls? and if not would it be hard to add them, i don't know js well, only C#
     
  28. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
  29. phoenixrising

    phoenixrising

    Joined:
    Aug 9, 2013
    Posts:
    57
    Hi, I really appreciate how well you made the physics for the motorcycle. But I want to tweak them, specifically, I would like to tweak the skidding/trail braking in such a way that I can cause the motorcycle to skid at less of an angle and also to effect the speed and direction with the trail braking.

    I could not find this in the code though, can you point me to toeh best place to try to tweak these settings?
     
  30. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hello, phoenixrising.

    Thanks for high appreciation of my kit :)

    As for skidding/trail braking, look for string "coll_frontWheel.sidewaysFriction.stiffness = 1.0 - ((stiffPowerGain/2)-tmpMassShift*3);" at rear brake section of bike's script.
    That's exactly what you asking for, right ?
     
  31. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Hi, your asset looks really nice, congrats on the work done. I am looking to purchase but have a question , could your asset be modified or used reasonably easily on a bicycles instead of motorbikes? I suppose the only difference would be to make a pedal based animation to be in line with the power given? I'd appreciate your input, I'm making a game that is being released on Steam (greenlit :)), currently looking at suitable options/assets.
     
  32. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
  33. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hello, khos85.
    Sorry, for long answer time, it's all NewYer celebrations :)

    So, in theory to change motorcycle to bicycle all you need is turn off sound :)
    Really.
    In case when you need BMX then you should cut off gearbox too.
    The pedal animations should be linked to RPM of engine. It's constant numeric int parameter.
    So, I see no problems here.
     
  34. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hi there, ZJP.

    In demo you've show above there is more about pilot's mass change. It's more about stunt and rider, not about motorcycle behavior.
    So, my kit is about motorbikes.

    Good news is you can do this in my kit with some strings in code: for a camera - to "side follow", and for pilot's change position to rotate bike around center of mass.
     
    ZJP likes this.
  35. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Thanks for your info bcman, much appreciated. I read that your bike setup has two separate brakes which interests me a lot, I'm making a trial biking game, of the pedalling sort (steam greenlit, whohoo!). I guess this would be possible but can say when the front brake is on and you weight shift to the side that the read end of the bike swings around, like a 180 move? same for when back brake is on? Just curious how or if the weight shift can take an effect on the bike when stationary like that
     
  36. slikk66

    slikk66

    Joined:
    Dec 30, 2015
    Posts:
    1
    Just bought it! Looks great so far - thanks for all the hard work. When I get a bit further in my project I'll come back and update the threads!!
     
  37. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hey, khos85.
    In my webdemo bike has weight near 200kg(honestly it's 400 :) but blame damn new PhysX 3 :))
    Pilot's mass shifting does very small effect to bike.
    As for mounting/dirt bike weight of 12-28kg - it should works as you wish. Blocking front brake and translate mass of rider should rotate bike to 180 degrees or something like that.
     
  38. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thanks for the reply. :cool:
     
  39. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,268
    This looks really good from the demo - rear wheel brake turning is great!

    It is a bit too easy to crash (fall off) though, especially without the ESP system - I'm not sure I would use it in a game without that on. Even with ESP you can crash fairly easily off-road - can that be made less sensitive or disabled so no crashes?
    Sometimes the rider and bike also stay leaning over a bit too long after a hard turn and brake.
    And if sliding sideways the bike pops up in the air sometimes, perhaps hitting side of a collider?

    But seems like the best bike kit
     
    Last edited: Jan 12, 2016
  40. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hi, slikk66.

    Thank you. I do my best.
     
  41. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hi, andyz.

    Yes, you might turn crashes off at all.
    Also, you may write any condition of crash if you wish.

    "sideways the bike pops up" calls highside. It's very evil kind of crash in real life.
    Highside happens when rear wheel loose friction with track and when gets friction again abruptly. All power of engine momentum strikes to rear pendulum and bikes try to shot rider in air.


    watch in slowmotion

    So, whose "pops up" is moment when rear wheel gets friction again. When speed is high you'll get highside with crash.
    To "fix" it. I mean make more smooth(if you don't like as it is) play with friction of wheel(for example chopper and motocross bikes in demo has no such effect - long frame base and low engine power).
     
    Last edited: Jan 13, 2016
  42. hodge47

    hodge47

    Joined:
    Apr 14, 2014
    Posts:
    25
    This package seems to be broken with unity 5.3.x. The rider lean is not working. I even made a new project without modifying any scripts and the rider lean is broke there as well. Anyone else having these issues? The package is still working flawlessly on 5.2.x. :)
     
  43. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hello, hodge47.

    Seems surprise for me :(
    Okay, I'll try to investigate and solve this 5.3 bug.
     
  44. hodge47

    hodge47

    Joined:
    Apr 14, 2014
    Posts:
    25
    Awesome thank you for all of your work!
     
  45. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Hi bcman, I'm getting closer to starting a project that involves a bike, I'm really liking the look for your asset so far, and so ar all you have replied with ticks the boxes..but mine is a bicycle, one thing I need to ensure is the balancing of the bike and how your asset handles this..do you depend on something like raycasts to the terrain?
    I'm currently implementing a system of add forces to keep my bike object upright if < or > than 0 on x axis.. not ideal as if I rotate while in wheelie mode then my bike does weird things..can I ask how you handle this in your asset, I'm not asking for detailed code at all, but would like to understand the approach you take.. a vague description would be helpful, I need to know if that will suite my game and adapt your script for my bike before I splash my cash/buy :)
     
  46. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Hello, knos85.

    "a system of add forces to keep my bike object upright if < or > than 0 on x axis"
    I'm proud of you :)
    Really.
    You are on a hard road of real physics works like.
    I've made first project in that way. it has real round wheel(9 wheel colliders for one wheel(in shape of wheel))



    which "feel" ground below and changes torque from one to another, side forces to compensate lean, to imitate driftage and so on. It was hell for programming and awful results:
    http://unitybike.ucoz.com/ (feel some shame to show it ;))

    It's impossible to hold this bike upstreight, to lean, to turn, to play it with fun at least.
    But.... it's physically correct :) cool !
    And absolutely useless.

    So, that's why I deleted all "real physics" imitation code and rewrite everything.
    Now, main point of current Sportbike Pro Kit is based on "playing" :) with center of mass. Which one imitate real physics forces.
    It's much much easiest to handle and more stable when moving. Not so "physics" accurate :) but works well.

    Did you satisfied with answer ?
     
    Last edited: Feb 14, 2016
  47. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Ok, many thanks for your explanation, if I understand correctly your asset uses/changes center of mass, good thinking!
     
  48. bcman

    bcman

    Joined:
    Feb 9, 2013
    Posts:
    139
    Yes, exactly right.
     
  49. eddyjohnson3

    eddyjohnson3

    Joined:
    Jul 27, 2012
    Posts:
    49
    Cool asset, I am interested, but got a few questions before I pull the trigger:

    1. Are the issues reported above regarding Unity 5.3 fixed?
    2. I haven't really worked with mecanim yet, but I have played around with basic character rigging/animation in the past. I assume it should not be too hard to set up my own rider character that I have rigged and imported in Unity. Do you provide any docs on this?
    3. I was not able to get any wheelie stoppie to work in demo. I tried to shift riders wheight using V and F while accelerating braking or in the air, but could not get any results...
     
  50. hunterloftis

    hunterloftis

    Joined:
    Aug 19, 2015
    Posts:
    2
    Does it use standard Unity 5.3 wheel colliders? What kind of slip/stiffness settings are the default, and can they be changed?