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 MC HALO · May 14, 2011 at 07:24 PM · c#javascriptlanguage-comparisoncs0118

Can someone explain the difference??

hey guys i was wondering if you could clear something up for me. Basically its for the following lines below i would be really great full if you could help me :)


Line 1


Code in Java :

 OriginalRotation = XQuaternion = Quaternion.AngleAxis (RotationX , Vector3.up);   


Code In C Sharp :

  Quaternion XQuaternion = Quaternion.AngleAxis(RotationX, Vector3.up);


Now the question is in my Java script i created a variable on the top called "var OriginalRotation" and defined it as a Quaternion. Now in the Java Script you can see i have used the OriginalRotation and then defined a XQuaternion with in it and then set the AngleAxis. Now i tried the same in C but it would not allow me to place the variable before it and then define the X angle. it gave me this message


error code:

Assets/FPSScripts/FpsMouseLookCSharp.cs(56,17): error CS0118: FpsMouseLookCSharp.OriginalRotation' is afield' but a `type' was expected


now why is that ????

Question 2:


Jave code :

 static function ClampAngle (Angle, min, max): float {


C sharp Code:

  public static float ClampAngle (float Angle, float Min, float Max){


the question here is why is it that in java it allowed me to use static function and then the define the angles and the fallowed by the type it is which is float. but in C sharp i had to change this to the following line shown in the C sharp line of code. Why is this ?

i would be really great full if someone could really answer this for me thank you very much in advance MCHALO :)

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 Jessy · May 14, 2011 at 07:45 PM 0
Share

Google "Java is not JavaScript".

avatar image MC HALO · May 15, 2011 at 01:10 AM 0
Share

i know i cant be bother to write java script im sure people will understand

1 Reply

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

Answer by Dasinf · May 14, 2011 at 09:12 PM

Hello,

I believe both of your problems would be best answered if you got familiar with the C# syntax. Spend a few hours doing some simple online tutorial and I think you will avoid a lot of future problems like this.

Short pointers to both problems:

1. In JS you define the type (a string in this example) of a variable by writing...

var variableName : string

...where in C# you would simply write...

string variableName

That's why your C# is giving an error, you are trying to use a wrong syntax.

2. Again, JS and C# use a different syntax. You simply write the same thing in a different way. Learning the basic syntax of C# is really easy and you can do it in an evening if you want to.

Hope that helps, -T

Comment
Add comment · Show 1 · 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 MC HALO · May 15, 2011 at 01:12 AM 0
Share

lol i know who to do that lol thanks any ways you helped :)

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

No one has followed this question yet.

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Is something wrong with Boo? 4 Answers

Read objects like in Penumbra 1 Answer

Camera Effect + Translating US to C# 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