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 Ochmar · May 02, 2014 at 10:34 PM · teleporting

My teleport works only with going forward.

Yeah, so literally like a title says, my teleport works ONLY when i'm going forward (2d game so it's more like going "up". (wsad controls) Whenever i'm trying to reach teleport with going down (with s in this scenario) he just reaches teleport and stays there. I'm 100% sure about good tags, names etc. Here's code:

  function OnTriggerEnter(col : Collider) {     
  if (col.gameObject.tag == "CaveEnter1") {
      Debug.Log("Tp to cave");
      this.transform.position = teleportLoc[0].transform.position;
      this.transform.position.y += 1;
  }
  if (col.gameObject.tag == "CaveExit1") {
      Debug.Log("TP to BASE (test1)");
      this.transform.position = teleportLoc[1].transform.position;
      this.transform.position.y += 1;
      Debug.Log("TP to BASE (test2)");
  }
  Debug.Log("TP to BASE (test3)");

}

Funny thing is that, if i'll go to teleport with (example) "s" key (down) i can see in debug log TP to base(test1), tp to base (test2), tp to base(test3), but it does not teleport me.

Any solutions? Please.

Comment
Add comment · Show 2
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 FirePlantGames · May 02, 2014 at 10:54 PM 0
Share

you don't need those "this" things in there you know :P also, why are you moving your y up 1? and (I know you said you were sure but i'm going to ask anyways) is your collider a trigger?

avatar image NoseKills · May 02, 2014 at 11:57 PM 0
Share

$$anonymous$$ight help you to solve the problem if you print out the positions you're teleporting to, to see if maybe the teleporting does work but the locations are messed up. Something like:

 function OnTriggerEnter(col : Collider) {     
             if (col.gameObject.tag == "CaveEnter1") {
                 Debug.Log("Tp to cave from position " + this.transform.position );
                 this.transform.position = teleportLoc[0].transform.position;
                 this.transform.position.y += 1;
             }
             if (col.gameObject.tag == "CaveExit1") {
                 Debug.Log("TP to BASE (test1) from position " + this.transform.position);
                 this.transform.position = teleportLoc[1].transform.position;
                 this.transform.position.y += 1;
                 Debug.Log("TP to BASE (test2)");
             }
             Debug.Log("TP to BASE (test3) position " + this.transform.position);
 }

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Ochmar · May 03, 2014 at 09:07 AM

Yeah, my collider is a trigger. I'm moving my y up by 1, becouse when i didnt my Player was teleporting THEN stepping one time forward, now he's like teleporting to y+1 position, then going back to ((y+1)-1) so it looks more like he stays in this pos. (Tried to remove/change it, didnt have ANY impact in program).

Tried to print this, as you said to me, and found funny thing: http://scr.hu/0z5b/u5fr4 It looks like in Debug.Log he is actually changing position, then he's not teleporting at all, camera is not moving or something.

Found that SOMETIMES i can teleport from right side, still dont know why and when.

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.

Follow this Question

Answers Answers and Comments

22 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

Related Questions

How to stop my ghost AI from teleporting inside a wall 1 Answer

Teleporting 2 objects 1 Answer

teleport player in the direction they are looking, 1 Answer

Trying to teleport back and forth, but it randomly doesn't teleport 0 Answers

change scene and and position 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