Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 joshua-lyness · Dec 30, 2015 at 09:28 PM · vector3functionfunctionsidentifier

Vector3 not an identifier?

I am trying to write a function that finds a point on a Bezier curve. I need it to output a vector 3 co ordinate however it keeps giving me an error saying "identifier expected". Isnt the first phrase "Vector3" the identifier here!? heres a screenshot of some of the errors :/ alt text

     //function to find point on curve
     Vector3 curveEquation(p0 : Vector3, p1 : Vector3, p2 : Vector3, p3 : Vector3, t : float)
     private Vector3 p4;
     private Vector3 p5;
     private Vector3 p6;
     private Vector3 p7;
     private Vector3 p8;
     private Vector3 p9;
     {
         
         p4 = Vector3.Lerp(p0,p1,t);
         p5 = Vector3.Lerp(p1,p2,t);
         p6 = Vector3.Lerp(p2,p3,t);
         p7 = Vector3.Lerp(p4,p5,t);
         p8 = Vector3.Lerp(p5,p6,t);
         p9 = Vector3.Lerp(p7,p8,t);
 
         return p9;
     }
 }


screenshot-3.png (241.7 kB)
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 NoseKills · Dec 31, 2015 at 12:14 AM

1) you are mixing C# syntax with UnityScript syntax

 Vector3 curveEquation(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float  t)
 //not
 Vector3 curveEquation(p0 : Vector3, p1 : Vector3, p2 : Vector3, p3 : Vector3, t : float)

2) you cannot declare fields between a function declaration and that function's body { }

 private Vector3 p4; // <- a field, accessible in the whole class
 Vector3 curveEquation(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t)
 {
     Vector2 p5 // <- a local vector only accessible in this method 
     // your method stuff
 }
 // not
 Vector3 curveEquation(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t)
 private Vector3 p4;
 {
     // your method stuff
 }
Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

39 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

Related Questions

How can I thread this function? 0 Answers

How do I get all of my code in start function 1 Answer

Problem with Contains 0 Answers

Need help making my code more efficient 0 Answers

Method Group 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