• 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 ChaosRobin · Nov 08, 2016 at 07:45 AM · scripting problemjointslogicconstraints

Caterpillar mechanics in unity.. 'make spheres follow'

Hey all.

Im making a game for class. Its essentially a caterpillar clone from the days of old.

so far i have a script that when applied to a model, it will lead that model forward at a consistent rate. When a collider attached to this object collides with another collider tagged 'left' or 'right' the script will make the model rotate +/- 90 degrees. That part is working fine, whats not working is attaching that same script to multiple objects.

In this case ive used a sphere. The first sphere in the array works fine, butt it doesn't take long for all other spheres to group up and split apart in a way that is not aesthetically pleasing. Ideally, i would like the first sphere to 'pull' the other spheres without causing them to clip through the other assets in the level space. Ive tried using a spring and a joint constraint, but these ideas didnt pan out.

I'm hoping someone here can give me some tips or talk me through the logic to make this happen. I can post snippits of the code or even make a youtube video of the game in progress to help get some feedback. Any ideas?? Thanks!!

Comment
Add comment · Show 5
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 Imankit · Nov 08, 2016 at 09:31 AM 1
Share

$$anonymous$$ake all spheres which are the behind the first sphere follow and lookAt the sphere before them. In that way there will be a smooth snake or caterpillar like movement. Ofcourse you will have to tweak the speed but by far its the best thing you can do

avatar image ChaosRobin Imankit · Nov 08, 2016 at 09:44 AM 0
Share

Thanks ill try now. i was just writing a very complicated script that probably wouldn't have worked anyway. lol.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

[Compute Shader] Pixel Data from Texture Coordinates 0 Answers

How to prevent Unity to execute all the code in the first frame. 1 Answer

How to trigger udpate in editor mode only when I modify component parameters 1 Answer

pubblic variable don't get change from script with OnTriggerStay 1 Answer

does not want to work MoveTowards 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