Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by LeHoppel · Jan 28, 2021 at 04:28 PM · 2d gamecolliders

Player leaving a solid trail with a collider like in a snake like game,Leave a solid trail with a collider in a snake like game

I'm trying to make a 2d game right now, where all players are small dots that leave a solid trail behind them so you cannot "drive" through your own or other player's trails.

I'm relatively new to Unity so I'm kinda puzzled right now. Any ideas on how to do that? I already read up on Composite Collider 2D but I don't think it really is what I want :/

Maybe something with a line renderer? But I'm not familiar with that aswell. I've found a few solutions but those are years old and didn't work when I tried them out :(

Hope someone has an idea!,I'm trying to make a game right now, where all players are small dots that leave a solid trail behind them so you cannot "drive" through your own or other player's trails.

I'm relatively new to Unity so I'm kinda puzzled right now. Any ideas on how to do that? I already read up on Composite Collider 2D but I don't think it really is what I want :/

Maybe something with a line renderer? But I'm not familiar with that aswell.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Llama_w_2Ls · Jan 29, 2021 at 07:49 AM

In the snake game, a way I would do it, is just to instantiate a box-like dot, at the snake's tail whenever it gets bigger. Each section of the snake, therefore, has its own box collider. No need for messing around with complex meshes anymore.


Anyway, the way this would work is, when a key press is detected, it might leave a mark on the board, then, whenever any box collider (section of the snake's tail), enters that mark, it changes direction. I'll help you out further if you need it. This should create a trail-like snake game.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by LeHoppel · Jan 29, 2021 at 07:55 AM

Hey thanks for answering!

Sorry I think my description is a bit misleading. I don't want the trail to follow the "head"/the player but rather that all players leave solid "walls" where they go. Imagine it like this: everybody has the same speed and you can only win by outmaneuvering your enemies or to wait until they all drive either into the level border or someone's trail.

I've also read up on a snake game tutorial but the big difference is that my trail grows constantly and not just when the snake eats. Thus I would create dozens of gamwobjects per seconds with such an approach I think

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Llama_w_2Ls · Jan 29, 2021 at 08:59 AM 0
Share

Ah ok. Well one thing you might want to look into is combining meshes. This allows you to instantiate lots of gameobjects, and combine them into one, with one single complex mesh collider in your scene. This way, whenever you move, you can instantiate a block and combine it to your current trail. You might find this helpful. @LeHoppel

avatar image LeHoppel · Jan 29, 2021 at 04:17 PM 0
Share

I posted my answer as a standalone comment greeaat...

Thank you very much; I'll have a look into that!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

143 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it better to use colliders or a function? (2D game) 2 Answers

Tilemap Collider 2D not generating colliders...,Tilemap Colliders won't generate.... 0 Answers

How to use non-convex mesh collider with dynamic rigid body physics? 1 Answer

physics.OverlapSphere colliders 1 Answer

How to make a 2D stairs you can walk by 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges