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
-3
Question by Nazukan 1 · Jun 25, 2010 at 07:38 PM · aidamagerocket

My rockets don't do damage?

When I shoot my rockets at an Ai the dont do any damage, how do I change that? I used the standard script from the FPS Turtorial, I had to make a madofication to it so that my rocket would shoot farther, I deleted the second part of the script,that started with FunctionUpdate. Did I delete the part needed to deal damage? This is what my script looks like:

// The reference to the explosion prefab var explosion : GameObject; var timeOut = 8.0;

function OnCollisionEnter (collision : Collision) { // Instantiate explosion at the impact point and rotate the explosion // so that the y-axis faces along the surface normal var contact : ContactPoint = collision.contacts[0]; var rotation = Quaternion.FromToRotation(Vector3.up, contact.normal); Instantiate (explosion, contact.point, rotation);

// And kill our selves
Kill ();    

}

function Kill () { // Stop emitting particles in any children var emitter : ParticleEmitter= GetComponentInChildren(ParticleEmitter); if (emitter) emitter.emit = false;

// Detach children - We do this to detach the trail rendererer which should be set up to auto destruct transform.DetachChildren();

// Destroy the projectile Destroy(gameObject);

}

@script RequireComponent (Rigidbody)

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 qJake · Jun 25, 2010 at 07:42 PM 1
Share

This is a great example of a bad question, that provides little to no detail about the problem.

avatar image Nazukan 1 · Jun 25, 2010 at 08:46 PM 0
Share

When I shoot my rocketlaunchers projectile it hits the enemies, but no damage is given. I want the rocket to be a One-Hit, but it has no damage giving properities.

avatar image Ricardo · Jun 25, 2010 at 09:23 PM 0
Share

What's the problem? Have you written some code for this and it's not working, or are you at a loss as to how to proceed? And please update your answer with details, ins$$anonymous$$d of commenting.

avatar image Nazukan 1 · Jun 25, 2010 at 10:31 PM 0
Share

Ok I added more details.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Clave · Jun 25, 2010 at 10:57 PM

you have to add this script on the prefab "explosion" your instantiating in this line of yours

 Instantiate (explosion, contact.point, rotation);

then you just have to tweak some parts like add the ability of your AI to receive damage, the proper Collider tags so when the explosion happens, it knows who receives damage.

Comment
Add comment · Show 1 · 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 Nazukan 1 · Jun 26, 2010 at 12:26 AM 0
Share

Thank you it works now.

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

No one has followed this question yet.

Related Questions

Ai Aint Taking Damage From Bullet (FPS Rocket) 1 Answer

AI Damage if touched 1 Answer

FPS Tutorial AI Damage not Working 1 Answer

Setting up smart damage taking in game... 2 Answers

The enemy don´t lose health, but why??? 0 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