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 oliver-jones · Jan 16, 2011 at 12:22 AM · graphicsweaponsolid

Prevent Weapon From Going Into Surrounding Graphics

If any of you have played any of the Call Of Duties - you will notice that when you walk up to a wall (for example) - your weapon doesn't go into the wall, it remains completely visible. Where as my weapon in Unity, when I walk up to a wall or something else, my weapon goes into the graphics.

How do they prevent that from happening? Any ideas would be fantastic.

Thanks All!

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 Eric5h5 · Jan 16, 2011 at 01:10 AM 0
Share

Already asked and answered here: http://answers.unity3d.com/questions/10620/always-render-a-object-on-top-of-another

5 Replies

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

Answer by Pirating · Mar 02, 2013 at 06:49 PM

  1. Put your gun in new layer (eg. "Weapon").

  2. Duplicate your main camera.

  3. In it's Culling Mask, check "Nothing", and then check your weapon layer. (now the camera should show your weapon only).

  4. Set your modified camera's Depth to 1.

  5. Enjoy!

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
avatar image
1

Answer by Tyler Alvis · Jan 16, 2011 at 04:24 AM

Put a collider on your character that is big enough for your gun too, so it is one big collider including the player and the gun

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
avatar image
-1

Answer by Justin Warner · Jan 16, 2011 at 12:33 AM

Clearly you played to many crappy Call of Duty games, in CoD2, CoD1, and UO, they all go through the walls... The only decent one after this was MW1... All the other blow...

BESIDES THE POINT, you put a collider on the gun, I prefer capsule or cylinder like.

But that should work =).

Comment
Add comment · Show 8 · 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 · Jan 16, 2011 at 12:37 AM 0
Share

lol - this will just prevent the the weapon from hitting the wall at all - in COD, you can still face the wall - face to wall - and the weapon still appears complete.

So this wont work

avatar image oliver-jones · Jan 16, 2011 at 12:38 AM 0
Share

As if its a flat image ...?

avatar image oliver-jones · Jan 16, 2011 at 12:41 AM 0
Share

In first person - the weapon against a wall still shows complete okay? But in third person - you can clearly see the weapon going into the graphics (just so you get a better idea)

avatar image Justin Warner · Jan 16, 2011 at 01:21 AM 0
Share

Eh, when I did it FP, it worked fine, and has worked for others...You never really said TPS, and all the CoD's are First Person, so I guess that's your fault, but w/e.

avatar image PrimeDerektive · Jan 16, 2011 at 04:54 AM 0
Share

Did you really downvote his answer just because he didn't like CoD?

Show more comments
avatar image
0

Answer by Shealei · Jul 16, 2011 at 10:16 PM

Make the weapon a GUI. That should solve all your problems. Add appropriate animations for fire and reload by removing GUI and adding it back up. Although you can also add the weapon some collider.

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
avatar image
0

Answer by oystarr2g · Oct 03, 2012 at 09:48 PM

puttin a coliider on the gun DOESNT WORK! if it does for you please explain how , in detail. the layer/cam method works but i cannot use a zoom/aim function for my FPS cuz itl show two guns on the screen!. someone pls help isomet ime now ve been tryin to fix this for quite a while now

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

post shader: reconstruct worldspace plane coordinates 1 Answer

materials in editor look good but in run-time ineditor(android) they are pink 0 Answers

Weapon switching 4 Answers

Sword logic script not working 3 Answers

how do i make a weapon swing like a crowbar or a baseball bat 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