Gamblyat
(Gamblyat)
1
I have tried absolutely everything and cannot seem to cast an integer to a float.
The closest I got is
if (test := float[float_val]) {}
Which displays the extremely odd error
Dynamic cast to `float` takes an float as its parameter, instead got int(3509)
Anybody have any ideas?
2 Likes
There is not a direct way to cast an int to a float. My current solution is this, a bit cheesy, but works:
var myFloatVar:float = 1.0 * myIntVar
4 Likes
Gamblyat
(Gamblyat)
3
Wow yea that’s a bit cheesy alright, bit of a shame. Thank you very much!
mykaa
(mykaadev)
4
you can always use something like float fUrIntConvertedToFloat = static_cast(UrIntVariable);
Otherwise just pass the static_cast(UrIntVariable)
Hope this solved your little issue! :> Have fun!
Kamyker
(Kamyker)
5
This is Verse forum not C++
Gamblyat
(Gamblyat)
7
That’s very helpful cheers mate.
mykaa
(mykaadev)
8
you re right I’m sorry mate!
thanks for that :>