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 RGI · Mar 26, 2014 at 05:51 PM · rigidbodytransformrotateaddforceaddrelativeforce

Rigid body rotation question

Hi, iam working on this game where you sort of fly a rc plane and i have this problem with rotation.. When i try to turn the plane around, it continues flying in the direction it was flying before instead of a new direction achieved through rotating. Iam moving the plane using

var plane : rigidbody;

var planetran : Transform;

plane.AddRelativeForce(planetran.forward* (speed - plane.velocity.magnitude));

and Iam rotating the plane with

 transform.eulerAngles.y += rotat;
 //where "rotat" is incriesed or decreased based on which direction i want to turn

Ive tried both addforce and add relative force but it seems to have the same effect. The plane does turn a little bit but the moment I turn a little bit more than just about 5% it ends up flying sideways and also accelerating to enormous speeds..

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 Ed unity · Mar 26, 2014 at 07:23 PM

If you want the force to be along the object's forward, you must use AddRelativeForce as you are. Relative force is applied to the Local transform. I also suggest using transform.Rotate instead of eulerAngles. As the page here: http://docs.unity3d.com/Documentation/ScriptReference/Transform-eulerAngles.html suggests that it will fail after 360 degrees, not something I would think you want.

On this page: http://docs.unity3d.com/Documentation/ScriptReference/Transform.Rotate.html The last script example shows Rotation around the x-axis at 1 degree per second. Change that to the y-axis and change the degrees per second.

Comment
Add comment · Show 1 · 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 RGI · Mar 29, 2014 at 02:29 PM 0
Share

I already am Using Relative Force and changing eulerAngles doesnt seem to help

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

AddForce not influenced by rotation 1 Answer

AddRelativeForce not adding force relatively 2 Answers

Adding a force to an object relative to a rotation? 0 Answers

Bow and Arrow functionality in Unity3d 0 Answers

Rotation Force on a model 2 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