Home LittleBigPlanet 2 - 3 - Vita - Karting LittleBigPlanet 2 [LBP2] Help!
#1
simplest way to make pulse fire so it fires immediatley and every second?
Archive: 10 posts
i want to make it so holding down a switch triggers an event every second, but it also must fire immediately when the switch is pressed every time it is pressed. it seems like a simple function but i cant come up with an elegant way to do it. so far ive used an 'or' switch where one input handles the immediate trigger and the other input handles the ones that occur every second. that strategy has lead to issues though with what im trying to do with it. i feel like i may be overlooking something obvious. helps appreciated, tx | 2011-12-31 20:45:00 Author: unnatural Posts: 51 |
You could use a 30 port selector where each output is wired to the subsequent input. If you use a 1 second timer instead of a 30 port selector the reset incurs an additional frame of latency, so instead of outputting a signal every 1 second it outputs every 1.033 seconds, which is unforgivably inaccurate. http://i92.photobucket.com/albums/l37/Corporeal/e82bf119.jpg As long as the button is held down it will output a signal to the node every second, immediately following player input. If you want the player to be able to interrupt the selector at any time you could just wire the player input (and signal output) to the 30th port since the last port on a selector takes priority. I believe other methods will use more than 1 component so this is likely the simplest way. | 2011-12-31 21:39:00 Author: Ayneh Posts: 2454 |
can u explain how the selector makes the first event occur immediately, then each one after occur every second? also that technique keeps an output active at all times which isnt what i need. im trying to make a walking animation that is 2 frames. every time the event is triggered u see the first frame of the step for .2 seconds, then the character goes back to neutral for a minimum of .2 seconds (a start count down timer disables all inputs for .4 seconds when the character steps so nothing else can happen during the step, the first frame of the next move destroys the neutral pose frame). so tapping the button should immediately set off animation, and holding down the button should cause the animation to go off every .4 seconds (i used one second in my original post arbitrarily). but every system i try comes with imperfections that break the gameplay in some way. right now i have start count down timer (disables inputs during step) to a self resetting counter to one going to an 'or' switch. on the other 'or' switch input i have a forwards/backwards timer at .4 that triggers all the subsequent steps. this is the closest ive gotten, but if the player mashes the input button on the controller in just the right way, the animation breaks. ive designed other ways i thot should work using a start count up timer, but for some reason itd skip the second step when holding down the input. | 2011-12-31 23:34:00 Author: unnatural Posts: 51 |
Ouch, that selector-based timer is soooooo lame! Nah, seriously, use timers. And funny fact : timers aren't precise, so the 1-sec timer is actually one frame less than it should be... Which means having it reset itself will make it a perfect 1 second. http://wiki.lbpcentral.com/Talk:Timer for a list (very useful). (* In this system the "activating logic" is a 1-frame signal. If it isn't, just make a pulser [max 1 counter hooked to its own reset] and use the pulser's output instead) You need a 3-frame counter. Hook the activating logic to the second input. Then hook the second output to a counter set to max 1 and connected to its own reset. Connect this counter to the 3rd input of the selector, and hook the 3rd output to a timer set to 1sec. Place a OR gate. Connect the timer and the selector's first output to it. Then hook the OR gate to the timer's reset. (Do it step by step, it's simple when you see it) Place a NOT gate and hook the activating logic to it, then connect the NOT to the selector's 1st input. Place a OR gate. Connect the timer and the counter to it. WHAT HAPPENS ? (let's say you're using this on an emitter set to one-shot to shoot projectiles) The logic is off, selector on option 1 You activate it, selector goes to option 2. It triggers the pulse, which transmits its signal to the OR gate, and it shoots one projectile with the emitter. At the same time, it goes to the selector's 3rd option, which starts a timer. Exactly 1 sec after the first projectile was shot, the timer resets, and it shoots another projectile at the same time. It takes another second to shoot, and again. Then, when the timer is on middle position, you decided to stop shooting, so you release the trigger, which sends a ON signal with the NOT gate. It shifts the selector back in option 1 and resets the timer. You could do something similar without the selector, but it would actually shoot the second projectile 0.9333 sec after the first one EDIT : oh, the timer is set to POWER in this system, and to help you understand, 1 second is 30 frames (though a timer has this error where 1s is 29 frames, but here it helps us!) | 2012-01-01 00:53:00 Author: Unknown User |
can u explain how the selector makes the first event occur immediately, then each one after occur every second? also that technique keeps an output active at all times which isnt what i need. When no button is pressed it will naturally rest on the last bottom most position, when the top input is activated it will instantly pulse the node then cycle back to the bottom, each step taking one frame (0.033 secs). If the input is held on it will instantly pulse the node and cycle to the bottom but because the input is still active it will pulse again and continue going around till the input becomes inactive. Also this method requires it to cycle to the bottom after each activation therefore it will prevent it from being interrupted by another activation withing the cycle. to work out how many ports you need just multiply your 10ths of a sec by 3. So 0.4 secs would b a 12 port selector Ouch, that selector-based timer is soooooo lame! Nah, seriously, use timers. And funny fact : timers aren't precise, so the 1-sec timer is actually one frame less than it should be... Which means having it reset itself will make it a perfect 1 second. http://wiki.lbpcentral.com/Talk:Timer for a list (very useful). better off not worrying about the inaccuracies and just use a single selector. as he said the one second was just an example so the timer would become more hassle than it's worth, not to mention more components too | 2012-01-01 01:07:00 Author: evret Posts: 612 |
But, the selector looks lame, with all this circuitry... Ah, I guess you are right on that, but I still prefer timers, because that's what they were made for. And he said to use the selector to prevent the additional frame of the timer, so I replied that the 1sec timer is actually one frame less than 1 sec, so there's no problem. Even if you actually probably really don't matter about this delay ^^ I were just saying. | 2012-01-01 01:55:00 Author: Unknown User |
tnx guys. the selector with 12 outputs works wonderfully. | 2012-01-01 04:00:00 Author: unnatural Posts: 51 |
Why make everything so complex? Just stick a battery on a looping 1 sec sequencer, hook it up so that holding the trigger starts the sequencer and releasing it (NOT gate) resets, and you're done. | 2012-01-01 14:24:00 Author: Ungreth Posts: 2130 |
Why make everything so complex? Just stick a battery on a looping 1 sec sequencer, hook it up so that holding the trigger starts the sequencer and releasing it (NOT gate) resets, and you're done. Out of interest: why would you prefer using a sequencer for this instead of a timer? OP may want to add an additional timer that determines the cooldown time on the trigger. Else, instead of using auto-fire, the player could bash the trigger and create a far more rapid firing rate than the auto-fire. Unless that is what you want, of course. | 2012-01-02 15:23:00 Author: Antikris Posts: 1340 |
Out of interest: why would you prefer using a sequencer for this instead of a timer? I generally prefer sequencers to timers for many applications, but the exact reasons for this have become lost to me over time. I just go on the basis of generalised memories of past experimentations where sequencers often turned out to be the more versatile, less problematic option. Logic for me is more instinct than intuition and I often go with options that just feel right, without fully understanding why. | 2012-01-02 15:56:00 Author: Ungreth Posts: 2130 |
LBPCentral Archive Statistics
Posts: 1077139
Threads: 69970
Members: 9661
Archive-Date: 2019-01-19
Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.