Sign in to follow this  
adder

Unity Terrain affected movement [Unity5]

Recommended Posts

Hello

 

I've been trying to implement a movement system where objects move at a fixed pace relative to the terrain they're currently traversing. The terrain itself is just a flat plane with different regions, lets say: grass, rock, mud.

 

I'd love to get some suggestions on how to handle this, as I haven't been able to come up with a workable solution. I've tried having a grid of 1x1 Quads that advertise their terrain type and let the object adjust its speed accordingly, but that didn't give the wanted effect as I don't want grid based movement.

 

For now I'm thinking of adding different types of friction materials (but the question would again be how? afaik one would need some kind of in-logic generator that generates a bunch of meshes tailored to the shape of each surface region, and assign a Physic Material to that) however this would probably not work since if force 'F' keeps you at a constant speed at material 'M' with a certain friction, you'll not achieve a constant speed on a material with a different friction. (If my physics isn't failing me)

 

Long story short: I have no idea how to create a flat terrain with different surface types, each affecting the object's movement speed.

 

Thanks for your time. 

Share this post


Link to post
Share on other sites

Last time I did something like that, I didn't bother with having the geometry in the scene store the data, I had a texture map that stored the underlying terrain type. The terrain in that case was a subdivided quad that was UV'd, and the units on the terrain worked out where they were in the UV coordinates of the space and did a texture lookup to figure out the terrain type. Once I had that, I could use the value in a bunch of different calculations.

Share this post


Link to post
Share on other sites

The material way sounds probably the best way.  The crappy alternative that jumped to mind would be putting Colliders that are marked as triggers and having OnEnter and OnExit or something of that sort.  But if your terrain is at all large and/or varied, this would quickly become unmanageable.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Forum Statistics

    • Total Topics
      628293
    • Total Posts
      2981870
  • Similar Content

    • By CpawsMusic
      Hey there! My name is Cpaws and I compose music, sound effects and overall sound design for video games and film. I'm looking to work on a horror game mainly for fun and as an addition to my portfolio. I've used Unity & Wwise before for audio implementation.
      If you're interested in working together, don't hesitate to contact me at cpawsmusic@gmail.com
      Here's a few demo reels of my past projects: 
      Here's some snippets of some quick game music I've composed: https://soundcloud.com/cpawsmusic/sets/cpaws-video-game-film-music
      Here's my portfolio/website: https://CpawsMusic.com/
      E-mail: cpawsmusic@gmail.com
    • By muhamad rabee
      My first mobile game made by unity

      iphone: https://itunes.apple.com/us/app/aa-countdown/id1314223584?ls=1&mt=8

      android: https://play.google.com/store/apps/details?id=com.mr.AACountDown

      I appreciate every suggestion
    • By Simplepg
      https://play.google.com/store/apps/details?id=simple.gplay.GamesInABox
    • By Simplepg
      https://play.google.com/store/apps/details?id=simple.gplay.GamesInABox
    • By ForgedInteractive


      Who We Are
      We are Forged Interactive, a small team of like-minded game developers with the sole purpose of making games we love! We're a team of artists, animators, programmers, level designers, writers, composers, producers, and other creative minds. We want to make games that you, the modern gamer want to play! We hope to build a community that enjoys our games as much as we love creating them. With your feedback and support we will be able to achieve that.

      About the Game
      GAME NAME is a fun, action-packed army builder with unique characters, challenges and engaging levels. Set forth on an adventure to protect friends, family and countrymen from new adversaries. Once defeated your enemies turn coat and join you in your adventures. Players can enjoy a range of troops and abilities based on their gameplay style which become more important as maps introduce more challenging terrain, enemies and bosses. Strong orc knights, dangerous shamans, and even a dragon are out on the prowl. Knowing when to fight and when to run, and how to manage your army is essential. Your actions alone decide the fate of this world.

      Previous Work by Team
      Although we are working towards our first game as a team, our team members themselves have past experience in the industry.
      This includes members who have worked on titles including:
      Final Fantasy Kingsglaive, FIFA, Xcom 2 and Civilization.

      Who are we looking for? 3D Modellers Concept Artists Marketing Specialists Level Designer

      What do we expect? Reference work or portfolio. Examples what have you already done and what projects you have worked on academic or otherwise. The ability to commit to the project on a regular basis. If you are going on a two-week trip, we don't mind, but it would be good if you could commit 10+ hours to the project each week. Willingness to work with a royalty based compensation model, you will be paid when the game launches. Openness to learning new tools and techniques
      What can we offer? Continuous support and availability from our side. You have the ability to give design input, and creative say in the development of the game. Shown in credits on websites, in-game and more. Insight and contacts from within the Industry.
      Contact
      If you are interested in knowing more or joining. Please email or PM us on Skype. Myself or Colin will reply to you within 48 hours.

      E-mail: Recruitment@ForgedInteractive.com
      Skype: ForgedInteractive

      Regards,
      David and Colin

      Follow us on:

      Facebook: https://www.facebook.com/ForgedInteractive/
      Twitter: @ForgedInteract
      Youtube: https://www.youtube.com/channel/UCpK..._as=subscriber
      Reddit: https://www.reddit.com/user/Forged_Interactive/
  • Popular Now