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 /
  • Help Room /
This question was closed Apr 15, 2021 at 09:26 AM by Pitak_ for the following reason:

Newer mind i fixed it.

avatar image
0
Question by Pitak_ · Apr 14, 2021 at 10:42 AM · movementscripting beginnerplane

Why does it starts going backwards.

Well I was making a game and i wrote a script for it and you can add trust on motors by pressing x and for some reason when the trust is on 57 or less it starts going backwards. Could someone explain me why?

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class movemento : MonoBehaviour
 {
     public float agility = 10f;
     public float Engines= 120f;
     public float horizontalSpeed = 1f;
     public float verticalSpeed = 1f;
     public float isengon = 1f;
     public float speed = 0f;
     // Start is called before the first frame update
     void Start()
     {
         Application.targetFrameRate = 60;
     }
     // Update is called once per frame
     void Update()
     {
         if (Input.GetKey (KeyCode.Q)) {  
             transform.Rotate(Vector3.forward * agility * Time.deltaTime);      
         }
         if (Input.GetKey (KeyCode.E)) {  
             transform.Rotate(Vector3.back * agility * Time.deltaTime);     
         }
         if (Input.GetKey (KeyCode.A)) {  
             transform.Rotate(Vector3.down * agility * Time.deltaTime);      
         }
         if (Input.GetKey (KeyCode.D)) {  
             transform.Rotate(Vector3.up * agility * Time.deltaTime);     
         }
         if (Input.GetKey (KeyCode.W)) {  
             transform.Rotate(Vector3.right * agility * Time.deltaTime);   
         }
         if (Input.GetKey (KeyCode.S)) {  
             transform.Rotate(Vector3.left * agility * Time.deltaTime);
         }
         if (Input.GetKey (KeyCode.UpArrow)) {
             transform.Translate (0f, 0f, 3f);
         }
         if (Input.GetKey (KeyCode.DownArrow)) {
             transform.Translate (0f, 0f, -1.5f);
         }
         if (Input.GetKey (KeyCode.Space)){
             isengon = 1f;
         }
         if (Input.GetKey (KeyCode.LeftControl)){
             if (60 >= Engines){
                 if (-60 <= Engines){
                     isengon = 0f;
                 }
             }
         }
         if (Input.GetKey (KeyCode.X)){
             if (Engines <= 400){
                 Engines = Engines+1f;
                 IEnumerator MyCoroutine(float someParameter)
                 {
                     yield return new WaitForSeconds(0.5f);
                 }
             }
         }
         if (Input.GetKey (KeyCode.C)) {
             Engines = Engines-1f;
             IEnumerator MyCoroutine(float someParameter)
             {
                 yield return new WaitForSeconds(0.5f);
             }
         }
         if (isengon == 1f){
             speed = (0.05f*Engines);
             transform.Translate (0f, 0f, speed);
             IEnumerator MyCoroutine(float someParameter)
             {
                 transform.position = Vector3.zero;
                 yield return new WaitForSeconds(1f);
             }
         }
     }
 }
 

   
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

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

224 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 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 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 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

Touch buttons sometimes won't work 0 Answers

Switching plane texture through script 1 Answer

How do I make my movement script move the character UNTIL I let go of the key? 1 Answer

Rigidbody2D movement is lagging 0 Answers

Make a character face left. without flip 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