Terrain Collider

luluululuu Posts: 3Member

There is a way to make a collider like this?:(manual setting-up)
I tried with CollisionPolygon2D without success because it connects the end-points :(


Tags :

Best Answer

  • SolarLuneSolarLune Posts: 37
    edited March 2018 Accepted Answer

    Can you add two more points to the lower corners, essentially making a box with the top being the desired terrain?

Answers

  • SolarLuneSolarLune Posts: 37Member
    edited March 2018 Accepted Answer

    Can you add two more points to the lower corners, essentially making a box with the top being the desired terrain?

  • luluululuu Posts: 3Member

    @SolarLune said:
    Can you add two more points to the lower corners, essentially making a box with the top being the desired terrain?

    That's good idea, but what with performance? I assume that is the only way to do this, so thank you very much!

  • NeoDNeoD Posts: 170Member
    edited March 2018

    If your terrain is drawn by a textured polygon you can reuse the vertices in order to create the collision shape when the scene starts.
    It needs some lines of code but it will be accurate, and above all, it's done automatically for every new level.

    If you really want to avoid the two unused corners points, use simple segment shapes instead. But I don't know how to set them automatically at runtime.

  • SolarLuneSolarLune Posts: 37Member

    I'm late to replying, so sorry!

    I don't think that two extra points would be such a huge deal for performance.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file