• 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 /
  • Help Room /
avatar image
0
Question by Ratnesh_Unity3d · Dec 13, 2015 at 04:26 PM · 2d game

Mirroring the player in a 2d side scrolling game. [ Similar to Tiny Magnets Game]

Guys,

      I'm trying to create exact prototype of some 2d games to find out the hardest part in 2d game development, and I hit that part recently. 

       Tiny Magnets - 2d side scrolling game. Available in Android. 

        This game has two gameobjects moving from left to right. One is above the screen.height/2 and other below. When tapped above, the one on the upper half of the screen should jump and vice versa.  Multi touch should work instantly when tapped on both sides of screen and both should jump at the same time..     I've done upto this.

         The square metal boxes(sprites I think) are the obstacles as platform, kept unevenly in which these gameobjets should avoid by jumping.  I've done this too... 
       
      Problem : when I make both jump , one of the object collides with metal boxes and stops there. Because of that, other stays at the current position.

      Help me out to find this logic, when one stays at x position other needs to stay in its x position depending on the other's position that got hit with obstacles. When trying to do, transform.position = new Vector3( followobject.transform.position.x, transform.position.y, z); 

But it passes through the collider.

Please play that game to know more about it. And pls reply if you find the logic.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ecggm86 · Dec 13, 2015 at 07:39 PM

Maybe because you are using directly the transform position instead of the rigidbody2D, maybe that's the reason it passes through the collider2d, I don't know honestly

Comment
Add comment · Show 1 · 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 Ratnesh_Unity3d · Dec 14, 2015 at 02:45 AM 0
Share

Hi man,

        Thanks for the reply. Actually i got the answer, we need to use Wheel Joint 2D to accomplish. Because it will hold two objects one below other.

So it looks like mirroring an object. So one object moves other will also moves... No need of Transform as well.

But to keep both on platform we need rigidbody and colliders. thanks though mate.

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

2D Camera RPG 1 Answer

Unity2D Check which direction the enemy AI is heading? 1 Answer

Why does this code run infinitely? 1 Answer

Pick up Items and Deep Copies 1 Answer

what is the most efficient way to create a map for a 2D endless runner? 0 Answers


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