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 Sham · Sep 02, 2010 at 06:38 AM · colliderobjectscene-loadingmultipledetection

Multiple Object Collider Detection to load new scene

Hi,

I am doing a hang glider game, whereby there's 5 rings in a terrain and the objective of the game is to fly through all the FIRST 4 rings first before you can go on to the 5th ring which will then load a new scene(A fast video and then a LEVEL Completed page )

I am currently having only one problem.

My hang glider can detect all individual rings i go through however, how do we set it up so that the NEW SCENE(video...) will only load IF I went through all of the FIRST 4 Rings, not any less. I Tried using public/static var and etc but it wont work as there's an error saying Unknown Identifier.HELP!!!

This is my current script for each of the first 4 ring

var airplane : GameObject; var Ring : GameObject; var ringscore1 : boolean;

ringscore1 = false ;

function OnTriggerEnter (other : Collider) { var distanceToRing; distanceToRing = Vector3.Distance(airplane.transform.position,

transform.position); print ("Distance to Ring: "+distanceToRing); //~ distance check

ringscore1 = true ;

}

and this is my current script for the 5TH Ring

function OnTriggerEnter (other : Collider) 
{
   if ((ringscore1 == true) && (ringscore2 == true) && (ringscore3 ==

true) && (ringscore4 == true)) { yield WaitForSeconds(3); Application.LoadLevel("scene6Landing"); } }

Comment
Add comment · Show 3
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 · Sep 02, 2010 at 06:50 AM 0
Share

Can you edit your question and fix the formatting please? Your text is in code boxes, and your code is plaintext. Also, caps in the question title is a sure way to be noticed, but in negative light. The people here are giving their time to help, and (I would assume) don't much like being yelled at.

avatar image Sham · Sep 02, 2010 at 07:17 AM 0
Share

i apologise as i do not have experience in asking these questions and formatting. i improved it though. do help :)

avatar image · Sep 02, 2010 at 07:35 AM 0
Share

Thanks! How you ask your question makes a big difference to the answers, and the overall quality of the wiki. How are you accessing the ringscore1 -> ringscore4 variables from the 5th ring script? Are you using GetComponent to look them up? I'd have suggested to use static vars, but you said you got an error - what was the exact error?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by StephanK · Sep 02, 2010 at 08:01 AM

You are trying to access ringscore1...4 in your 5th ring script. I think ringscore1 is in another script so you can't access it through name only. What you have to do is GameObject.Find("Ring1").GetComponent("YourScript").ringscore1

However this is a bit clumsy, so a better idea would to make RingManager script with a bool[5] in it and update that each time one of the rings is hit. You could also put this array in the script for your final ring.

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

No one has followed this question yet.

Related Questions

Object detection in front of Character 1 Answer

Detecting inside an area without a collider 1 Answer

Need some help an object collider that stops a timer then displays it on another scene 1 Answer

1 Collider and multiple objects 1 Answer

how to check if one object is colliding with another 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