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 s.23 · Jun 30, 2014 at 07:18 PM ·

Raycast not hitting terrain.

So I have a terrain with a terrain collider attached and is trigger is deactivated. When I place an object just above it and try to raycast downwards ( checked if ray is penetrating by drawing the ray) it won't register the hit. I am using 4.5.1f3 free version and have no options to try. Any suggestions ?

Comment
Add comment · Show 2
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 KMKxJOEY1 · Jun 30, 2014 at 07:21 PM 0
Share

your going to need to post more info buddy; why don't you post the code that isn't working right?

avatar image s.23 · Jun 30, 2014 at 08:08 PM 0
Share

Sure, the only code I have is:

     void movementUnit(){
         //Get point
         Ray  ray = Camera.main.ScreenPointToRay (Input.mousePosition);
         this.q = ray;
         RaycastHit[] hits = Physics.RaycastAll (ray.origin, ray.direction, 1000);
         Debug.Log (hits.Length + " " + ray.origin + " " + ray.direction);
         foreach  (RaycastHit hit in hits) {
                         Debug.Log(hit.transform.tag);
             if(hit.transform.tag == "Ground"){
                 processInput(this.transform.position,hit.point);
                     break;
             }
         }
     }
 
     void Update(){
         if(Input.Get$$anonymous$$ouseButtonUp(0) && dfInput$$anonymous$$anager.ControlUnder$$anonymous$$ouse == null){
             movementUnit();
         }
     }
 
     void FixedUpdate(){
 
         Debug.DrawLine(this.q.origin,this.q.direction*1000,Color.yellow);
     }


I am using Arong Granberg path finding and if I create a new empty box and place it under "ground" layer I can hit it with a raycast as well as other object in different layers. The only object I can not hit is the mesh I have for terrain. In addition if I create a new terrain and add same layer/tag specs to it I am able to hit it too. It is very weird to be hones. Anything else I can post that would help ?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by s.23 · Jul 01, 2014 at 08:30 AM

Figured it out, something to do with a processing script and the prefab it creates. It is still weird that you can have a terrain object that is not hittable with a raycast, thanks for help.

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 HarshadK · Jul 01, 2014 at 09:30 AM 0
Share

$$anonymous$$aybe you can replace your

something to do with a processing script and the prefab it creates

with the actual solution you used to solve your problem. It will help everyone referring to this question in future. :-)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

catapult game 1 Answer

Mesh collider and Terrain collider 0 Answers

Stopping 3rd Person Controller When It Hits Raised Terrtain 0 Answers

Aicraft Collision with Terrain not working 2 Answers

how to do user position validation on server without using UnityEngine.* 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