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 /
  • Help Room /
This question was closed Sep 06, 2016 at 11:13 AM by Zythus for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Zythus · Feb 10, 2016 at 01:12 PM · unity 5planecontrolaircraft

Turning plane at an angle instead of rotating around center

Hey there, so I've got a script that controls Plane movements, and virtual joystick that takes care of it, and it's cool, but I'd like my plane to be controlled somewhat like it's controlled by mouse in WarThunder.

If you don't know what I'm on about here is the video. https://www.youtube.com/watch?v=xxEgQWomxXU

Right now I'm using basic stuff:

 transform.position += transform.forward * Time.deltaTime * speed;
 transform.Rotate(-CrossPlatformInputManager.GetAxis("Vertical"), 0.0f, -CrossPlatformInputManager.GetAxis("Horizontal"));

So basically when I want to go left, instead of rotating around the center of the plane like I'm doing right now, I want the plane to turn left at an angle. How can I achieve that?

Cheers

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

  • Sort: 
avatar image
1
Best Answer

Answer by gorbit99 · Feb 11, 2016 at 05:25 PM

transform.RotateAround(gameObjectPos, pointToRotateAround, AmountOfRot);

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 Zythus · Feb 11, 2016 at 07:55 PM 0
Share

Hey man nice one, just one more thing - do you know how to lock the plane from rotating too far around it's center while turning? Let's say I'd like it to rotate around it's center only by 60 degrees when turning.

That's what I've got now:

 transform.RotateAround(transform.position, Vector3.up, Input.GetAxis("Horizontal") * 30f * Time.deltaTime);
  transform.Rotate(-Input.GetAxis("Vertical"), 0.0f, -Input.GetAxis("Horizontal") * 1.5f);

Follow this Question

Answers Answers and Comments

56 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

Related Questions

why Plane disappear in unity when export from 3ds Max to Unity? 0 Answers

How to change the position of a button? 1 Answer

Baked lightmap in unity 5.2 not affect on android device 2 Answers

Game Scene lags while starting 0 Answers

Help with Pause Menu 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