Jump to content

[SOLVED] Setting the Frame Rate for a Game/Simulation


photo

Recommended Posts

Hello Unigine folk!  I have a question regarding the Unigine engine and scripting it.  I have animations that play at 25fps, there are 750 frames of animation in the sequence I am using and I wish to set the games fps value to 25.

 

Currently in the top right of my viewport it says that the game is running between 28-32fps, which is great, apart from the fact that my animations don't run at that frame rate.  I have 750 frames of animation and yet when I "log.message" the amount of frames that are played from the start of the animation sequence to the end of it, then the amount comes to 952 frames.  This is not correct and the client I am working for requires very precise camera cuts and animation sequence changes that rely on the game being run at 25fps.

 

Can anyone please help me with this issue?  I have experimented with setting FTime and IFps but I have had no success!  Any help would be greatly appreciated, thanks you in advance =)

 

Tom.S

 

EDIT:  Sorry, I forgot to add that I'm using Tracker Files in my project too, not sure if that makes any difference.  The min_time is set to 0, the max_time is set to 30 and the unit_time is set to 1!

Link to comment

Hello Tom,

 

I guess it happens as follows

 

Your track parameters (0-30, unit_time=1) mean that full animation takes 30 seconds (More information in this section of docs).

And you have ~28-32 frames per second in your scene.

 

As a result (30 seconds * ~30fps) we get near 900 frames for full animation in the scene.

 

 

In your case the easiest way is to set the exact value for FPS limit - 25.

For example by using FTime in your world_script. (engine.game.setFTime(1.0f / 25.0f))

 

 

If you still have any questions or need more detailed instructions - a small test scene would be usefu for us.

Link to comment

Hey Necris,

 

You know, I understood all of that in the first place and I had done exactly as you said, so for a minute or two I puzzled over why it was not working for me.  Turns out it was something VERY simple that I had not noticed. You see I'm relatively new to this language, when I have created float values in the past I never really bothered to put a decimal place after them and sometimes not even an f since they would function just the same (C# and a form of Javascript).  Turns out, the only difference between your code and mine was the ".0f" after your values!  

 

I can't believe it was something that simple, I obviously need to pay better attention to syntaxes and the like!  Thanks for your quick response =)

Link to comment
×
×
  • Create New...