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 Karsnen_2 · Jul 04, 2012 at 02:53 PM · rotationvector3gravityangle

Applying force with respect to angle with the ground?

Hello,

I have a cube which is falling freely towards the ground. The cube right now has random rotation across X & Z axis (as it falls) and it does not have any rotations with Y axis. The cube is falling towards Y axis. Now in layman terms, if the cube is slanting, I would like to apply force in order to make the cube fall faster. Hence I thought I could just take the angle and apply relative force towards the direction it is turned.

Is that a good idea? If so could you guys help me with the logic and some pseudocode?

Thank you,

regards,

Karsnen.

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 AlucardJay · Jul 04, 2012 at 03:10 PM 0
Share

puzzling, but interesting. How about : Raycast down, get the ray's hit normal, use that to modify the force being applied.

or if you want it to fall faster but in the same direction as gravity, just apply force straight down.

cannot figure out slanting if the cube is in constant rotation, or do you mean like the cube faces are affected by wind? puzzling ....

Edit : sry, I did take free-falling to include constant rotation. Am still a little lost on apply a little force when it is slanting too much . If you want it to fall faster depending on surface friction and wind resistance, it is still falling as per gravity, so apply force straight down. Or do you want to apply the force in the direction that a certain face or vertex is facing (to correct the angle of slant, or push in a certain direction based on face/vert)?

avatar image Karsnen_2 · Jul 04, 2012 at 03:28 PM 0
Share

The cube is not in a constant rotation. The cube has it's own rotation but never a 360 across X or Z. I would like to say that it has a positive sinusoidal wave. Hence I would like to apply a little force when it is slanting too much. With raycast down, I hope you could do that but times when the cube gets perpendicular to the ground is very $$anonymous$$imal. It will never get really perpendicular.

I hope I am clear with what I have said.

1 Reply

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

Answer by Solus · Jul 04, 2012 at 06:10 PM

I'm not 100% sure what you're asking but this puts me in the mind of an asteroid entering orbit. Certain rotations of the asteroid may have less air resistance and fall faster and whatnot. If I understand you correctly you are looking for something like this:

if(BoxIsRotated) { Make Box Fall Faster; }

If that is the case you might be looking for something like this:

gameObject.rigidbody.AddForce(new Vector3(0, -1, 0) , ForceMode.Acceleration);

You would need a rigidbody on your cube and would probably need to adjust the Vector3 for your game scale and needs. You could also play around with different ForceModes.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Having Trouble with Vector3.Angle 1 Answer

How do I find the angle between the players forward vector and the mouse position? 1 Answer

Get Direction from 2 Vectors - and Apply to Transform 0 Answers

Problem with Z rotation when rotating X and Y and the same time. 2 Answers

Trouble with Vector3.Angle() and RotateAround() 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