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 berting01 · Feb 09, 2012 at 08:45 PM · positionspawnportaltransforms

portal problem

hi, im trying to make a portal for a pacman type game. The rule is, when you enter the left side portal you will spawn to the right side portal and vice versa. the transport to the other side works fine. The problem is that the character is stocked to the spawn area. look at my code:

This for the Spawnpoint script :

 static var post;
 static var travel = false;
 var Portal1 = false;
 var Portal2 = false;
 
 static var p1;
 static var p2;
 
 function Update()
 {
     Portal1 = toPortal1.Portal1;
     Portal2 = toPortal2.Portal2;
     if(Portal1==true)
     {
         p1 = true;
         post = transform.position = GameObject.FindWithTag("portal1").transform.position;
         travel = true;
     }
     if(Portal2==true)
     {
         post = transform.position = GameObject.FindWithTag("portal2").transform.position;
         travel = true;
     }
 }
 
 function OnLevelWasLoaded(thisLevel: int)
 {
     post = transform.position = GameObject.FindWithTag("spawn").transform.position;
     travel = true;
 }

and this is to one of my portal script :

 static var Portal1;
 
 function Start ()
 {
     transform.collider.isTrigger = true;
     Portal1=false;
 }
 
 function OnTriggerEnter (col : Collider) 
 {
     if(col.gameObject.tag == "TIGER" )
     {
         transform.collider.isTrigger = true;
         renderer.enabled = false;
         Portal1 = true;
     }
 }

i hope that someone can identify the problem..thanks

Comment
Add comment · Show 4
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 sacredgeometry · Feb 11, 2012 at 01:11 PM 0
Share

Not sure what you mean by "stocked", can you elaborate please?

avatar image berting01 · Feb 11, 2012 at 01:21 PM 0
Share

after transferring to the other portal, the character doesnt move anymore.. it stays there

avatar image sacredgeometry · Feb 11, 2012 at 02:22 PM 0
Share

After it gets moved and whilst running the game are the scripts still attached to the gameObject?

avatar image sacredgeometry · Feb 11, 2012 at 02:26 PM 0
Share

Also Its a but hard to read your script given all the variables are implicit but you might be causing it to continually go through the portals.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sacredgeometry · Feb 11, 2012 at 02:32 PM

Your script is over complicated for just a simple transporting script. All you need to do is :

 var portal2 : GameObject;
 
 function OnTriggerEnter (col: Collider){
     if(col.gameObject.tag == "TIGER" && portal2.gameObject.active == true) {
         col.gameObject.transform.position = portal2.transform.position;
         renderer.enabled = false;
     }
 }

This should do a transportation on its own without the other bits. Sorry if this doesn't answer your question, but i cant see a problem with your script other than you might have intersecting colliders which are stopping your character from moving.

Comment
Add comment · Show 2 · 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 berting01 · Feb 11, 2012 at 05:30 PM 0
Share

i see .. ill try this one

avatar image sacredgeometry · Feb 11, 2012 at 05:35 PM 0
Share

"Just incase" - It goes on your portal.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Change spawn position, even when changing scene 2 Answers

Animation by Scripting point A to B 1 Answer

Spawning Error.. 0 Answers

Mysterious Rect problem 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