Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Jdogmaster · Oct 10, 2018 at 11:25 PM · rotationvector3forcerotate objectforces

Tornado Simulator

Hey, so im trying to recreate the tornado in this video https://www.youtube.com/watch?v=IlhdLQ5NU5E In the comments they guy who made the video said that he uses 4 forces - Force 1 suction force that makes objects move towards the tornado - Force 2 rotational force to make stuff spin around the tornado - Force 3 lift force to move objects up - Force 4 centrifugal force to make objects move away from the tornado

In my script i have applied all of these forces. my tornado does work and sucks up objects but the problem im having is that, i have to have a strong inward force, and a low rotational force to keep my objects in a stable rotation for a few seconds. but when i have a strong inward force, it takes about 2 seconds for the objects to actually start rotating around the tornado and i dont get the wraping effect like in the tornado in the video. I need to figure out how to have higher rotation with lower inward force. the reason for this is so that objects will imidetly start rotating around the tornado without getting sucked in first. but my current issue with that right now is that, if i have a low inward force, and higher rotational force, objects will immidietly exit the tornadoes collider before they can rotate very much. so i need to figure out how to stabalize this so i get that nice wrapping effect like in the video.

 const float G = 667.4f;

 public float TornadoPower;
 public float TornadoRotation;
 public float MaxForce = 100;
 public float MinForce = -50;
 public float upforce;
 float forceMagnitude;
 Vector3 vector;
 public Rigidbody rb;
 GameOBJ thisOBj;


 void OnTriggerStay(Collider other)
 {
     if (other.GetComponent<GameOBJ>())
     {
         Attract(other.GetComponent<GameOBJ>());
     }
 }
 void Attract(GameOBJ objToAttract)
 {
     Rigidbody rbToAttract = objToAttract.GetComponent<Rigidbody>();
     GameOBJ Attractforce = objToAttract.GetComponent<GameOBJ>();
     Vector3 direction = rb.position - rbToAttract.position;
     float distance = direction.magnitude;
     float signedAngle = Vector3.SignedAngle(direction.normalized, Vector3.forward, Vector3.up);
     Quaternion rotatedAngle = Quaternion.AngleAxis(270 - signedAngle, Vector3.up);
     Vector3 newDirection = rotatedAngle * Vector3.forward;
     forceMagnitude = G * (TornadoPower * rbToAttract.mass * Attractforce.weight) / Mathf.Pow(distance, 2);

     {
         if (forceMagnitude >= MaxForce)
         {
             forceMagnitude = (MaxForce * 2) - forceMagnitude;
             if (forceMagnitude <= MinForce)
              {
                 forceMagnitude = MinForce;
              }
         }

         Vector3 force = direction.normalized * forceMagnitude;
         float upwardforce = G * (upforce * rbToAttract.mass * Attractforce.weight) / Mathf.Pow(distance, 2);
         rbToAttract.AddForce(Vector3.up * upwardforce);
         rbToAttract.AddForce(newDirection * TornadoRotation);

         rbToAttract.AddForce(force);
     }
 }

}

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

0 Replies

· Add your reply
  • Sort: 

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

139 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 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 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 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 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 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 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

Rotate an object based on vectors. 1 Answer

add force at position with respect to rotation 1 Answer

I need Some Info About Rotation And Pvot 0 Answers

Rotational Force 0 Answers

How to rotate a ship based on gravity around a planet? 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