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
1
Question by remvan3d · Jul 12, 2010 at 08:31 AM · collisiontriggerrespawnpoint

Trigger respawn after collision?

So I am working on this diving game prototype that I posted about earlier, and I am a complete 'tard when it comes to scripting so I therefore need some help with this one.

I need the make the player respawn back on top at the diving board a couple of seconds after hitting the water.

I tried to look at the Lerpz 3D tutorial, but can't seem to figure out how to make it work in my own project. Any clues on how to do this?

What I think I understand by now is that I should create a collision object in the water that makes the player respawn at a selectet position (spawnpoint) after hitting it.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
7
Best Answer

Answer by Mike 3 · Jul 12, 2010 at 09:51 AM

You can attach something like this to your water, though you'll have to make sure the player has a rigidbody and collider, and the water has a trigger collider:

var spawn : Transform; //drag your spawn point to here in the inspector - probably make it an empty gameobject so you can move it about on the diving board

function OnTriggerEnter(other : Collider) { if (cother.tag == "Player") { other.transform.position = spawn.position; } }

Comment
Add comment · Show 3 · 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 knuckles209cp · Oct 19, 2013 at 05:20 AM 1
Share

I love you

avatar image ScaleneParkour · Apr 09, 2015 at 08:08 PM 0
Share

What is this in Ive tried java c# and Boo it works in java but says it doesnt reconize the cother part. Please help.

avatar image flapperkewiet · Apr 09, 2015 at 08:20 PM 1
Share

i think thats a typo it has to be other.tag == "Player

avatar image
0

Answer by munaeem · Oct 06, 2012 at 05:03 PM

Fantastic :)) Works great man :) Thank you !!

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
avatar image
0

Answer by ZubakIVAN · Jan 10, 2018 at 11:25 PM

For 2D script looks like this:

     var spawn :
     
     function OnTriggerEnter2D(other : Collider2D) {
         if (other.tag == "Player")
         {
             other.transform.position = spawn.position;
         }
 }






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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I make a character die when he fells. 1 Answer

how to make triger fireball not to pass through spesific objects 2 Answers

My movement function with jump won't work with collider function 1 Answer

Instantiated Prefab's script doesn't work 2 Answers

Reset GUI texture after respawn 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