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 sebasl63 · Apr 28, 2014 at 02:24 AM · buttoncubesphereballroll

How to make a "pressure sensor" of sorts that when rolled over switches to another scene

First of all, I've just started using Unity so I don't know quite how to explain what I am doing.

Anyways I've been making a game for a class at my school and I need to know how to change to "Level2" when I roll over a cube with a sphere.

Something like a "pressure sensor" maybe?

I thought I could do something with the Box Collider but I'm not quite sure how to do it. It would really help if someone knew of some code that would help with this. I'm using Javascript in my project.

The picture below shows the cube in the hole that I need to roll over. I just need to make it so when I roll over the cube it immediately switches to another scene titled "Level2"

Thanks in advance for any answer I might receive!

  • Sebastian

alt text

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by getyour411 · Apr 28, 2014 at 03:11 AM

Put a test cube in your scene mostly submerged below the terrain, attach a basic OnTriggerEnter that calls Application.LoadLevel on player entry; all these parts are well documented with many examples, doc, videos/tutorials, code snippets. Please try research and reading a bit, implement the basic parts in code and ask a new question if needed.

Comment
Add comment · 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 sebasl63 · Apr 28, 2014 at 03:29 AM 0
Share

Alright, I'll try researching a bit. Thanks for the answer!

avatar image
0

Answer by SteelArrow21 · Apr 28, 2014 at 03:20 AM

Ive got a script in C#, but you wont need to do any editing to the script so you can use it if you want. Make an empty game object with a collider slightly sticking above ground. Tag the player as "Player" and attach this script to the empty game object. (Name it "PressurePlate")

 using UnityEngine;
 using System.Collections;
 
 public class PressurePlate : MonoBehaviour {
 
      void OnTriggerEnter (Collider other){
      
           if(other.tag == "Player")
                Application.LoadLevel("Level2");
      }
 }

Hopefully there won't be errors. If there are, post them and I'll fix it.

Comment
Add comment · 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 sebasl63 · Apr 28, 2014 at 03:31 AM 0
Share

Thank you so much! This really helps! I'll try it out when I get the chance and get back to you if I have any questions. Thanks again :)

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

Ball Doesn't Roll Down Hill - Physics Problem 3 Answers

Strange sphere/physics rolling behaviour when scaled 1 Answer

Create a "free" rolling ball controlled by player 1 Answer

How can i keep this button pressed without acctualy doing it ? 0 Answers

Rolling sphere "foot" on ground? 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