- Home /
Argument `#1' cannot convert `bool' expression to type `float'
Hey quick question - how do I fix this error :
Argument #1' cannot convert
bool' expression to type `float'
This is the line of the code:
motion *= (Mathf.Abs(input.x) == 1 && Mathf.Abs(input.z == 1))? 0.7f : 1;
sorry C# is not my strong suit.
Thanks.
Comment
Answer by aditya · Jun 09, 2016 at 04:52 AM
your input.z
section is going wrong ... it should be like this
motion *= (Mathf.Abs(input.x) == 1 && Mathf.Abs(input.z) == 1)? 0.7f : 1;
Answer by 5c4r3cr0w · Jun 09, 2016 at 04:50 AM
try this :
motion *= (Mathf.Approximately(input.x,1) && Mathf.Approximately(input.z, 1))? 0.7f : 1;
Your answer
![](https://koobas.hobune.stream/wayback/20220612082542im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
calculating distance between points returns Nan... 1 Answer
Help Understanding Script 2 Answers
Seeding perlin functions 1 Answer