Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 J_Ripley · Dec 27, 2021 at 08:16 PM · cameracollisioncollidercharactertriggers

Triggers not changing cameras

The character has both Rigidbody and Box collider. I used cubes which I named for example Trigger01Forward and Trigger01Back which has box colliders but it was set as Trigger where the character can walk through it. The script as a generic to operate on all the cameras requires dragging the camera number to turn on and the Camera Number to turn off in the Inspector tab. However, when the character walks through the triggers the cameras do not change. The attached image gives a better understanding which also includes the C# coding. Could use some advice and assistance.alt text

cameras-not-changing.jpg (164.5 kB)
Comment
Add comment · Show 1
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 endasil_unity · Dec 28, 2021 at 11:34 AM 0
Share

It would help if you provide more information on what steps you have taken to narrow down the issue so we know where to look for the problem.

Is the collision detected at all? Does it successfully match the tag? For example, if you add a Debug.Log inside the other.tag == "Player" does it print?

 void OnTriggerEnter(Collider other)
 {
 
     if(other.tag == "Player")
     {           
            Debug.Log("Collision detected with player");
            camerOn.SetActive(true);
            cameraOff.SetActive(false);
            Debug.Log("Camera states changed");                  
    }
 }

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by J_Ripley · Dec 28, 2021 at 04:38 PM

Thank you for the input. The console does print out collision detected and the Camera states changed. Basically having to modify the triggers. While researching I did run across a video on Cinemachines State Driven Camera system. Since this will be an action-packed system, while at the same, building up my grandchildren's critical thinking skills on mathematics and decision-making process, I may wind up doing two different versions of this, one with camera changing by triggers and the other trying out the Cinemachine State Driven Camera system in order to compare which provides the better angles for actions scenes and etc. Thank you for the input and the two lines of code.

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 endasil_unity · Dec 28, 2021 at 10:09 PM

Okay, if that did not help you solve the issue it narrows down the troubleshooting field a bit more. Your image is very blurry so I can't see much detail there. Is it the camera component or game object that is deactivated? I noticed that you're activating and deactivating game objects, so if it is the camera component on the game object that you have deactivated, this would not turn it on. If you look in the inspector after entering the trigger, are those game objects disabled/enabled? Is the camera you're disabling from your script the active camera that is displaying the screen? That is if you disable this camera manually, does the game view go blank with the no camera rendering text?

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 J_Ripley · Dec 29, 2021 at 04:06 PM 0
Share

Thank you for contacting me back. Camera01 is on while the others are off at the start of the game. It is viewing the character's left profile or side. Camera03 is located at the far wall in front of the character but is turned off and the angle of Camera03 is viewing the front of the character if it was turned on. Camera26 is above the character and slightly past the character's right shoulder. There are two Triggers, side by side should the character turn left and walks across the hallway. The first trigger the character walks through turns Camera01 off and turns Camera26 on. The second trigger he crosses immediately behind the first does the reverse should the character see danger, turns around and walks in the opposite direction. Camera01 does go off for a few seconds but immediately turns back on and Camera26 turns off where you are unable to see the character.

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

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

Help!Crash! FatalError"Callback registration failed kMaxCallback" 1 Answer

add camera collision without CharacterController 1 Answer

How can i check if a trigger is completely full? 1 Answer

Camera Collision Not Working 0 Answers

How to stop Camera from going into colliders 3 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