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 /
avatar image
0
Question by Adam_Raetz · Oct 10, 2015 at 01:16 PM · c#tutorialsspline

Unity 5 troubles with Catlike Coding Tutorials

So, I am trying to learn how to effectively use and code splines in Unity. It's for a project I am working where I need the characters to follow very particular paths.

So I am working on Catlike Coding's tutorial (it seemed the most complete) and I am running into:

  • Assets/_Scripts/BezierCurve.cs(21,57): error CS1501: No overload for method GetPoint' takes 4' arguments

  • Assets/_Scripts/BezierCurve.cs(21,34): error CS1502: The best overloaded method match for UnityEngine.Transform.TransformPoint(UnityEngine.Vector3)' has some invalid arguments - Assets/_Scripts/BezierCurve.cs(21,34): error CS1503: Argument #1' cannot convert object' expression to type UnityEngine.Vector3'

And then again for line 27, the same 3 errors for 6 total errors.

 using UnityEngine;
 using System.Collections;
 
 public class BezierCurve : MonoBehaviour {
 
     public Vector3[] points;
 
     public void Reset () {
 
         points = new Vector3[] {
 
             new Vector3(1f, 0f, 0f),
             new Vector3(2f, 0f, 0f),
             new Vector3(3f, 0f, 0f),
             new Vector3(4f, 0f, 0f)
 
         };
     }
     
     public Vector3 GetPoint (float t) {
         
         return transform.TransformPoint (Bezier.GetPoint (points [0], points [1], points [2], points[3], t));
         
     }
 
     public Vector3 GetVelocity (float t) {
 
         return transform.TransformPoint (Bezier.GetFirstDerivative (points [0], points [1], points [2], points[3], 
                                                                     transform.position));
 
     }
 
 
     public Vector3 GetDirection (float t) {
 
         return GetVelocity (t).normalized;
 
     }
 
 
 
 }
 

I knew I was running into problems sooner when I couldn't even get the interpolation line to appear between the first and last point. I have double checked that my code matches his code to this point.

I cannot figure out how to fix these overloads. I'm pretty new to Unity and C#. I'm not against assets, and I know there are spline assets out there, but assets won't make me a better coder or understand the workings any better so I am trying to stay as close to coding as I can for the things than can be coded.

Thanks much for any help.

Comment
Add comment · Show 2
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 Linus · Oct 10, 2015 at 02:19 PM 0
Share

I skimmed the turotial. Seems like line 21 should be

 public Vector3 GetPoint (float t) {
         return transform.TransformPoint(Bezier.GetPoint(points[0], points[1], points[2], t));
     }


Perhaps removing points[3] from line 27 fixes those errors as well.

avatar image Adam_Raetz · Oct 11, 2015 at 11:30 AM 0
Share

The end of the tutorial has all 4 points and t as arguments.

The problem is that a Vector3 only takes 3 arguments. I have no idea how he's overloading with 2 more arguments now.

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

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Making a bubble level (not a game but work tool) 1 Answer

leantween ltspline control points setup 0 Answers

(unity 3d) Trying to make rail griding/sliding mechanic using PathCreator asset. 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