• 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 lorigio · Jul 10, 2012 at 08:12 AM · helicopter

Helicopter rotor inclination

Hi i have made my helicopter rotor works but when i use left/right arrow keys and the helicopter inclination changes it looks like this

Here the video http://www.youtube.com/watch?v=_3fehYSxVSw

alt text alt text

Here like i want it will be

alt text

This is the code for rotor spin that cause the problem

  MainRotor.RotateAround (MainRotor.position, Vector3.up, audiosource.pitch * rotorspeed); 

And this for the helicopter inclination

 moveDirection = new Vector3 (Input.GetAxis ("Vertical") * -1, Input.GetAxis ("UpDown") * -1, Input.GetAxis ("Horizontal"));
      
      moveDirection = transform.TransformDirection (moveDirection);
     
      moveDirection *= speed; 
      
      if (Input.GetAxis ("Vertical") > 0 && (transform.rotation.eulerAngles.z <= 20 || transform.rotation.eulerAngles.z >= 339)) {
      transform.Rotate (Vector3.forward * Input.GetAxis ("Vertical") / 10); 
      } else if (Input.GetAxis ("Vertical") < 0 && (transform.rotation.eulerAngles.z <= 21 || transform.rotation.eulerAngles.z >= 340)) {
      transform.Rotate (-(Vector3.back * Input.GetAxis ("Vertical") / 10)); 
      }
      
      if (Input.GetAxis ("Horizontal") > 0 && (transform.rotation.eulerAngles.x <= 20 || transform.rotation.eulerAngles.x >= 339)) {
      transform.Rotate (Vector3.right * Input.GetAxis ("Horizontal") / 15);
      transform.Rotate (0, Input.GetAxis ("Horizontal") / 15, 0); 
      } else if (Input.GetAxis ("Horizontal") < 0 && (transform.rotation.eulerAngles.x <= 21 || transform.rotation.eulerAngles.x <= 340)) {
      transform.Rotate (-(Vector3.left * Input.GetAxis ("Horizontal") / 15));
      transform.Rotate (0, -(Input.GetAxis ("Horizontal") * -1) / 15, 0); 
      }
      
      CharacterController controller = GetComponent ();
     
      controller.Move (moveDirection * Time.deltaTime);  
         


Comment
Add comment · Show 8
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 Bovine · Jul 10, 2012 at 08:22 AM 0
Share

Hard to see what's wrong on your screenshot - do you have a better image; can you explain what's wrong in the screenshot?

avatar image AlucardJay · Jul 10, 2012 at 08:30 AM 0
Share

the rotors are angled left indicating the chopper is rolling(banking, turning) left, but the chopper body is not the same angle as the rotors. sry I couldn't help except in that, good luck =]

avatar image lorigio · Jul 10, 2012 at 08:34 AM 0
Share

Added more screenshot

avatar image Bovine · Jul 10, 2012 at 08:56 AM 0
Share

Are you blades children of your chopper? If the input axis is in world co-ordinates, you'll need to specify Space.World or map the axis into the rotar blades coordinate space.

I've not checked your rotate maths here - if the chopper is at the origin in your world and has no rotation applied to it, do the rotars move as expected?

avatar image lorigio · Jul 10, 2012 at 09:08 AM 0
Share

Yes blades are children of the chopper, i'll post youtube video in 5 $$anonymous$$utes

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by lorigio · Jul 10, 2012 at 10:27 AM

Solved by replace

 MainRotor.RotateAround (MainRotor.position, Vector3.up, audiosource.pitch * rotorspeed);

with

 MainRotor.RotateAroundLocal (Vector3.forward, audiosource.pitch * rotorspeed); 

 
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 Bovine · Jul 10, 2012 at 11:42 AM 0
Share

I think Vector3.up would have been 0,1,0 always, I don't know if you needed to use Transform.up from the blades?

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

switching scripts on and off 1 Answer

When applying AddRelativeForce object reaches higher speed when rotated 1 Answer

Script for getting in and out of a tank 2 Answers

Scripting Halp!! Basic Helictopter Controller 2 Answers

How to make a helecoper attack 0 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