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 bhambhu · May 18, 2013 at 10:03 AM · raycastspherecastphysics.spherecast

Problem in spherecast .

Hello Guys , I used spherecast and it was working fine . But, suddenly , i found out that it gives null RaycastHit if am in collision with object or near to it .

Physics.SphereCast( transform.position + char_Controller.center, char_Controller.height / 2, Vector3.forward, hit, 1);

Does it mean that object is in between object and spherecast , and in this situation sphercast did not collide with object????

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 bhambhu · May 18, 2013 at 10:48 AM 0
Share

http://www.theantranch.com/Unity/Entries/2011/3/29_Understanding_Spherecasts_in_Unity.html

I got some info from the above site . Through above link , i think that if SphereCast overlap another collider or another collider is in the SphereCast then SphereCast returns False. But , I like to know if this is true .

avatar image Benproductions1 · May 20, 2013 at 01:18 AM 0
Share

um... Spherecast doesn't have a RaycastHit out. It has a RaycastHit[] out

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by sparkzbarca · May 20, 2013 at 01:52 AM

its giving a null because it didn't collide with it because it's inside it.

You shouldn't use controller height you should use the radius of the controller collider.

basically assuming a normal human yfor the character you ahve a 6 foot (2 meter human)

its height / 2 is 1 meter.

however its width is far less than that, i'm alot thinner than my height (a radius is from center to edge, its only half the diamter, this is a circle that is 6 feet from one side to the other, a huge sphere for a collision check your doing no doubt)

so something touching my nose/belly/foot is closer than 3 feet from the center of my body.

basically you need to make your radius equal to the radius of the collider attached to your character controller which if we do some basic math.

a 40 inch waist should not have a 1 meter radius but a .1524 meter radius

set your radius to .1 (thats point 1 by the way not just 1) and try it. Then set it to the radius of the actual character controller at some point. :P

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

15 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

Related Questions

SphereCast help 1 Answer

SphereCast doesn't work with a layerMask 1 Answer

Why do I get a triangleIndex of -1 when I SphereCast a convex MeshCollider? 1 Answer

A question about procedural ledge grabbing. 0 Answers

RaycastHit.normal - what does it really return? 4 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