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
2
Question by oliver-jones · Dec 16, 2010 at 02:14 AM · raycastradiuscapsule

General Way To 'Widen' A Ray Cast?

Hello,

Is there a way to 'widen' a ray cast so its more liable to hit something. The Unity FPS tutorial on the weapons uses ray casting, but the ray cast is too accurate and pinpointed. So is it possible to widen the diameter or something around that area?

Reason I ask is because I have a turret that has a Slurp rotation, so when it tracks the enemy, it rotates with it slightly slower, or 'lagged'. And because it fires ray casts it tends to miss the target if the target turns in a slightly awkward way.

Thanks

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
10
Best Answer

Answer by Peter G · Dec 16, 2010 at 02:25 AM

Use a capsule cast. :)

Comment
Add comment · Show 7 · 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 oliver-jones · Dec 16, 2010 at 02:24 PM 0
Share

Oh right okay, I only thought there was one type of ray cast, which was a line - Thanks Peter

avatar image _Petroz · Dec 16, 2010 at 08:25 PM 0
Share

Awesome, I didn't know about that!

avatar image oliver-jones · Dec 16, 2010 at 10:39 PM 0
Share

How can I view the capsule cast in the editor to debug? Thanks

avatar image Peter G · Dec 16, 2010 at 11:43 PM 0
Share

It's complicated since it doesn't really fit any standard gizmo. Personally, I would draw a sphere at the top and bottom points with the radius of the capsule, draw a line going the distance (unless it is infinity or your intention is to go beyond the boundaries of the scene. Then draw a ray). Then I would draw the sphere's again every 10 units or so. The problem is that requires quite a few draw calls, so it would be a performance killer. So 1, don't do it while optimizing, 2. Don't draw the increments closer than you have to.

avatar image Peter G · Dec 16, 2010 at 11:46 PM 0
Share

Or just draw an icon. You won't get to see the volume as well, but it would be cheaper to render in the editor. Or, you could create a capsule that is "EditorOnly" and make it mostly transparent, then stretch it. Stretching it would be as simple as iterating through the verts and finding all of them that have a positive z value, then moving the z units forward.

Show more comments

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

Identifying Objects around me 3 Answers

Physics.CapsuleCast Help 1 Answer

Detect gameobjects via radius [PROBLEM] 1 Answer

How to make this script find distance inside radius? 1 Answer

Drawing capsule gizmos and keeping it with the object scale 2 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