Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 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 /
  • Help Room /
avatar image
1
Question by shadowpuppet · May 26, 2016 at 05:20 PM · triggering animation box collider

one object triggers another ( neither object the player)

I have an object a child of the player called "crosshair" and tagged as such. the object is in front of the player so when THAT hits the trigger zone( not the player) I want the animation on the game object called and tagged "dancertest" to play. But I can't get it to work and can't understand why. If I substitute "player" in the script like so at at he end...... if(other.tag == "Player") instead of if(other.tag == "crosshair") the player then triggers the animation I want. So what am I missing here? Everything seems to be in order or substituting that one word wouldn't work either. This object called "crosshair" has a box collider on it, name and tag match script

 using UnityEngine;
 using System.Collections;
 
 public class InAim : MonoBehaviour {
     GameObject crosshair;
     GameObject dancertest;
     Animation animation;
 
 
     void Start () {
         crosshair = GameObject.FindWithTag("crosshair");
         dancertest = GameObject.FindWithTag("dancertest");
         //animation = GameObject.GetComponent.("dancertest")<Animation>();
     }
     
 
 
         void OnTriggerEnter (Collider other) {
             if(other.tag == "crosshair")
             dancertest.GetComponent<Animation>().Play();
     
     }
 }
 
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Thajocoth · May 26, 2016 at 06:38 PM

Which of the colliders involved are and are not triggers?

When I've had both trigger and non-trigger colliders that I want the same object to trigger a response to, I've had to give that object double the colliders... One trigger copy and one non-trigger copy, as the trigger colliders only trigger other trigger colliders and vice versa.

I have no idea if that's your issue or not, but if it is, it should be easy enough to fix.

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

57 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

Related Questions

OnTriggerEnter and Exit using Position Markers? help?? 1 Answer

How do i make my arrow hit an enemy and instantiate a blood sprite in its place? 0 Answers

I want to freeze fp player , animation then starts , then unfreeze the character . 0 Answers

AI Open Door (Collision detect) 0 Answers

How to Instantiate a prefab with radius using OverlapCircleAll ? 0 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