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 Ztalei · Mar 19, 2013 at 09:09 PM · charactercontrollerontriggerenterrespawnfallingfalls

using OnTriggerEnter, char falls thru respawn point

So I have a cube that I stretched out under my racetrack to catch my character when it falls off the track. For my character, I'm using a character controller. For the cube, I'm using a box collider. I also have a respawn point located on the track that's a cylinder that also uses a box collider. I have attached the following code to my cube to catch my character (and I dragged the cylinder in as the Spawn):

var spawn : Transform; //drag spawn point to here in the inspector

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

Now here's the problem. When my character respawns, it is taken to the general area of the cylinder, but it immediately falls through it and falls through the track. I don't understand why this would be because both hold him just fine when the game starts out. The track has a mesh collider. Also, just to try some things, I attempted moving the cylinder up above the track--didn't help. Any ideas? Thanks.

Comment
Add comment · Show 5
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 hrlarsen · Mar 19, 2013 at 09:23 PM 0
Share

Are your GameObject with the tag "Player" the root parent of the player?

avatar image Ztalei · Mar 19, 2013 at 10:20 PM 0
Share

I'm not really sure what you mean. 3rd Person Controller is the thing that displays in the hierarchy. Under it are Bip001, construction_worker, and myCharacter. I have it so the construction worker is invisible, but my character is the one that displays and moves. $$anonymous$$y character isn't animated. I have 3rd Person Controller tagged as Player, but I've also experimented with tagging all of them as Player, but that doesn't help.

avatar image hrlarsen · Mar 19, 2013 at 10:25 PM 0
Share

please post your comments as a comment not an answer :) hmm, then it sounds wierd, have you tried pausing the editor as soon as a respawn occours to make sure that all components are as they should, and that you player collider is above the track collider etc.

avatar image Ztalei · Mar 19, 2013 at 10:46 PM 0
Share

I haven't tried pausing it yet. I didn't think of it because it goes so fast. I will try it tomorrow when I get back to my computer. But if it's not in the right place, I'm not sure what I can do because it's correct before the action occurs.

avatar image Ztalei · Mar 20, 2013 at 03:58 PM 0
Share

Okay so after pausing it, I could tell it was respawning too low. So I moved the cylinder way higher than it should be, and it worked. But it's doing a different strange thing that I can see now. $$anonymous$$y character respawns standing inside of the cylinder, even though the cylinder has a box collider on it and my character is able to stand on top of the cylinder at the beginning of the game. What am I doing wrong? Thanks.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by hrlarsen · Mar 20, 2013 at 07:14 PM

Just posting as answer now for others to benefit. Make sure that your collider is spawning above the track collider, you can see this by pausing the game when the respawning is done and see the state.

As for the other problem. Try to disable the Mesh Renderer on the cylinder (my guess is that you don't want to show it) and then make sure that your character has no collider, charactercontroller or rigidbody (these could be attached to the Root object if needed). Then you would have the character as a child of the "Player Object"

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

11 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

Related Questions

Moving a gameObject to the position of an empty gameObject 2 Answers

Need help with respawn after falling. 3 Answers

Trouble with a respawn script 1 Answer

character gravity problem 1 Answer

Check for Collision 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