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
1
Question by appels · Jul 25, 2010 at 09:14 PM · physicsplayerremote

SphereCast to detect remote player

Hi, I'm using Physics.SphereCast to detect remote players but they don't get detected all the time. Physics.SphereCast(transform.position, 20, transform.forward, hit, 1); Sometimes when a player come close it doesn't detect it. Is this normal ? Thanks.

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 andrew · Jul 26, 2010 at 08:20 AM 0
Share
  • for bringing my attention to the existence of Physics.SphereCast

1 Reply

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

Answer by Magnus Wolffelt · Jul 25, 2010 at 10:50 PM

First of all, to resolve any confusion, Physics.SphereCast is part of the new Unity 3.0 scripting API.

  1. Are you using proper layers to distinguish between the own player and other player objects, and other colliders? Have you tried Physics.SphereCastAll()?

  2. Also, what strikes me as odd is that you spherecast with a 20 unit radius (40 unit diameter) sphere only 1 unit in front of the player. Possibly this extreme usage could uncover a bug in the implementation? Have you tried if something more sane (like radius 10, 20 units away) gives the same flaky behaviour? Otherwise, you can try using Physics.OverlapSphere instead, which is very similar to what you are currently doing.

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 appels · Jul 26, 2010 at 02:43 AM 0
Share

Thanks, the radius was indeed the problem. I should read the docs better:(

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

No one has followed this question yet.

Related Questions

Enemy Projectile not flying in the right direction (needs to fly toward player),How to make enemy projectile fly toward player? 2 Answers

Collisions causing Rigidbody to go Haywire and move randomly. 1 Answer

Issues Making Character Move With Rigidbody 1 Answer

How can I make my character collide with physics objects? 2 Answers

How would I make it so an animation will play, but stop when it hits a collider? 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