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 PuneetK · Sep 10, 2013 at 10:25 AM · transformtilesportalportals

Portal issue and transform.position

I'm trying to make a portal on which if my player enters, he gets transported to a certain position elsewhere.

Right now I'm using the following logic.

     if(tile.tag=="portal")
             {
                 
                 int x = System.Convert.ToInt32(portaldest.transform.position.x);
                 int y = System.Convert.ToInt32(portaldest.transform.position.y+1);
                 int z = System.Convert.ToInt32(portaldest.transform.position.z);
                 
                 player.transform.position = new Vector3 (x,y,z);
                 print (player.transform.position);
              }

This logic seems to be correct, and should work perfectly. The issue I'm getting here is, say my portal destination is the spot (0,0,-3), the player gets moved to a different position which is (0, 0, 3.4) which shouldn't happen. As I even made the position to be an int position.

edit: When printing, it shows the position as (0.0,0.0,3.0) so it should be working. :/

edit2: Just some things you might want to know. The player is a rigid body, use gravity is on, freeze x and z are on. Collision detection is continuous. If I remove the freeze on x and z I can't enter the portal, and if I remove gravity, it's y axis increases to infinity after entering the portal.

Comment
Add comment · Show 23
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 cod · Sep 10, 2013 at 10:57 AM 0
Share

Just try to remove sistem.convert and only put transform.position = portalDest.transform.position

Let me know if it works :)

avatar image PuneetK · Sep 10, 2013 at 11:08 AM 0
Share

Same issue, which is why I put in the system.convert, hoping it would work :(

avatar image cod · Sep 10, 2013 at 11:13 AM 0
Share

Are u using the fps controller?

avatar image PuneetK · Sep 10, 2013 at 04:48 PM 0
Share

Nope, the player is a rigid body thts moving via forced inputs.

avatar image cod · Sep 10, 2013 at 05:02 PM 0
Share

can't it be a problem of child/parents? Could u please post a picture of the hierarchy in the scene?

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.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

making a non walk through portal 2 Answers

Creating portal camera view with render textur 0 Answers

True Portal Effect 1 Answer

create a portal with texture render 3 Answers

Pixel Perfect 2 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