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 portrius · Jun 07, 2012 at 05:41 PM · gunwallnotthroughlayering

Gun through wall. [please read I don't want layering]

Hi all,

I have a question concerning the fact that my gun goes through the wall. I already tried to do anything to make the gun collide the walls and boxes but it won't do the right physics to stop it from getting through. I would like a total description of how to do this. No layering, Because I want to make a multiplayer fps not a singleplayer one and I don't want it to look like crap which it would with the layering way of doing it.

Thanks, portrius

Comment
Add comment · Show 4
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 TehWut · Jun 07, 2012 at 06:09 PM 6
Share

You have to do layering, it's really not messy or "crappy".

I don't understand what layering has to do with multiplayer. Usually the player is it's own instance in it's own FPS view, and the other players see a 3rd person version of you, so they won't see your gun "layering" on top of the other objects. This is how BF3, CoD, and CS does it. Layering is clean and effective ;)

You could add a box collider to your gun, but like you said, this causes issues with the player physics and that is what you might call "crappy"

if you haven't already looked: http://answers.unity3d.com/questions/41298/fps-gun-clippes-through-walls.html

plus, layering is how those AAA games do objective markers, HUD, e.t.c e.t.c

avatar image fafase · Jun 07, 2012 at 06:11 PM 0
Share

You would have to give some more info on your gun. Is it made of box colliders or mesh collider?If mesh collider is convex on?

avatar image portrius · Jun 07, 2012 at 06:17 PM 0
Share

Well, I think it was crappy because when they see a 3rd person view of you they see you with a gun through a wall and that is not realistic to see... And the mesh collider convex didn't work...

avatar image jschipilow · Jun 07, 2012 at 08:49 PM 0
Share

Layering is common practice. If you don't want to use layering, use colliders ins$$anonymous$$d, might have to scale up the size though. There's no true way of getting perfect collision in games, I'm sure you've noticed that most games aren't realistic and almost always adopt the mentioned methods. If you find a way that works better please let us know.

1 Reply

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

Answer by dood_legacy · Jun 10, 2012 at 05:08 AM

Many older games render the weapon in screen space and render it last (on top of all world geometry.) But newer games like BF3, where the player interacts with the world in first person render the weapon in world space, and use some animation overlay to push the gun back.

Just do a raycast along the player's facing direction to get a value back between 0 and 1, and use that to drive the playback of the overlay animation, so as you get closer to walls or objects, the gun's position will move back and not clip through walls.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do you stop you gun majicaly sinking into walls? 1 Answer

Gun not to make it go through the objects 1 Answer

Sphere through wall - Mini-Golf 5 Answers

Camera looking through objects when touching 1 Answer

Gun reload not working? 1 Answer


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