Search Unity

Unity Spline With Physics

Discussion in 'Getting Started' started by directx, Mar 20, 2015.

  1. directx

    directx

    Joined:
    Dec 11, 2014
    Posts:
    47
    i want to make game like this



    and i want to add obstacles on the path and player can jump and climb along with the curved path
    please help me to do this
     
  2. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    You might want to take a look at MegaShapes, it is designed for doing just those sort of things, there are a load of videos showing the system in use and there is a demo which shows objects moving and jumping on the surface and obstacles place on the surface as well and you can even change the level as you play. The MegaMoo demo can be tried Here

    Good for racing games as well.
     
    theANMATOR2b and Ryiah like this.
  3. directx

    directx

    Joined:
    Dec 11, 2014
    Posts:
    47
    how can i use this please help
    actually i want move bike on path
     
  4. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    Well you would need to get the Asset from the Asset Store or the authors website, there is a path follow system included and even scripts for moving animated characters along a path and moving rigid bodies along paths. If you dont want to purchase an asset then I cant really help as it is beyond my coding skills to tell you how to do it, thats why I use the Asset Store :)
     
  5. directx

    directx

    Joined:
    Dec 11, 2014
    Posts:
    47
    i can buy it no problem before that i want to know it is work for me

    this is how i move the bike

    rearWheel.rigidbody.AddRelativeTorque (new Vector3 (0, 0, -speed * Time.deltaTime),ForceMode.Impulse);

    and i want to move it on curved paths some times

    like this
     
  6. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    That looks like it would be no problem, the system has a complete api for creating splines, adding points, auto smoothing etc so you can create splines just as in the example above, and then there are simple methods to get points on the spline so you would just get a point a bit ahead on the spline and use that to apply a force to your bike, you could also add impulse forces to keep the bike on the spline which I think is what the author does in the included move rigid body script. They also recently added an example script to show how splines and lofts can be drawn at runtime by the user, and the mega moo demo in the first video as methods to allow you to alter a path at runtime as well.


     
    Ryiah likes this.
  7. showoff

    showoff

    Joined:
    Apr 28, 2009
    Posts:
    273
    motion tween is the other option you can look into. It's free and it does pretty much the same stuff as that game you posted. They show a example using it doing the samething.
     
    theANMATOR2b likes this.
  8. directx

    directx

    Joined:
    Dec 11, 2014
    Posts:
    47
    i want move bike like this curved track