Convert float to int
by Mark Brown · in Torque Game Engine · 10/27/2006 (4:41 pm) · 2 replies
I have spent the past 2 hours trying to convert a flaot to an int in a .cs script.
What am I missing.
Assume %diff_x to be either float or int.
In any other language, you would usually cast it:
%jx = (int)( %diff_x / 16 );
or more directly:
%jx = int( %diff_x / 16 );
The result should be signed integer.
What am I missing.
Assume %diff_x to be either float or int.
In any other language, you would usually cast it:
%jx = (int)( %diff_x / 16 );
or more directly:
%jx = int( %diff_x / 16 );
The result should be signed integer.
About the author
#2
Works fine except has the answers reversed
mFloor rounds down
mCeil rounds up
ie. mFloor(3.2) = 4
mCeil(3.7) = 3
Should be:
mFloor rounds down
mCeil rounds up
ie. mFloor(3.2) = 3
mCeil(3.7) = 4
Many many thanks
10/27/2006 (6:44 pm)
You have saved me another two hours.Works fine except has the answers reversed
mFloor rounds down
mCeil rounds up
ie. mFloor(3.2) = 4
mCeil(3.7) = 3
Should be:
mFloor rounds down
mCeil rounds up
ie. mFloor(3.2) = 3
mCeil(3.7) = 4
Many many thanks
Associate Anthony Rosenbaum
here good ole search