Page 1 of 1
timer interval limit
Posted: Wed Feb 11, 2015 1:18 am
by Granamir
I'm trying to make a will'o wisp, and to make movement smooth i increment it by 0.001, this way they move smoothly but very slowly, so i tryed increase (or better decrease) timer interval but lower than 0.01 nothing change.
Has anyone encountered same thing?
Has anyone any idea to make smooth but fast movements?
Re: timer interval limit
Posted: Wed Feb 11, 2015 1:23 am
by minmay
In Grimrock, timers will not activate more than once per update, and updates will not happen more than once per frame. (Off-level components update only on a fraction of frames). Physics are also variable-timestep. To accomplish smooth movement you should use a timer with a very short interval like 0.001 so it will activate once every frame, and use Time.deltaTime() to advance your physics each frame.
Re: timer interval limit
Posted: Wed Feb 11, 2015 1:26 am
by JohnWordsworth
EDIT: First comment removed - Good Spot MinMay - This won't work when the user is holding the right mouse button down to look around!
Note, anything done every frame, or in a high resolution timer, needs to be CPU light for performance reasons!
Re: timer interval limit
Posted: Wed Feb 11, 2015 1:50 am
by minmay
JohnWordsworth wrote:If you know you really want something to advance / evaluate on every single frame, then adding an onDrawGui hook guarantees your method is called each frame.
Actually, it doesn't. onDrawGui is not called if the player is free-looking or (IIRC) viewing the automap. And free-look can be used at almost any time, so this method is not really useful for much at all.
So far attaching a TimerComponent to the party with a short interval has worked perfectly for me. (You attach it to the party because components not on the party's level may not be updated, and the party, surprisingly, will always be on the party's level.) I expect using an onUpdate() hook on a CameraComponent or LightComponent would also work, I can't really decide which of these two methods is uglier.
Re: timer interval limit
Posted: Wed Feb 11, 2015 1:22 pm
by Granamir
Thank you guys...
...trying to understand how delta time works but seems with no results.
Can u help me? Ty
Re: timer interval limit
Posted: Wed Feb 11, 2015 7:17 pm
by Zo Kath Ra
Granamir wrote:I'm trying to make a will'o wisp
As a monster or as decoration? (like the fireflies)
Re: timer interval limit
Posted: Wed Feb 11, 2015 7:35 pm
by minmay
Granamir wrote:Thank you guys...
...trying to understand how delta time works but seems with no results.
Can u help me? Ty
Time.deltaTime() returns the amount of game time elapsed since the previous frame.
Re: timer interval limit
Posted: Thu Feb 12, 2015 1:42 pm
by Granamir
Zo Kath Ra wrote:Granamir wrote:I'm trying to make a will'o wisp
As a monster or as decoration? (like the fireflies)
I started to make them as decoration (and 'til now that they are)...but maybe i'll decide to make them as monster too, have to check how much difficult is creating a monster.
Re: timer interval limit
Posted: Thu Feb 12, 2015 1:46 pm
by Granamir
minmay wrote:Granamir wrote:Thank you guys...
...trying to understand how delta time works but seems with no results.
Can u help me? Ty
Time.deltaTime() returns the amount of game time elapsed since the previous frame.
Thank you.
I'll try to figure out how to use it.
Re: timer interval limit
Posted: Sat Feb 14, 2015 11:28 pm
by Granamir
it's done
u can find it here:
viewtopic.php?f=22&t=9522