Strange GE frame rate value issue

Non-platform specific questions.

Strange GE frame rate value issue

Postby bamby1983 » Sat Mar 30, 2013 8:30 pm

This works - The result is either 24 or 25 every time.

Code: Select all
temp_3.textNumber=real_fps;



This doesn't work - the result is 0 every time.

Code: Select all
temp_3.textNumber=(1/real_fps);



Does anyone know why this occurs?
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score

Re: Strange GE frame rate value issue

Postby skydereign » Sat Mar 30, 2013 8:43 pm

That's because you are using integer arithmetic. You have to be using variables with floating points, otherwise it clobbers the floating point.
Code: Select all
temp_3.textNumber = 1.0/real_fps;
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Strange GE frame rate value issue

Postby bamby1983 » Sat Mar 30, 2013 9:51 pm

Thanks! I didn't know that about C.
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron