• 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
Question by HyndeSyte2020 · Feb 27, 2012 at 06:02 AM · flight sim

Paper Plane Simulator Physics Problems- Help

So I am working on creating a paper airplane simulator. Meaning a flight simulator which has no engine or thruster other than the force it starts out with. There will be the ability to gain thrust by angling down then arcing back up, and to gain lift by flying over things like fans or burning barrels.

MY ISSUES:

  • cannot for the life of me figure out how to get lift to work. The lift should be proportional to the forward velocity and be able to be affected by the barrels/fans mentioned above. A tutorial I found said to "project the plane's rigidbody.velocity onto the plane's forward vector using Vector3.Project, and then get the magnitude of the result." ....I am fairly novice and this is less detailed than I need to comprehend it at this point.

  • cannot get realistic turning. I have attempted to apply torque rather than 'transform.Rotate' but it doesn't do anything but keep me on the same path but rotation around the different axis's. Is this due to lift not being in play?

  • also assume I need to have angular drag and drag proportionate to my thrust?

I have scoured the web finding different links and information, but with 20+ tabs currently open and each of them either being too vague for a beginner or too involved for a paper airplane (no afterburner or airbrake on a paper airplane) I am at a loss.

If you would like to see what I have let me know. I have my environment modeled, just need the physics for my plan to work.

Please help constructively if you can!

Hearty cheers.

PS. I am using Javascript, not C#. Please try to frame answers in Javascript so I don't need to translate.

Comment
Jessy

People who like this

-1 Show 7
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 HyndeSyte2020 · Feb 28, 2012 at 02:29 PM 0
Share

Wanted to provide an update. I have tried simple transform.Rotate to move the plane. While these work, they are clunky and don't seem to be the best options. Also, my lift seems to have issues with being a constant force and I find myself taking off into space. Here is my flight script so far.

var rotateAmountY = 2.0;

var rotateAmountX = 1.0;

var thrust = -5000;

var maxThrust = -5000;

//var lift = Vector3.Project(Vector3.up);

function Update()

{

if (Input.GetAxis("Horizontal") < 0)

        transform.Rotate(0, 0, -rotateAmountY); 

    

else if (Input.GetAxis("Horizontal") > 0)

        transform.Rotate(0, 0, rotateAmountY); 



if (Input.GetAxis("Vertical") < 0)

    { 

      transform.Rotate(-rotateAmountX, 0, 0); 

    }

else if (Input.GetAxis("Vertical") > 0)

        transform.Rotate(rotateAmountX, 0, 0);

        

}

function FixedUpdate()

{

 rigidbody.AddForce(transform.forward * thrust);

 rigidbody.AddForce(transform.up * rigidbody.velocity.magnitude);    

}

avatar image HyndeSyte2020 · Feb 29, 2012 at 03:31 AM 0
Share

Still nothing.... hmmm......

Spoke with a few friends today who said (contrary to what I've read on other forums) that the standard asset "first-person controller" (or third) is okay to use. Just gotta tinker a bit but it beats writing your own script. Is this true?

avatar image HyndeSyte2020 · Mar 04, 2012 at 01:04 AM 0
Share

So it seems that the community is amassed of those either without the desire to share their knowledge or lacking in knowledge to share. I am somewhat disappointed that after nearly 100 views there hasn't been even conjecture on the topic. Looking at other questions, some have nearly 3000 views without any conversation around coming up with a solution. This leaves me with a dismal opinion of this site, hopefully I am wrong but the vast majority of the community seems to be unwilling to partake in conversation around potential solutions to questions they view and instead wait for someone to come up with an answer that they can leech upon after it is posted.

That said:

I am still working on getting the third-person controller to work. It seems that the best way to do this is to reduce gravity to a very small amount to simulate the slow descent of a plane. This coupled with a constant forward force and adjusting the wasd key commands has given promising results. When I am happy with it as a beta I will post some script.

avatar image HyndeSyte2020 · Mar 06, 2012 at 07:28 PM 0
Share

Ok, so I've realized that 'lift' is a force that is not needed for a paper airplane. Since my game will have no way of increasing forward velocity other than angling down, lift will have no use in the game. I am going to continue working on the control of flight with an initial velocity and a reset of height/velocity upon interacting with vents/barrels etc.

avatar image Fraggle222 · May 15, 2012 at 01:10 AM 0
Share

Yes, sad to see no responses. I too am working on some airplane controls and while I'm exploring "powered" flight I'm interested in the un-powered paper airplane approach too. I've been having difficulty getting things to work 100% using rigidbody+collider and using forces and torques (for some reason adding the collider changed everything). I do have some working versions that use forces, torques and also manipulate the rigidbody.rotation. I also have a different version working that uses a character controller, and transform.Rotate and controller.Move. Let me know if you want me to post what I have. Did you ever get your stuff working?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by thenachotech1113 · Jun 16, 2012 at 09:44 PM

whell dude i got a preety lame script but it works, it includes the rotation and yaw, if you want to use it just ad a new input called Yaw and set a to positive and d to negative.

 var speed = 0;
 var acceleration = 2;
 var maxSpeed = 500;
 var minSpeed = 0;    
 var Torque = 5;
 var Gravity = 100;
 var goback = 1;
 private var rotationsave = 0;
 rotationsave = transform.rotation.z;
 private var checkGravity = 0;
 checkGravity = Gravity; 
 function Start () {
 
 }
 
 function Update () 
     {
     if (Input.GetKey(KeyCode.W))speed = speed + 1 * acceleration;
     if (Input.GetKey(KeyCode.S))speed = speed - 1 * acceleration;
     if (speed >= maxSpeed)speed = maxSpeed;
     if (speed <= minSpeed)speed = minSpeed;
     constantForce.relativeForce.z = speed*Time.deltaTime;
     //yaw
     constantForce.relativeTorque.y = Input.GetAxis("Yaw") * Torque * Time.deltaTime/2;
     constantForce.relativeTorque.z = Input.GetAxis("Yaw") * Torque * Time.deltaTime/5;
     
     
     //roll
     constantForce.relativeTorque.z = Input.GetAxis("Horizontal") * Torque * Time.deltaTime/5;
     //pitch
     constantForce.relativeTorque.x = Input.GetAxis("Vertical") * Torque * Time.deltaTime;
     
     Gravity = checkGravity - speed;
     constantForce.force.y = - Gravity/100;
     if (Gravity <= 0)Gravity = 0;
     
     
     }    
Comment
Jessy

People who like this

-1 Show 0 · 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.

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

8 People are following this question.

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

Related Questions

Flight physics 0 Answers

In-Game Physical Joystick Questions 1 Answer

Flight Simulator - Return To Original Height 0 Answers

how to change flight direction in a Bird sim 1 Answer

How can I fix flickering in a distant terrain object with a VR flight sim for the Oculus Quest? 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