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 david 4 · Apr 13, 2011 at 12:36 PM · killcontactfunhealth

Death on Lava collision

Translation: I'm not a really good programmer and I'm trying to make my character 'die' when he falls on lava. How would I go forth doing this?

Original Message:

i am making a game where if the character touches the lava he dies...now i am horrible...HORRIBLE with scripting for right now so i really need help with how to do this...PLEASE HELP!!!

Comment
Add comment · Show 7
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 Jessy · Apr 13, 2011 at 12:50 PM 3
Share

Batman, I think you're just too old for it, buddy.

avatar image david 4 · Apr 13, 2011 at 01:11 PM 0
Share

[Flame Post]

avatar image Proclyon · Apr 13, 2011 at 01:13 PM 1
Share

Geez, when I read that title I thought someone was gonna get killed!!!!!!!!!!!!!!!!!!!!!!

avatar image david 4 · Apr 13, 2011 at 01:15 PM 0
Share

smh......^^^^^^

avatar image Jessy · Apr 13, 2011 at 01:43 PM 1
Share

What I'm saying is, I remember when you were really good at using your batputer. It's time to move on to cursing the kids on the Wayne $$anonymous$$anor lawn, old-timer.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by robertmathew · Apr 13, 2011 at 12:42 PM

// A grenade // - instantiates a explosion prefab when hitting a surface // - then destroys itself

var explosionPrefab : Transform;

function OnCollisionEnter(collision : Collision) { // Rotate the object so that the y-axis faces along the normal of the surface var contact : ContactPoint = collision.contacts[0]; var rot : Quaternion = Quaternion.FromToRotation(Vector3.up, contact.normal); var pos : Vector3 = contact.point; Instantiate(explosionPrefab, pos, rot); // Destroy the projectile Destroy (gameObject); }

http://unity3d.com/support/documentation/ScriptReference/Collider.OnCollisionEnter.html

http://unity3d.com/support/documentation/ScriptReference/Object.Destroy.html

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 Simon V · May 24, 2011 at 03:27 PM

If you have the code in place for your character dieing, you only got to call that function.

So basically you would create something like:

 private void CheckDeath(int Hp)     
  {
  
  if (hp = 0)    
  { 
     -execute wathever code you have for dieing, could be a message, together with a red overlay on the screen. And code to revive-    
  }
  }

And then for the touching itself, you would need a collider, but I haven't worked with those yet. (The basics should be in the link Robert posted.)

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

1 Person is following this question.

avatar image

Related Questions

How to create an NPC enemy which can take damage and be killed when its energy or health reaches zero? 2 Answers

Health, Death and respawn help 3 Answers

unity 3d enemy that shoots at you and gets killed 5 Answers

How to Make a "Kill Platform"? 1 Answer

PlayerHealth drops fast and wont reset 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