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 Deathwolf07 · Jul 21, 2014 at 11:28 AM · rigidbody.addforcetargetingghost

How to make Poltergeist like behavior in unity?

I am making a horror game about ghosts like poltergeists and I cannot figure out how to make objects through themselves at the player, shatter, doors swing open and closed and earthquake like phenomenon. There is always the add force to rigid body script but how would I change that to work like I have said? I am mainly using java script for my project but any would help alot.

-Edit- I already have a script that can make a rigid body to fly up and or effect near by rigid body's but I cannot figre out how to make it throw itself towards or at the player.

var radius = 5.0; var power = 10.0; function Start () { // Applies an explosion force to all nearby rigidbodies var explosionPos : Vector3 = transform.position; var colliders : Collider[] = Physics.OverlapSphere (explosionPos, radius);

 for (var hit : Collider in colliders) {
     if (hit && hit.rigidbody)
         hit.rigidbody.AddExplosionForce(power, explosionPos, radius, 3.0);
 }

}

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Tehnique · Jul 21, 2014 at 11:44 AM

Please write separate/more detailed questions. Such general-scope questions as yours are better suited for the forums. Anyway, I'll give you a few general ideas.

  • Throw objects: AddForce with direction as Vector3 from object to camera.

  • Shatter: No built-in function, but you can animate a shatter state for your objects. Here are some other ideas: Tutorial , Asset.

  • Door Swing: HingeJoint, use the motor property to open/close/slam/whatever.

  • Earthquake Effect: Tutorial, Info.

Comment
Add comment · Show 5 · 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 Deathwolf07 · Jul 21, 2014 at 11:52 AM 0
Share

there edited it a little if that helps in any way.

avatar image Tehnique · Jul 21, 2014 at 12:00 PM 1
Share

If you want to use "AddExplosiveForce", you have to calculate exactly where to place the explosion in order to get the object to "throw itself" at the player. However, this is a VERY bad approach for what you want to do, AddForce is the normal approach.

avatar image Deathwolf07 · Jul 24, 2014 at 12:04 PM 0
Share

ah I see, thank you for explaining that. I do not know how to make it add force to the object to send it towards the player though because I am abit new to JavaScript. Is it possible I could have another example link or something to work off more?

avatar image HarshadK · Jul 24, 2014 at 12:10 PM 1
Share

The best link of all: Unity Tutorials

avatar image Tehnique · Jul 24, 2014 at 02:20 PM 0
Share

Yeah, take a look at this.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Triangle formed is still shown 2 Answers

Changing a bool when an int reaches a specific number... 1 Answer

how to use Unity3.1 in Xcode 1 Answer

Variable not changing when you get a reference from another script 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