Skip to main content

Search

How do I delay a signal by 1 frame?

  • mmdev7

    If you wire an inverter into itself it will send a pulse every frame (I think) so you can wire this into a selector and you can now delay your logic by however many frames you need to. Just pass your original signal into the power on the inverter to start the delay.

    I have never needed to do this though. What are you trying to achieve? It might be that there is a simper way to achieve it.

    Hope this is helpful :) Peter

  • phort

    A NOT gate plugged into itself will send a pulse at 15hz rather than 30.

    I have an emitter that emits a particle at its current position every frame, but I wanted the particles closer together. So I duplicated the emitter so I had 5 of them, and used a Lerp function to interpolate the previous position and current position of a tag by evenly spaced factors to get the particle emission positions as close together as I wanted. To do the interpolation, I needed to be able to have both the current and previous frame's position signal.

    Wiring the signal through an Exclusive Gate gave me the delayed signal I wanted, but like I mentioned it uses global state which I want to avoid so I could have more than one of this same object in the scene.

  • mmdev7

    Ah Ok, I kinda see what you are trying to achieve now.

    You can use the NOT gate (plugged into itself) technique with 2 emitters. One that is triggered when the NOT gate is on and one when it is off.

    So now you have an emitter during every frame and you won’t need to change the positions of any objects (as that sounded super expensive)

    Hope that helps :) Peter

  • phort

    It's not as expensive as you think. There's no mover on the shape I'm emitting: The emitter gadget itself has a transform input that lets you set where you want the object before it's emitted.

    Emitting every frame was not a problem, as that can be achieved in the emitter's settings. I wanted to emit more than once a frame, at the positions the emitter passed through *between* frames.

    The real expense is the number of objects I'm emitting, which is something I anticipated and planned for.

    Anyway I think I thought of an alternate way of delaying the signal, so I'll probably put that together and add it to my logic collection: https://indreams.me/collection/Yz-fNRWjiqc

    Thanks for the response Peter.

  • jgr9

    Wireless causing a delay is making things really confusing for me. Like I had to send a wireless signal to a receiver on the same object to time it with other logic that was after the wireless signal that actually went to the other wireless object. Wth?

    And I finally got 1 of my wireless objects fully hooked up and functioning, but then duplicating it breaks it. B-|

Please sign in to leave a comment.