Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
2
Question by e1e1e1 · Jan 27, 2019 at 08:56 PM · gravityontriggerenterontriggerexitontriggerstayelevator

Possible Colliders problem. Maybe gravity problem.

hey.

I made a scene with player, 3Ds max mesh and some unity objects.

so I made simple "elevator" by using flat cube and "Trigger on stay" component and its working fine (the cube moving between edge of empty object which contain the script).

public GameObject nott;

private void OnTriggerStay() { movit.transform.position += movit.transform.up Time.deltaTime; nott.transform.position += nott.transform.up Time.deltaTime; }

then I made an automatic door with "Trigger in enter / exit" to the enter of the 3Ds max mesh (house) which is also working.

after that is wanted to give the elevator more realistic look and action and duplicated the automatic door and posit it to the enter of the lift floor and then the problems started to appear. as I press play, the player started to "fly" in the scene of falling down beneath the floor like there is no mesh collider or gravity in the scene.

but if I put the duplicate of the automatic door somewhere else in the scene, everything wirking fine again. someone know what cause this bug?

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 tormentoarmagedoom · Jan 27, 2019 at 10:24 PM 2
Share

Good day.

Can we see the code with that collisiond etections (triggers) $$anonymous$$ost probably the colilders are activateing some method when you dont want to.

Also post some images of the scene to see the colliders, and the inspector of the elevator. (I recommend you to make a easy paint image with screenshots to post it here)

Ps: I changed a little the title to help you get an answer.

Bye!

avatar image e1e1e1 tormentoarmagedoom · Jan 28, 2019 at 06:54 AM 0
Share

Yes this is the elevator code:

public class elevator : $$anonymous$$onoBehaviour { public GameObject movit;

 public GameObject nott;


 private void OnTriggerStay()
 {
     movit.transform.position += movit.transform.up * Time.deltaTime;
     nott.transform.position += nott.transform.up * Time.deltaTime;
 }

}

this is the automatic door code:

public class Door : $$anonymous$$onoBehaviour { Animator animator; bool doorOpen; public AudioClip DoorSound;

 // Start is called before the first frame update
 void Start()
 {
     doorOpen = false;
     animator = GetComponent<Animator>();
 }

 private void OnTriggerEnter(Collider col) 
 {
     if(col.gameObject.tag == "Player")
     {
         gameObject.GetComponent<AudioSource>().PlayOneShot(DoorSound);

         doorOpen = true;
         DoorControl("Open");
     }
 }

 private void OnTriggerExit(Collider col)
 {
     if (doorOpen)
     {
         gameObject.GetComponent<AudioSource>().PlayOneShot(DoorSound);

         doorOpen = false;
         DoorControl("Close");
     }
 }

 void DoorControl (string direction)
 {
     animator.SetTrigger(direction);

 }

}

now when I put the duplication of the door next to the elevator:

[url=https://postimages.org/][img]https://i.postimg.cc/B6sxSvvz/image.jpg[/img][/url]

my player starting to fly even if its in other place in the scene, outside the building and on another mesh:

[url=https://postimages.org/][img]https://i.postimg.cc/tgb1P$$anonymous$$HZ/e.jpg[/img][/url]

avatar image haruna9x e1e1e1 · Jan 28, 2019 at 06:59 AM 0
Share

Please reformat this comment. You should also post the code on your question.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by unity_DKqnJkGo8MOKYQ · Jan 28, 2019 at 06:01 PM

Could the player rigid body be "sleeping" perhaps? You could test w ProjectSettings / Physics / sleep threshold to 0, to see if that is it. If so, I would wake up player object everytime the elevator is activated.

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 e1e1e1 · Jan 28, 2019 at 07:03 PM 0
Share

there is no rigid body in the player. I think is something about the on trigger of the elevator with this of the door...some overlapping. But I don't know how to deal it

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

105 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 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 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 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 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

Have "OnTriggerStay" detection but only call it once? 1 Answer

Trigger area around player. 1 Answer

How can I get trigger enter/exit every frame when I change Time.timeScale? 0 Answers

OnTriggerEnter only working once. 0 Answers

MonoBehaviour.OnTriggerX vs Collider.OnTriggerX 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