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 joeybubble1 · Dec 06, 2012 at 04:59 PM · convertlanguage

Convert .js to C#

Hello I recently bought "Edy's Vehicle Physics" and have been trying to convert it to C# and I don't know how to convert this line, please help.

 static var MCforward =  [ 0.561, 1.114, 1.659, 2.195, 2.724, 3.246, 3.759, 4.266, 4.765, 5.257, 5.741, 6.219, 6.690, 7.154, 7.611, 8.062, 8.506, 8.944, 9.376, 9.801, 10.223, 10.636, 11.044, 11.443, 11.839, 12.229, 12.614, 12.990, 13.363, 13.731, 14.095, 14.452, 14.805, 15.153, 15.496, 15.834, 16.167, 16.495, 16.819, 17.138, 17.453, 17.772, 18.078, 18.380, 18.667, 18.970, 19.260, 19.545, 19.826, 20.103 ];
 static var MCsideways = [ 0.555, 1.095, 1.622, 2.135, 2.636, 3.124, 3.600, 4.060, 4.513, 4.951, 5.382, 5.793, 6.199, 6.602, 7.002, 7.348, 7.723, 8.096, 8.419, 8.782,  9.101,  9.403,  9.779, 10.026, 10.322, 10.695, 10.921, 11.157, 11.465, 11.807, 12.005, 12.202, 12.440, 12.741, 13.060, 13.234, 13.394, 13.570, 13.780, 14.033, 14.333, 14.567, 14.707, 14.835, 14.969, 15.119, 15.291, 15.489, 15.714, 15.966 ];

Thanks Tz

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 joeybubble1 · Dec 06, 2012 at 05:36 PM 0
Share

Thanks so much :D

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by n8 · Dec 06, 2012 at 05:16 PM

these are just float arrays. They should just be something like this:

 static float[] MCforward = new float[] {0.561f, 1.114f, 1.659f};
     static float[] MCsideways = new float[]{0.555f, 1.095f, 1.622f};
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
avatar image
1

Answer by Landern · Dec 06, 2012 at 05:20 PM

Here you go, as List of float.

         static List<float> MCforward =  new List<float>() { 0.561f, 1.114f, 1.659f, 2.195f, 2.724f, 3.246f, 3.759f, 4.266f, 4.765f, 5.257, 5.741f, 6.219f, 6.690f, 7.154f, 7.611f, 8.062f, 8.506f, 8.944f, 9.376f, 9.801f, 10.223f, 10.636f, 11.044f, 11.443f, 11.839f, 12.229f, 12.614f, 12.990f, 13.363f, 13.731f, 14.095f, 14.452f, 14.805f, 15.153f, 15.496f, 15.834f, 16.167f, 16.495f, 16.819f, 17.138f, 17.453f, 17.772f, 18.078f, 18.380f, 18.667f, 18.970f, 19.260f, 19.545f, 19.826f, 20.103f };
         static List<float> MCsideways = new List<float>() { 0.555f, 1.095f, 1.622f, 2.135f, 2.636f, 3.124f, 3.600f, 4.060f, 4.513f, 4.951f, 5.382f, 5.793f, 6.199f, 6.602f, 7.002f, 7.348f, 7.723f, 8.096f, 8.419f, 8.782f,  9.101f,  9.403f,  9.779f, 10.026f, 10.322f, 10.695f, 10.921f, 11.157f, 11.465f, 11.807f, 12.005f, 12.202f, 12.440f, 12.741f, 13.060f, 13.234f, 13.394f, 13.570f, 13.780f, 14.033f, 14.333f, 14.567f, 14.707f, 14.835f, 14.969f, 15.119f, 15.291f, 15.489f, 15.714f, 15.966f };
 
Comment
Add comment · Show 2 · 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 n8 · Dec 06, 2012 at 05:24 PM 0
Share

Lists are great to use in place of standard arrays as they give more control over the contents, just keep in $$anonymous$$d that you need to import the proper libraries to get these to work. Add this to the top of your file:

using System.Collections; using System.Collections.Generic;

avatar image Landern · Dec 06, 2012 at 05:37 PM 0
Share

You only need to declare :

c# using System.Collections.Generic;

js import System.Collections.Generic;

for a List of T(T = the Type that will make up the elements in your collection.

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

12 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

Related Questions

Need help converting js to C# 1 Answer

Cloud recognition in Vuforia 0 Answers

A convert between stream and object in unity3d? 0 Answers

How to localization app name on android platform 1 Answer

C# scripting and Javascript in the same project? 3 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