jmitchell
Junior Member
Posts: 31
Threads: 6
Joined: Feb 2015
Reputation:
2
|
Animated Gobos and Timing
Hey there! I have a question regarding Gobos and the HPL engine timer.
I'm trying to use an animated gobo for a scare; it's supposed to cast a moving shadow on a wall opposite the player. Problem is, whenever I hit the trigger that's supposed to start the animation, the animation seems to start at a random frame each time.
It doesn't look like I can control the animation directly. In order to "start" it, I have two spotlights in the exact same position, the first one casting the first frame as a static gobo, and the second, which actually handles the animation, is disabled by default. When the player activates a trigger, the first spotlight is disabled, and the second is enabled. That way, the animation doesn't start until the player gets to the area I want them at.
As I mentioned, though, the animation starts at different points each time. My guess is that animated gobos are updated even if their lights are disabled, so it's completely dependent on the engine's current time.
My question is: is there a way for me to get the engine's current time, so that I can pass that to a timer function? Or is there a way for me to set the animation frame/time in Angelfire that I'm neglecting?
Thanks for your help!
|
|
03-07-2015, 03:56 AM |
|
MrBehemoth
Senior Member
Posts: 408
Threads: 19
Joined: Feb 2014
Reputation:
40
|
RE: Animated Gobos and Timing
Do you mean angel script?
Seems like the animation is already playing when the light switches on. If that's the case then I'm not sure what you could do about it.
As for the game time, do you want that so that you can trigger the spotlights to switch at the start of the anim? What you could do is have a looping timer that's first called in OnStart() and lasts the same time as the anim, so that you have a function call every time the anim starts over. It would then check that everything is ready, ie the player is position or whatever, and then switch the spotlights. Would that work for you?
|
|
03-07-2015, 04:12 PM |
|
jmitchell
Junior Member
Posts: 31
Threads: 6
Joined: Feb 2015
Reputation:
2
|
RE: Animated Gobos and Timing
Yes, I meant AngelScript. Sorry, I was pretty tired.
Your OnStart() idea seems pretty good. My only concern is that running it constantly seems wasteful. Would that adversely affect the framerate?
|
|
03-07-2015, 06:29 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Animated Gobos and Timing
Well, it probably won't considering it appears the animation is already running in the background regardless. A timer shouldn't lag you out unless it updates more like 100 times a second or if you have anything heavy in it at a frequent pace.
|
|
03-07-2015, 06:52 PM |
|
jmitchell
Junior Member
Posts: 31
Threads: 6
Joined: Feb 2015
Reputation:
2
|
RE: Animated Gobos and Timing
Good point, Mudbill.
Alright, I've implemented the timer, and after some tweaking, it works! The animation starting and the OnStart() function don't seem to be called at the same time, though, so it consistently starts at around Frame 4 or 5. I'm sure I can tweak that for better results.
Thanks, guys!
|
|
03-07-2015, 07:10 PM |
|
MrBehemoth
Senior Member
Posts: 408
Threads: 19
Joined: Feb 2014
Reputation:
40
|
RE: Animated Gobos and Timing
(03-07-2015, 06:52 PM)Mudbill Wrote: Well, it probably won't considering it appears the animation is already running in the background regardless. A timer shouldn't lag you out unless it updates more like 100 times a second or if you have anything heavy in it at a frequent pace.
Actually, I don't think it can go any faster that 60 times per second, because that seems to be how fast the engine "thinks". If you looped at 120 times per second, it would just mean that looped twice then 1/60 seconds later it would loop twice again.
You would have to do a lot of intensive calculations to actually cause any lag. I recently had a loop that assigned 1000 random floats 60 times per second and my PC wasn't even out of breath. Obvs that could be different on lower end systems and the other issue is the apparent limit discussed elsewhere. Speaking of which, I should get back to work.
|
|
03-07-2015, 11:19 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Animated Gobos and Timing
Well, setting a variable (or 1000) is probably not very intensive considering the game probably does that all the time interally. But I know slower loops can lag if they do something "heavy." For instance, the video tool I have can cause lag with high resolution and high framerates. It has to do with the engine rendering those images quickly.
|
|
03-07-2015, 11:37 PM |
|
|