Search the Community
Showing results for tags 'sync'.
-
I am new to babylon.js I set a scene with 2 objects which named as obj1 & obj2 A video with 426 frames was set as video texture for obj1 while obj2 had a 3d animation with 426 frames. They got same length 426 frames,same rate 30fps Video and 3d animation was triggered by screen tap But video and 3d animation are out of SYNC when running. Video will have 6-8 frames delay(maybe different in other devices) I hope i can figure out a way to do some advanced synchronization for them cause i do need they being synchronized. But, i tried, hardly and did not find anything useful. Hope someone can help, Grateful Thanks.
-
Hi all, Slowly making progress on my character creation game. I've layered multiple sprites, so that each sprite can be easily "tinted" to the user's preferred colour. The layers so far are added like so: Cat Body Pupil Face/Eye shape Each layer is animated. The pupil and the face are aligned, hence should be playing the same frame as each other to look correct. This works fine up until a point. The issue is, when the user selects the eye shape they desire, the two sprites go out of sync, and the animation looks something like this: This is the relevant code to trigger the event: facekey = 'catfacegoth'; create function; player = this.physics.add.sprite(200, 370, 'whitecat').setInteractive().setDataEnabled(); playereyes = this.physics.add.sprite(260, 350, 'cateyes').setInteractive().setDataEnabled(); playerface = this.physics.add.sprite(260,350,facekey).setInteractive(); normaleyeicon.on('pointerdown', function (pointer, normaleyeicon){ facekey = 'catface'; console.log('normal face'); }); gotheyeicon.on('pointerdown', function (pointer, gotheyeicon){ facekey = 'catfacegoth'; console.log('goth face selected');}); update function: player.anims.play('default', true); //body animation if(facekey == 'catfacegoth'){ playerface.anims.play('gothblink', true); // face/eye shape playereyes.anims.play('blink', true); //this is the pupil layer } if(facekey == 'catface'){ playerface.anims.play('faceblink', true); // face/eye shape playereyes.anims.play('blink', true); // pupil } My suspicion is that the pupil isn't restarting from frame 0 when the facekey variable is changed, but rather continues playing from the current frame. Is there a way to "reset" the current animation so that they both play from frame 0 when the facekey variable triggers the change?
- 1 reply
-
- reset frame
- sprite
- (and 6 more)
-
Hi, Im having an issue with tweens. Its a bit difficult to explain, so please bare with me.. this.tween = this.game.add.tween(this.itemToTween).to({ y: y+100 }, 100); It is a quick tween over a relatively large distance that is repeated many times. If the itemToTween is moved by say 15 pixels per frame (for example), the last frame is moved only 10 pixels to exactly end at position y+100. This 10 pixel move in the last frame as apposed to the normal 15 pixels per frame is causing hiccups/staggering on the tween repeat and other running tweens on other items are becoming out of sync position wise. The only solution I could think of was maybe doubling the distance and time of the tween and then manually checking on the tween update if the position is greater than y+100. In that case stop the tween and trigger the new tween and subtract the distance the original tween shot over y+100. This seems like such a hack though... Does anyone have a suggestion on a cleaner solution? Thanks.
-
This is just me complaining (because i know no better )... BUT OH MY GOOD GITHUB... Why is it SOOOOO complicated to keep up-to-date with a fork... I go look at how to keep up to date with my fork and its HALF a page of a bunch of command line this and command like that... or setup this and that... WHY IS THERE NO BUTTON I HIT that just "Brings me up-to-date" It is WAY easier for my just to delete the fork and re-fork for a clean copy... That can't be the only way to get cleanly caught up.. IS IT
-
Hello. I'm a complete newb to Phaser. In fact, this is my first post. I have lots of experience working with animations in various platforms but never in Phaser. My goal: I want to make a character and animate its mouth in sync with a long audio clip. Basically, this character will be talking for 1 to 2 minutes at a time. The character will move and do other animations as well but the most important thing, and probably the most difficult, will be to animate the mouth for the whole sequence. My questions: what Phaser tutorials would you suggest to get me pointed in the right direction? I couldn't seem to find anything that exactly matches what I need but I'm sure I can figure it out by doing others.
-
Hi Folks, how can I syncronize a babylon walkthru scene with an audio file? Or there a solution to check the current time of an audio file to syncronize the babylon cam/actor position? Thanx
-
Hi Folks, iI try to syncronize my 3D Animation with a music track. How I can do it? Thanx
-
Hi, I'm trying to sync audio to the start of a tween. this.myTween = this.add.tween(...) this.myTween.onStart.add(this.playSound, this) Instead, the audio plays first and then a few moments later the tween starts. I read the onStart should wait until the tween starts, but this doesn't seem to be happening. Please help!
-
Hi everyone, I want to make a basic rhythm game in Phaser where the user has to hit specified keys to 'catch' the incoming notes while staying in rythm. So far the main game area roughly looks like this: The idea is that the key must be hit (and the corresponding note played) when the note sprite fully overlaps the key sprite, and the score is calculated based of how close the note sprite is to the top edge of the key sprite. I have an array of percussion loops with various BPMs I made in a DAW which change after each level to increase the difficulty. When the level starts this function is called: beginPlaying: function(l){this.noteCount = 25;this.currentLoop = this.loops[l];this.currentLoop.play();this.maxInterval = this.currentLoop.durationMS/4;this.timer.add(0, this.generateNotes, this);this.timer.start();},generateNotes function goes like this: generateNotes: function(){if(this.noteCount > 0){var num = this.game.rnd.integerInRange(0, 4);var note = this.notes.create(this.noteFlags.getAt(num).x, this.game.height - 20, 'note');this.game.physics.arcade.enable(note);var distance = note.y - this.noteFlags.getAt(num).y;note.body.velocity.y = -(distance/(this.currentLoop.duration/2));this.noteCount--;this.timer.add(this.maxInterval, this.generateNotes, this);}},I'm planning to make it more complicated by spawning notes not only at maxInterval, but so far I'm facing a problem: even though the first few notes seem to land perfectly in rhythm with the currentLoop, later they stop keeping up with the drums and the whole thing goes completely out of sync. I suppose this has something to do with the sound duration in ms and the fact that this.maxInterval is not a whole number. I tried rounding the numbers using Math.round and Math.floor and I also tried alternative methods of calculating note positions, like n.y -= (distance/(this.currentLoop.duration/2))/60;called using this.notes.forEachAlive method from the update function. Right now I'm completely lost (I guess that's the price you pay when you start programming while not being very good at maths ). Is there any way to deal with the audio/velocity sync problem? I would very much appreciate any suggestions Thanks!
-
I want to sync animation with sound , for example i have a character and i want to animate his mouth only when narration is palying , and mouth should be shut when there is gapes in the narrations what i am doing is i am using currentTime sound property to check if sound reaches certain position in the update function but it is not working for me as update function called with certain interval and when this function called sound time is less or more then what i am testing in the if condition , that is why this condition never full fill , and if i set if condition as >= then the commands keep executing again and again as condition remain full fill for the rest of the sound time please let me know how i can synch animation with sound update: function () { if (this.narration.currentTime == 1380) { this.mouth.animations.stop(); } if (this.narration.currentTime == 11879) { this.mouth.animations.play('talking', 25, true, false); } }
- 3 replies
-
- sound
- animations
-
(and 1 more)
Tagged with: