- Home /
Problem with MathF in C# and Javascript
Hello, I am having a problem with the MathF function in C#
See, I originally had a code in javascript, which i converted to C#
here is the code in javascript:
var BnewPos = Mathf.SmoothDamp(BulletSpawn.transform.localPosition.x, BnextPos, dampVelocity, .0003);
var BnewPos2 = Mathf.SmoothDamp(BulletSpawn.transform.localPosition.y, BnextPos2, dampVelocity3, .0003);
and I changed it to C# like so:
BnewPos= Mathf.SmoothDamp(BulletSpawn.transform.localPosition.x, BnextPos,ref dampVelocity, 0.0003f);
BnewPos2= Mathf.SmoothDamp(BulletSpawn.transform.localPosition.y, BnextPos2,ref dampVelocity3, 0.0003f);
I declared the variable for the C# above as public so I could see the value it returns. My problem is that the C# script gives an entirely different value than the Javascript, moving my object way further than the javascript did.
Any idea why this happens? any help will be appreciated, please tell me what other info am I supposed to give if this was not clear.
Thanks
PS: Or can anyone tell me how to reference the CrossPlatformInput that is in the unity standard asset with Javascript? this will solve my problem as well, specifically, how to get the CrossPlatformInput.GetButton from javascript, i have no idea how to use the "Using CrossPlatformInput" in javascript.
Thanks again
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Android Plugin Help 1 Answer
Multiple Cars not working 1 Answer
C# Touch Script - Fix GameObject touch. 0 Answers
Help with .Lerp 2 Answers