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 Shaun 1 · May 14, 2011 at 10:36 PM · speedincreaseflightfly

fly speed , increasing speed

hello everyone,i'm trying to use SacFree flight script ,and i have this script attached to cube,and i have camera attached to cube too, i can fly in the same speed but i want to increase my speed while i'm going down. And i tried something to do this: when i'm going straight i looked to my Rotation X and it was around +5 , and when i started flying down my rotation x was more than for example 15 ( here what i mean : http://ressim.net/s/upload/7f79072b.png )

so i tried something like this:

if (transform.rotation.x > 15) {

print("you are going down "); }

but nothing was written on the console, which if statement need i use to do this. Please help.

And here is the script, also what should i use to increase my speed in the right if statement. ( note speed increases when i increase acceleration and max speed )

var YawSpeed = 30.0; var TurnSpeed = 30.0; var ElevateSpeed = 16; var Acceleration = 30; var MaxSpeed = 120; private var Speed = 0.0;

function Update(){

if(Speed >= MaxSpeed){Speed=MaxSpeed;}

if(Speed <= (MaxSpeed / 3)){ rigidbody.useGravity = true; }else{rigidbody.useGravity = false;}

transform.Translate(Vector3.forward Speed Time.deltaTime);

if(Input.GetAxis("Accelerate")){Speed = Speed + Acceleration;} if(Input.GetAxis("Decelerate")){Speed = Speed - Acceleration;}

transform.Rotate(0,Input.GetAxis("Yaw") YawSpeed Time.deltaTime,0); transform.Rotate(0,0,Input.GetAxis("Turn") TurnSpeed Time.deltaTime); transform.Rotate(Input.GetAxis("Elevate") * ElevateSpeed 2 Time.deltaTime,0,0);

if (transform.rotation.x > 20) {

print("you are going down "); }

}

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
1
Best Answer

Answer by Antony-Blackett · May 15, 2011 at 01:44 AM

transform.rotation.x gets the X component of the Quaternion which is not what you want, see http://unity3d.com/support/documentation/ScriptReference/Quaternion.html. You want the x axis rotation in euler angles. Do this instead.

if( transform.rotation.eulerAngles.x > 20 )
{
    print("you are going down ");
}
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 Shaun 1 · May 15, 2011 at 10:05 AM 0
Share

thank you very much it works :)

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

No one has followed this question yet.

Related Questions

Increase speed from 0f-10f over time 1 Answer

Increase sprite falling speed 1 Answer

Fly-By-Wire System 0 Answers

How To Add A Simple Speed Boost On Collision With A Specific Object With A Character Controller 0 Answers

Objects moving faster after time 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