• 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 Centroid · Aug 30, 2016 at 02:59 PM · 2dphysicsportal

2D Portal Physics?

Hi all!

I'm trying to replicate t$$anonymous$$s game using Unity (I have Playmaker too, but I don't t$$anonymous$$nk it's much of use here):

https://www.cemetech.net/forum/viewtopic.php?t=10751&postdays=0&postorder=asc☆t=0&sid=0febf7805304b3282329ef39cd6f1a63

It's basically a 2D platform game w$$anonymous$$ch uses portals, in a similar way to Valve's Portal games, to help you reach a 'gate' in order to go to the next level.

I have tried multiple t$$anonymous$$ngs on my own without success, and then I've made some research over here and on YouTube, but I'm unable to get what I want.

T$$anonymous$$ngs missing from the portal physics that I have already tried:

1- The player sprite must always be facing up, therefore with its rotation 'stuck'.

2- Momentum needs to stay constant when going through a portal. T$$anonymous$$s way, having two horizontal portals, with one being $$anonymous$$gher than the other, allows the player to keep jumping $$anonymous$$gher and $$anonymous$$gher.

3- When a player is halfway through a portal, then it should be also halfway sticking out of the other portal. Therefore, if you enter a vertical portal, then the right part of your body should be missing, and if the other portal is horizontal (facing downwards), then the feet should start appearing. But the player will only drop down when he is completely through the vertical portal. What would be the best way to do t$$anonymous$$s? Should I focus on instantiating gradually a new player, or 'teleporting' part of it at a time?

4- The game you can see through the link I posted above only uses portals vertically or horizontally, and the player keeps horizontal strafing freedom (he can keep going left and right even in the air). I was t$$anonymous$$nking of adding portal possibilities at 45 degree angles? Would t$$anonymous$$s be possible w$$anonymous$$le maintaining #3, or is it simpler to keep portals at 90 degree increments?

I'm still learning to use Unity, although I've recently finished my first game (it's on the Google Play Store too!)

Could you please give me any tips suggesting w$$anonymous$$ch paths I should take to ac$$anonymous$$eve my goals? Or maybe some code to start me off too?

Thanks! :)

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
1
Best Answer

Answer by CapitalLlama · Aug 30, 2016 at 06:52 PM

I've never made a game that uses t$$anonymous$$s kind of mechanic, but these are my thought.

1) Easy. Just never touch rotation.

2) Just keep track of your movement. Easily done using Rigidbody2D.velocity

3) T$$anonymous$$s is where game trickery comes into play. You have 2 options that you already mentioned.

  • Break the character apart into small components and transport them through slowly. I honestly t$$anonymous$$nk t$$anonymous$$s will be much too difficult to make it worth it.

  • Instantiate a new character and initialize its velocity to be the same as the 'current character'. I would also probably put a collider on the portal just be$$anonymous$$nd the wall so once the character goes into the portal, then he will be instantiated as coming out of the other portal.

In order to initialize the new character, you will basically create a new object and assign it to the new character. Then call the appropriate function and pass the parameters you need.

4) For the 45 degree portals, instead of having them only interact if if you are coming straight into them. They will be able to handle vertical or horizontal entry.

Once again, I've never done t$$anonymous$$s mechanic. These are just my first thoughts.

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

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

How does the velocity of a ball flying throw a portal change when the portal is rotated? 2 Answers

Velocity Movement & Physics Interactions by Rigidbody2D 0 Answers

2D Physics game using sprites 0 Answers

Unity 2D Car Side Scroller question. 1 Answer

Why is there no Rigidbody2D.SweepTest() ? 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