x


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 :)

more ▼

asked May 14 '11 at 07:24 PM

MC HALO gravatar image

MC HALO
878 74 94 111

Google "Java is not JavaScript".

May 14 '11 at 07:45 PM Jessy

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

May 15 '11 at 01:10 AM MC HALO
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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

more ▼

answered May 14 '11 at 09:12 PM

Dasinf gravatar image

Dasinf
41 1 1 4

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

May 15 '11 at 01:12 AM MC HALO
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x4152
x3459
x21
x2

asked: May 14 '11 at 07:24 PM

Seen: 1233 times

Last Updated: May 14 '11 at 07:24 PM