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 ryno9788 · Jun 23, 2012 at 03:18 AM · collisiondamagehealth

Health system final

Okay I've decided I'm restarting on my health system. I want it to work the same but built where it will actually work for my game. I need more advice on how to build it. The last health system shattered to pieces but the simple idea still stands. If you haven't seen the old health system their no need to go back I will describe it again.

THE IDEA

  • Okay the idea start with a health variable, starting you out with 100 health. If health equals less than 0 then you are dead.

  • If you are hit by a gameObject (also rigidbody) with the tag Arrow. then subtract 10 points from your health.

  • If you are dead (player) transform to (0,0,0).

  • If enemy is dead (AI) destroy gameObject.

I have no idea what went wrong with the last one so don't even look at it. For the player I have a Character controller. For the AI I have a Rigidbody (for now)

I really need this script, I'm at the point where I really need it.

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 Berenger · Jun 23, 2012 at 03:38 AM 0
Share

Can't write for you. You've got the steps right, so take a piece of paper and start throwing idea, making plans. IF you stumble upon a specific issue, come back here.

The forum would be more appropriate for that kind of discussion, btw.

avatar image ryno9788 · Jun 23, 2012 at 03:50 AM 0
Share

So my basic form IS right and I know you can't write it for me but their is on thing you can probably do for me, how can I do collision with this idea It's my number one problem and from the the looks of the numbers on the side a lot of people are having trouble with collision. I've looked at the Unity script References but I cannot find one that works. I have a cube collider for my projectile and it is not a trigger although I'm not sure if that matters.

1 Reply

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

Answer by Berenger · Jun 23, 2012 at 04:30 AM

Basically, to have a collision message sent, you need a collider to interact with an other collider because of a physic impulse. Most of the time, it will be a force applied on a rigidbody that makes on collider enter another.

Then, you need a script attached to one of the collider that implement the function OnCollisionXXX or OnTriggerXXX. In your case, you have to decide if the arrow get the message then apply damage on the character OR if the character get the message and receive the damage. No big differences here, just need to be clear for you.

If at least one of the two collider is a trigger, the message sent will only be OnTriggerXXX. To understand what messages are sent, check this example.

Note that collision can be a problem when an object travel too fast (typically a bullet). An arrow should be ok though.

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 ryno9788 · Jun 23, 2012 at 05:56 AM 0
Share

thanks this will help me a lot

avatar image ryno9788 · Jun 23, 2012 at 06:34 PM 0
Share

yes I finely got a system going I modified a script from the fps tutorial for my AI and it works.

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

weapon collision with characters 1 Answer

Player take damage on collision with AI 1 Answer

Character controller mess up damage 3 Answers

Take health from enemy 3 Answers

Object reference not set to an instance of an object 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