Page 1 of 1
Hex to float convertion problem
Posted: Sun Apr 01, 2007 3:07 pm
by fun_bidoux
Hello,
I'm trying to make some thing with the coll tag but I dont know how to convert a hex(C3F528BE) string to a float(-0.165)... can somme one help me please?
Thanks,
Posted: Sun Apr 01, 2007 5:06 pm
by shade45
We'll I don't know the exact math to do the conversion. But all you need to do is highlight the hex value. Then assuming your using hex workshop look at the bottom left of the screen for the float value.
http://img478.imageshack.us/img478/3941/captureis4.jpg
Posted: Sun Apr 01, 2007 5:43 pm
by fun_bidoux
thanks but I whant to create a small application(c++) that will export and import collision between the maps and 3ds max.
Posted: Sun Apr 01, 2007 9:40 pm
by kornman00
void blahblah()
{
int eatme = 0xC3F528BE;
float kthx = *(reinterpret_cast<float*>(&eatme));
}
if your doing in C++ though, why not just treat the data as a real number right from the start (assuming your trying to convert input data)?
Posted: Mon Apr 02, 2007 12:33 pm
by fun_bidoux
thanks you very much!

It's working

when you inverse the hex (C3F528BE to BE28F5C3).
Posted: Tue Apr 03, 2007 7:47 am
by kornman00
Yeah, code is always done in big endian (compiler takes care of byte swapping the result code), but windows runs on little endian machines.