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 /
avatar image
0
Question by PERFKNIGHT · Dec 18, 2015 at 04:57 PM · error message

Unknown symbol(s)?

Okay, so I'm making a hovercar game in Unity, and some unknown symbol errors are popping up in the console. I can't seem to find the errors, and I followed a Youtube tutorial to the letter. Help?

using UnityEngine; using System.Collections;

public class PlayerController : MonoBehaviour { public Rigidbody rb; float m_deadzone = 0.1f;

 public float forwardAccel = 100.0f;
 public float backwardAccel = 25.0f;
 float currentThrust = 0.0f;

 public float m_turnStrength = 10f;
 float m_currTurn = 0.0f;    
 
 private float strafe;
 private Vector3 strafePos;
 private float currentStrafe;
 public float strafeRate;    

 public GameObject shot;
 public Transform shotSpawn;
 public Transform shotSpawn1;
 public float fireRate;

 private float nextFire;
 private float nextFire1;

 int m_layerMask;
 public float m_hoverForce = 9.0f;
 public float m_hoverHeight = 2.0f;
 public GameObject[] m_hoverPoints;
 
 void Start()
 {
     rb = GetComponent<Rigidbody>();
     m_layerMask = 1 << LayerMask.NameToLayer("Player");
     m_layerMask = ~m_layerMask;
 }
 
 void Update()
 {
     currentThrust = 0.0f;
     float accelAxis = Input.GetAxis("Vertical");
     
     strafe = Input.GetAxis("Horizontal");
     
     m_currTurn = 0.0f;
     
     float turnAxis = Input.GetAxis("RotateHorizontal");
     
     if (Mathf.Abs(turnAxis) > m_deadZone)
     {
         m_currTurn = turnAxis;
     }
     
     if(accelAxis > m_deadzone)
     {
         currentThrust = accelAxis * forwardAccel;
      }
     
     else if(accelAxis < m_deadzone)
     {
         currentThrust = accelAxis * backwardAccel;
      }
     
     if(strafe > m_deadzone)
     {
         currentStrafe = strafe * strafeRate;
     }

     else if(strafe < m_deadzone)
     {
         currentStrafe = strafe * strafeRate;
     }
     
     strafePos = Quaternion.Euler(0f, transform.eulerAngles.y,0f) * new Vector3(currentStrafe,0f,0f);
     
     if (Input.GetButton("Shoot") && Time.time > nextFire)
        {
         nextFire = Time.time + fireRate;
         shot.SetActive(true);
         Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
        }
     
     if (Input.GetButton("Shoot") && Time.time > nextFire1)
        {
         nextFire1 = Time.time + fireRate;
         shot.SetActive(true);
         Instantiate(shot, shotSpawn1.position, shotSpawn1.rotation);
        }
 }

 void FixedUpdate()
 {
     RaycastHit hit;
     for(int i = 0; i < m_hoverPoints.Length; i++)
     {
         var hoverPoint = m_hoverPoints[i];
             if(Physics.Raycast(hoverPoint.transform.position,-Vector3.up,out hit,m_hoverHeight,m_layerMask))
         {
             rb.AddForceAtPosition(Vector3.up * m_hoverForce * (1.0f - (hit.distance / m_hoverHeight)), hoverPoint.transform.position);
         }
     }
     
     else
     {
         if(transform.position.y > hoverPoint.transform.position.y)
         {
             rb.AddForceAtPosition(hoverPoint.transform.up * m_hoverForce, hoverPoint.transform.position); 
         }
         
         else
         {
             rb.AddForceAtPosition(hoverPoint.transform.up * -m_hoverForce, hoverPoint.transform.position); 
         }
     }
     
     if(Mathf.Abs(currentThrust) > 0)
     {
         rb.AddForce(transform.forward * currentThrust);
     }
     
     if (m_currTurn > 0)
     {
         rb.AddRelativeTorque(Vector3.up * m_currTurn * m_turnStrength);
     }
     
     else if(m_currTurn < 0)
     {
         rb.AddRelativeTorque(Vector3.up * m_currTurn * m_turnStrength);
     }

     if(Mathf.Abs(currentStrafe) > 0)
     {
         rb.AddForce(strafePos);    
     }            
 }
 
 void OnDrawGizmos()
 

}

Comment
Add comment · Show 1
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 Hellium · Dec 17, 2015 at 10:08 AM 0
Share
  • The name 'm_deadZone' does not exist in the current context

  • 'PlayerController.OnDrawGizmos()' must declare a body because it is not marked abstract, extern, or partial

  • In the fixed update, there is an else without an if before (because of the closing bracket of the for loop)

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Error CS0535? 0 Answers

Roll a Ball script error?! 2 Answers

Keep getting this error Message when posting on a GameJolt (Google Chrome): MissingKeyMissing Key-Pair-Id query parameter or cookie value 0 Answers

Parsing error- Please help! 0 Answers

Assets/BallControl.js(17,55): BCE0034: Expressions in statements must only be executed for their side-effects. 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