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 Mr.MMORPG · Jan 16, 2013 at 08:35 PM · c#collidermeleecombat

Melee Combat

Well I'm kinda new to Unity and i am trying to make a Melee combat system... I'm completely lost through. I know i could make a reeeeaaaly simple melee combat system (get in range, press a button), but i would like something more... sophisticated. I mean, it would be awesome if the opponent would only take damage when the sword (or whatever) actually touched the opponent's collider. Well, i hope you guys can help me!

P.S. Please don't just link me to the documentation or give a really vauge answer... Also, i prefer C# over Java, because I can understand C#, and I don't understand java.... at al....

Comment
Add comment · Show 2
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 CantSleep · Jan 16, 2013 at 08:54 PM 0
Share

To do what you described wouldn't you just place a collider on the sword (or whatever weapon) and then check to see what it hits when the user attacks? I$$anonymous$$ Sword hits enemy torso collider -> do damage, sword hits shield collider -> do no damage.

Sorry if I'm misinterpreting the question.

avatar image Yokimato · Mar 29, 2013 at 12:21 PM 3
Share

"P.S. Please don't just link me to the documentation or give a really vauge answer... Also, i prefer C# over Java...." --

This just tells me your lazy. You're asking people to develop this, in your words, sophisticated, system. Give me a break, beggars can't be choosers.

1 Reply

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

Answer by doublethink · Jan 16, 2013 at 08:52 PM

What you are asking for is an extremely complex system even with just the basics. Your best bet is to make a system based on a box collider(the sword) and rigging the players(rigidbodies) with box colliders(think hitboxes) that can report to the parent player object where the player was hit from and what it was hit by. To make it look realistic you could apply force using Rigidbody.AddForce to the player that was just hit.

I know you requested "Please don't just link me to the documentation". Instead, I will give you MANY links to documentation. It sucks but you will need to read much more than just these pesky documentation pages to get anywhere in Unity game development.

http://docs.unity3d.com/Documentation/Components/class-BoxCollider.html

http://docs.unity3d.com/Documentation/ScriptReference/Collider.OnCollisionEnter.html

http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.html

http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.AddForce.html

Comment
Add comment · Show 2 · 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 Mr.MMORPG · Jun 23, 2013 at 07:37 PM 0
Share

I'm almost done making the damn thing. $$anonymous$$an, that was a LOT of work.

Oh, and I still have to thank you for your answer. Well, ehh, Thanks.

avatar image gonzosmemoirs · Oct 02, 2014 at 06:26 PM 1
Share

Think about making a tutorial for us then? :-) Exactly what you were looking for in the first place?

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

12 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

Related Questions

Melee attack comblat 1 Answer

Multiple Cars not working 1 Answer

How can i detect collision in melee combat? 2 Answers

Sword Combat System: Detect if player in range 2 Answers

Multiple Melee Weapons 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