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 · Apr 18, 2018 at 04:01 AM · rotationrotaterotation axisrotatearoundpull

rotating objects around collider axis

so i have a collider and i use this script to make rigidbodies to get pulled to it and rotate around it for my tornado. but a problem im having is the tornado releasing objects it picks up. so i wanted to tilt the collider (capsol collider sideways to create a sidways rotation which would pick objects up then smash them into the ground forcing them away therefore releasing them. but the problem im having is taht when i rotate the collider it still rotates other objects the same. so i was wondering what to add to theis script so that if i attatch a collider it will roatate around the colliders y axis, so even if i tilt the collider it will rotate the way it rotates aswell. hopefull that makes sence. here is the script i attach to the collider.

 private GameObject PullOBJ;
 public float PullSpeed;
 public float objRotationSpeed;
 public float rotation;
 public float PullStrength;
 public void OnTriggerStay (Collider coll)
 {
     if (coll.gameObject.tag == "Untagged") {
         PullOBJ = coll.gameObject;

         PullOBJ.transform.position = Vector3.MoveTowards (PullOBJ.transform.position, this.transform.position, PullSpeed * Time.deltaTime);
         PullOBJ.transform.RotateAround (transform.position, Vector3.up, Time.deltaTime * rotation);
         PullOBJ.transform.Rotate (Vector3.left, 45 * Time.deltaTime * objRotationSpeed);
     }

 

 
 }
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 Priyanka-Rajwanshi · Apr 18, 2018 at 04:39 AM

@Jdogmaster The collider's y-axis is PullOBJ.transform.up and your tornado's y axis would be transform.up(Considering the script is on tornado)

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 Jdogmaster · Apr 18, 2018 at 05:05 AM 0
Share

Thanks man I’ll try it out tomarrow and let u know how it goes. Btw the visible tornado is just a rotating partical system with no scripts attached to it. I then have a few capsules extending from the center we with the varying strengths.

avatar image Priyanka-Rajwanshi Jdogmaster · Apr 18, 2018 at 06:12 AM 0
Share

Is the above script then attached to an empty gameobject? transform.up would give the up vector respective to the gameobject on which the script is attached to.

avatar image Jdogmaster Priyanka-Rajwanshi · Apr 24, 2018 at 11:25 PM 0
Share

no actually the above script is attached to each of the colliders extending from the particle system. so each collider has a different pull force to attract objects

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

110 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

Related Questions

Snap the rotation of object 2 Answers

Rotating an object in a specific direction to a specific point 0 Answers

How do I rotate an object around another to have its opposite ? 0 Answers

Flying player Rotates in the left and right direction not forward and back 1 Answer

rotate object around another object 1:1 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