Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Questions about movement on uneven/slopped terrain and terrain coliders

Discussion in '2D' started by ssbbb, Jul 6, 2019.

  1. ssbbb

    ssbbb

    Joined:
    Jun 3, 2019
    Posts:
    9
    Hi,

    I have a few questions related to the game I'm developing.

    https://postimg.cc/hJWppdpQ

    I have a vehicle that needs to move on a randomly generated terrain and handle slopes. I'm not using wheels, but instead moving the vehicle with velocity. The ideal case would be if I can make the vehicle rotate according to the terrain edges and move smoothly (like shown in the picture).

    What would be your approach to this? What will be the standard way to tackle it? Launching raycast from the bottom left angle and calculating the distance from the ground, then rotating according to that?

    Also, what is the best collider for that kind of terrain? I'm planning on making it destructible, so it can take any shape.
     
unityunity