Jump to content

AppTime() acting funny in lua?


Rick
 Share

Recommended Posts

Playing with animation speed and it seems like AppTime() may be acting slowly?

 

Below is the portion that controls speed of a given animation

local appTime = AppTime()

		if appTime > v.lastTime + v.speed and v.complete == false then
			v.frame = v.frame + 1
			v.lastTime = appTime			
		end

 

If I change v.speed on my model to 0 it runs just as fast as if it's 30. If I comment out the if check and just inc the frame at machine speed the animation is clearly really fast. So wondering why wouldn't having a v.speed value of 0 produce the same result as not having the if check at all and make it go really fast?

 

 

To put it another way, the below code "should" basically be equal to not even having the if statement and just increasing the frame by 1 at the speed of the machine it's running. Yet this code below doesn't produce the same speed as just v.frame = v.frame + 1 without any checks. It would seem AppTime() is returning the same value through multiple loop interaction then as it doesn't pass that > check every cycle.

 

local appTime = AppTime()

if appTime > v.lastTime + 0 and v.complete == false then
   v.frame = v.frame + 1
   v.lastTime = appTime			
end

 

So if AppTime() can't be used for this, what would my options in Lua be to get accurate application running time in MS?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...