- Home /
Unity mathematics phrasing.
I'm trying to use this to calculate fall damage: "0.005(MaxFall-200)^2" so it's "y=0.005(x-200)^2", however unity gives me this error: "It is not possible to invoke an expression of type 'float'"; how would I rewrite it to work?
$$anonymous$$ight be worth it to read through any Intro to C# book. Because using star for multiply is basic program$$anonymous$$g knowledge (which is all those books cover. They won't $$anonymous$$ch you to program.)
There's probably a bunch of other easy stuff you'd pick up just skim$$anonymous$$g for an hour.
Answer by Psymon · Jul 30, 2013 at 07:35 AM
For the square operator you can use Mathf.Pow
Then your calcul will look like this :
y = 0.005f * Mathf.Pow( (x-200), 2 );
Ah, I knew about the problem with the square, but I was just using "($$anonymous$$axFall-200)*($$anonymous$$axFall-200)" to work around it, it was that 0.005 that was causing the error. This worked, THAN$$anonymous$$S!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
JavaScript and Ajax second addition Tutorial 11 case problem 2 0 Answers
Cursor Lock to Center of screen script doesnt work please help. 2 Answers
Static var wont work 2 Answers
Scripting error! 1 Answer