• 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
Question by -GenericPath- · Oct 06, 2014 at 03:41 AM · rotationjavascriptrigidbody

Portal-like Rotating

Hello, I've recently started a gravity switching puzzle game. One of my ideas was to allow the player to switch their gravity then walk on different walls. I have been struggling with getting the actual rotating to work but after playing Portal (the first one) again I realized that upon exiting a portal your player does the rotation that I am wishing to achieve. I have tried every method I could find or think of, attempted to use the scripting reference examples but to no avail. I have had rotating work but then my mouse look script messed it up and I could not find a way to disable it while it is rotating, and only when it is rotating. I'm just wondering if any has any ideas of how to achieve this rotating. I'm not asking for full in-depth scripts just one or two lines demonstrating an idea. I could have been using a method incorrectly and then be able fix it that way, I'm just asking for a few ideas as to how this could be created.

TL/DR Ideas for how to rotate a rigidbody player ( I.E. like you see in Portal)

Comment

People who like this

0 Show 0
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

Answer by jpthek9 · Oct 06, 2014 at 03:56 AM

There might be more efficient ways to do this but this one is the simplest and requires minimal code:

  1. Make a gameObject at the 1st portal's transform. Make sure its localRotation is 0,0,0.

  2. Attach your player to the gameObject as a child.

  3. Attach your gameObject to the 2nd portal and set its localRotation to 0,0,0

Voila! Note: You can also teleport your player this way by changing the gameObject's localPosition to 0,0,0 after you attach it to the 2nd portal.

Comment

People who like this

0 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 -GenericPath- · Oct 06, 2014 at 06:36 AM 0
Share

Well, I was wanting more of a way to do the rotation similar to portal, without portals (should have explained). But I may be able to do this anyway because they don't necessarily have to be portals although i'm wanting to rotate to rotations other than 0,0,0 which is my main problem.. hmm I'll post my results

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

28 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

Related Questions

Finding A Rigidbody's Rotation Speed And Direction 2 Answers

Need help with limiting rotation. 1 Answer

transform.LookAt overrides rigidbody rotation 0 Answers

Clamp Bike Rotation 0 Answers

Rigidbody.MovePosition doesn't move reliably? 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