Guest User

Unity 2D Spline Terrain

a guest
Aug 22nd, 2013
1,104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. Unity 2D Spline Terrain
  2. Created by Chevy Ray Johnston
  3. @chevyray | [email protected]
  4. =======================
  5. Download here: https://dl.dropboxusercontent.com/u/1532933/Spline.zip
  6.  
  7. To use:
  8. 1. Have a "floor" texture material ready to go
  9. 2. Import the package, you will get 2 scripts (Spline.cs and SplineEditor.cs)
  10. 3. To create a spline, go GameObject -> Create Other -> Spline
  11. 4. This will create a simple 4-point spline, but it will be invisible, so now drag your
  12. "floor" material onto its MeshRenderer, so it knows what texture to use
  13. 5. Now you should see your spline. To edit the spline, switch to the View Tool (Q),
  14. and the spline control points will appear
  15. 6. You can create new control points with the [+] buttons and delete control points
  16. with the [-] buttons. The two control points at the end are for controlling how
  17. the spline ends.
  18. 7. A MeshCollider is automatically generated, it will be a child object of the spline
  19. 8. Try playing around with the various properties on the Spline component to see what
  20. they do, I probably named them badly. I usually set "Pixels Per Unit" to the height
  21. of the "floor" texture in pixels, so that 1 Unity unit == 1 full height of the texture,
  22. but you can tweak this to your liking.
  23. 9. If the collider is too beefy, try increasing the "Segment Length". This will make the
  24. ground a bit chunkier, but will alternatively make the collider simpler.
  25.  
  26. Feel free to email me if you have any questions. This is just a little toy I created in like 6 hours,
  27. so if you're going to use it in your game, BACK IT THE FUCK UP first, I don't want to be responsible
  28. for breaking your project if this thing has horrible unforeseen errors or anything.
  29.  
  30. Peace.
Advertisement
Add Comment
Please, Sign In to add comment