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 /
This question was closed Apr 30, 2013 at 09:19 AM by Fattie for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by BLOODLORD · Apr 30, 2013 at 08:00 AM · gameobjectphysicsraycastcollider

Melee-like function?

Hi! I'm making an Island survival game. I want the character to punch trees, how do I do that? (no, I'm not making minecraft) Anybody with a snippet of useful code is deeply appreciated!

Comment
Add comment · Show 5
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 Fattie · Apr 30, 2013 at 09:19 AM 0
Share

give your character a punch animation. when user presses P make the animation run. search for 10000s article on this here

avatar image BLOODLORD · Apr 30, 2013 at 10:18 AM 0
Share

yea, but i want it to be in a limited range, so when the character is close to the tree so it triggers damage. but I don't know how to add limited attack range function. also I would like to know how to change animation on player positon, like when the player is near a tree, he punches and the fist comes to a dead stop, else, swing and a miss.

avatar image BLOODLORD · Apr 30, 2013 at 10:38 AM 0
Share

example? im fairly new to unity

avatar image BLOODLORD · Apr 30, 2013 at 10:50 AM 0
Share

Thanks, I havent thought of that...

Thanks for the tip. I will be back with even more questions. beware.

avatar image fafase · Apr 30, 2013 at 11:49 AM 0
Share

At the end of this article http://unitygems.com/basic-ai-character/#Sight you have a way to create a melee attack based on animation event.

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by Fornoreason1000 · Apr 30, 2013 at 10:24 AM

use ray casting and distances.

you could also use collision, when collision is detected stop the animation in its tracks. Anination class will have something that will do the trick but as fattie said there are hundred of these questions. finding the question and using information people already answered will save you a lot of time waiting here

make sure you research into them first, and make sure they aren't already answered, also why are you posting this as answer. the Devs on here tend to get annoyed with things like this.

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

Follow this Question

Answers Answers and Comments

16 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

Related Questions

Multiple Cars not working 1 Answer

Detecting other Objects when placing Object 1 Answer

What is the best way of breaking boxes 1 Answer

Raycast hits when missing a collider, misses when hitting a collider? 0 Answers

how to move an object clone to mouse position, i dont understand ? 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