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
1
Question by BadSeedProductions · Apr 06, 2015 at 03:02 AM · addexplosionforce

addExplosionForce radius and force have no effect

  public float theForce;
  public float theRadius;

...

  theGameObject.AddComponent<Rigidbody>().AddExplosionForce(theForce, transform.position, theRadius);

  return theGameObject;

...

theForce and theRadius are public floats. No matter what I adjust them to the explosion is too powerful. I tried using negative values to see if it would implode, still the same high velocity explosion. I've even tried very small numbers such as .0000000000001, and no difference. Anyone know if there is some bug here or am I doing something wrong?

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 W.Walter · Apr 06, 2015 at 04:53 AM 0
Share

What is the mass of the Rigidbody on theGameObject?

avatar image BadSeedProductions · Apr 06, 2015 at 05:32 AM 0
Share

I just tried adding mass of .00001 all the way to 10 and in between, didn't seem to have an effect.

 theGameObject.GetComponent<Rigidbody> ().mass = 10f;

2 Replies

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

Answer by W.Walter · Apr 06, 2015 at 05:37 AM

You are applying the explosion at the objects center, which will make it have extreme/unpredictable responses. Move the explosion force to a better position. Your are doing the equivalent of an atomic bomb inside your game object, not beside it. Hope this helps :)

Comment
Add comment · Show 3 · 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 BadSeedProductions · Apr 06, 2015 at 05:47 AM 0
Share

sound theory, will try and report back

edit: Strange, no matter where I move the force, same reaction. I'm stumped.

avatar image W.Walter · Apr 06, 2015 at 05:53 AM 0
Share

Rigidbody.AddExplosion force is designed to be used to add forces to surrounding objects (with linear falloff based on radius and force), after say a bomb explodes. If you're trying to add force to the rigidbody, (to explode it upwards or something) then you should use Rigidbody.AddForce. You can also tell it to use an 'explosion type' force. Rigidbody.AddForce will apply a force to the rigidbody in a specified direction, rather than calculating it based on the center of the explosion (as in Rigid.'AddExplosionForce'). Hope this explains things a bit :)

avatar image BadSeedProductions · Apr 06, 2015 at 09:36 PM 0
Share

Okay, I removed the addExplosionForce, and just added the rigidbody, and I am still getting an 'explosion', possibly from intersecting? Very strange, but the problem must reside deeper in the code. Thanks for the info WW!Giving you the answer since you helped me narrow down the possibilities!

avatar image
0

Answer by PsychoDuckArcade · Apr 06, 2015 at 10:07 PM

I've successfully used explosion force recently in a similar way. Yeah one problem I see that's already been mentioned is the explosion position; it won't have proper results in the center.

I also used explosionforce from a component on the gameObject being exploded, it worked fine.

I noticed however that the amount of force needs to be fairly high relative to the mass. For objects 1-10 in mass, I had to use force in the thousands (1000-10,000 should launch the object quite a bit).

Another thing to consider is the object's scale. Since force causes acceleration which is distance over time, a very large object covers a lot of distance so movement won't be as noticable without adjusting speed/forces accordingly. My objects with the settings I mentioned above (1-10 mass, 1000-10,000 explosion force) are sized 1-5 unity units. Remember 1 unity unit resembles 1 meter for the physics engine (anything to do with velocity, which is meters/unity units per second).

Lastly drag and friction are important factors as well, as they slow down movement, decrease accelerations, and increase decelerations.

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

21 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

collision.rigidbody.AddExplosionForce(); 1 Answer

Is there any alternative to adding an explosion force for 2D since it's not available. If not, does anyone know how to make it to where objects with a tag in a radius will be destroyed? 1 Answer

Alternatives to AddExplosiveForce 1 Answer

How can I stop moving my player by AddExplosionForce after a while? 1 Answer

AddExplosionForce only goes up 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