• 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
Question by RumplyThrower · Jun 27, 2013 at 06:06 PM · raycastfpsgamecolliderswithout

Raycast without collider

Is there a way for my raycast to know when it hit an object without a collider? I am makin an FPS game and my capsule collider is not really modeled to my mesh and if i checked wether that collider is hit it would be really dumb because i could kill the player without even pointing at any of his body parts. Thx.

Comment

People who like this

0 Show 0
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

Answer by iwaldrop · Jun 27, 2013 at 06:11 PM

If you want collision detection on your mesh you have to use a mesh collider. This is not really advised, however, because of how computationally expensive it is to recompute the collider each frame. If you're targeting PCs then you might be able to get away with it for a few objects, but too many will cause a noticeable dip in frame rate. Mesh colliders, if used at all, are best used on static geometry that won't change or move (I.e. a chair, not a player character).

There really isn't anything wrong with using a capsule either. Its not really dumb, and a lot of games work this way in order to save computation time for other things that were deemed more important in the development cycle. Everything is a trade off, however, and if your game revolves around 'per-pixel hit detection' then that's where you spend your resources.

Comment
Linus

People who like this

1 Show 5 · 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 RumplyThrower · Jun 29, 2013 at 11:26 PM 0
Share

well the thing is i'm using stickmen, and if use a capsule collider i can shoot him without ...shooting him...if you get my drift...is there a workaround :S ?

avatar image iwaldrop · Jun 29, 2013 at 11:29 PM 0
Share

Well, if by stickmen you mean a tall cube, you can decrease the radius of the capsule or use a box collider. Keep in mind that capsules are cheaper than boxes.

avatar image RumplyThrower · Jun 29, 2013 at 11:42 PM 0
Share

no, i mean actual stickmen, with arms, legs and a head (http://stickmanplayer.com/wp-content/uploads/2013/03/Stick_Man.jpg something like that)

avatar image iwaldrop · Jun 29, 2013 at 11:58 PM 0
Share

Oic. That would have been a good detail to include in the original question. Nonetheless, it seems that if you can't accept general collision detection then you're going to have to go with a mesh collider. Personally, I'd still use a capsule collider.

avatar image sonolil · Jan 18, 2016 at 05:02 PM 1
Share

I suggest using multiple colliders then. If it's a stickman than a sphere for a head, capsule for body, etc.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 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

Related Questions

How get the texture name from Raycast? 1 Answer

Using raycast gun to take down life of enemy when shot 1 Answer

How can I make a gun shoot raycast by rounds per minute(RPM)? Making a FPS controller and need help! 0 Answers

How to implement gun accuracy/spread with raycast 1 Answer

aiming error 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