timer interval limit
timer interval limit
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?
Has anyone encountered same thing?
Has anyone any idea to make smooth but fast movements?
Re: timer interval limit
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.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: timer interval limit
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!
Note, anything done every frame, or in a high resolution timer, needs to be CPU light for performance reasons!
Last edited by JohnWordsworth on Sun Feb 15, 2015 12:15 am, edited 1 time in total.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: timer interval limit
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.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.
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.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: timer interval limit
Thank you guys...
...trying to understand how delta time works but seems with no results.
Can u help me? Ty
...trying to understand how delta time works but seems with no results.
Can u help me? Ty
- Zo Kath Ra
- Posts: 944
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: timer interval limit
As a monster or as decoration? (like the fireflies)Granamir wrote:I'm trying to make a will'o wisp
Re: timer interval limit
Time.deltaTime() returns the amount of game time elapsed since the previous frame.Granamir wrote:Thank you guys...
...trying to understand how delta time works but seems with no results.
Can u help me? Ty
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: timer interval limit
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.Zo Kath Ra wrote:As a monster or as decoration? (like the fireflies)Granamir wrote:I'm trying to make a will'o wisp
Re: timer interval limit
Thank you.minmay wrote:Time.deltaTime() returns the amount of game time elapsed since the previous frame.Granamir wrote:Thank you guys...
...trying to understand how delta time works but seems with no results.
Can u help me? Ty
I'll try to figure out how to use it.