I have a video clip and a camera animation in fbx, both with 25 fps. I need them perfectly in sync, so I switched off Resample Curves and Animation Compression in import settings, and additionally I cloned the animation so I could edit it in Animation window and I selected all the keyframes and set it to Broken, Both Tangents constant.
I use the new Video Player for displaying the video. I saw that animation pipeline changed from version 5.5 to 5.6 and I got weird object movement when I imported fbx to Unity 5.6, and also Animation window kept freezing when I tried to edit keyframes, so I set up everything mentioned above in 5.5 version and opened it in 5.6 just to add Video Player.
They were still not in sync, so I wrote a script to set animation time according to video time inside Update() function:
if (cameraMovement.IsPlaying("cameraMovementFromFBX") && vPlayer.isPlaying) {
cameraMovement ["cameraMovementFromFBX"].time = (float)vPlayer.time;
}
And even if the time seems in sync, visually they still don't look right, there is a slight jitter and the difference increases with time.
I'm totally new to Unity, so I have no idea if what I'm trying to do is even possible, because of the various frame rate Unity uses. Any hint would be great.
Related
I am currently trying to find a way to have images bouncing around the page while rotating. So far, I have succeeded in the bouncing part: The code in action. However, I am still struggling with the rotating part: The source code. I believe the problem has something to do with rotating the image data. I have have heavily researched rotating canvas data, yet the however the bug still eludes me. Could anyone shed light on this mystery.
By the way, I know that the lag could be greatly improved by preloading each image before the image is inserted onto the canvas, but I don't want to over-complicate the code until I can get the basic lay-man version to work. So now that I have examined this, please don't post about it because it's not exactly on topic.
My 2nd smaller question is this: I have observed that, in Google Chrome, when I modify the frame rate to anything other than 60 fps, then there is a MASSIVE decrease in performance: 59 fps or 60-Math.pow(2,-16) fps appears a lot slower than 60 fps. I know that it can't be because on my monitors display rate because my monitor's display rate is 59 fps, not 60 fps. So, is it because Google Chrome recognizes and optimizes 1000/60, or what? Please include a link to the documentation if possible.
EDIT
The links have been moved to the final product displayed here.
There is no native way to rotate a Uint8ClampedArray
To rotate an image once it has loaded.
// ctx is the 2D context. Image is drawn at its center point.
function drawRotated(image,x,y,scale,rot){
ctx.setTransform(scale,0,0,scale,x,y); // set scale and origin
ctx.rotate(rot);
ctx.drawImage(image, -image.width /2, -image.height / 2);
ctx.setTransform(1,0,0,1,0,0); // restore default transformation
}
I am not at all sure what you are saying about the frame rate. A monitor with a frame rate of 59 is very unusual. As you have not shown what you are doing I will assume you are not using requestAnimationFrame
The following will sync to the browser refresh rate.
function mainLoop(){
// code to render the frame
requestAnimationFrame(mainLoop);
}
requestAnimationFrame(mainLoop);
I have a window displaying a video stream with a twitter feed as an overlay.
When a new tweet is displayed, the current tweet animates out using a rotate animation and the next tweet is rotated into view. The animations are performed using a RotateTransition.
The app also switches between different cameras to display different streams. To give an indication of when the app switches to the next camera, I have a progressbar that fills using a Timeline object.
This works well, until I resize the window. The rotate animations start to flicker, along with the progressbars as they gradually fill.
As a test, I disabled the video stream, to see what's happening. The 'artifact' doesn't occur then and I can resize as much as I want. If I play the stream and don't resize, everything works well.
The video player is based on VLCJ, but the actual pixels are drawn on a WritableImage in an Imageview.
See the following images that illustrate the problem.
At the bottom right you can see 2 different progress bars (a ProgresBar and a ProgressIndicator).
A part of the flickering result is still visible below the second image. It somehow stays visible, probably because the area doesn't get redrawn.
Any idea what makes the flickering happen? Is there anything I can do to fix or avoid this?
I tried some VM options in IntelliJ: -Dsun.java2d.d3d=true -Dprism.forceGPU=true to somehow enable hardware acceleration, but that doesn't seem to help.
Disabling the progressbar fill animation doesn't help either.
I had a similar problem with some arcs and shapes that would flicker when its attributes / sizes were changed.
The solution to my problem was to make sure that the methods used to change the shapes were called from inside the JavaFX thread.
Platform.runLater(() -> {
arc.setStartAngle(30);
arc.setLength(45);
}
I am currently developing a game using Unity3d , my designer gave me a bunch of images created by After-Effect which should display the character animations,
every animation have it's own pack of sprites,but my game got too slow because of the amount of images to be loaded , so i decided to use texture packer to reduce the amount of images and to create only one sprite sheet with type multiple containing all the images of my animation ,but my problem is this :
after creating the sprite sheet the animation start to have a weird behavior and does not animate correctly, images start to overlap and do not animate in the same speed despite the fact that before, the animation was working fine but heavy on my app .
the animation is done on 30fps
how i created the spritesheet :
I only imported all my assets for every animation into texture packer and export it into png file with a dimension of:4096x4096
Try to use Simple Sprite Packer plugin next time, and don't forget to compress your .pngs.
I'm currently building a 2d platformer and encountered a few problems.
My player has a script so that when the player hits a cube with a rigid body, the cube can be pushed. When the character pushes the object, the regular walking animation is displayed.
I want to play the pushing animation at that moment but cant seem to fix it. I read a lot of topics on the internet about the difference between unity new Animator editor and the older versions.
Is there a simple way to trigger the animation on hit, and how do I have to add it in the Animator? Also with witch states should it be connected?
Found it on google, maybe it will help
http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-overview
He uses a Layer for the animation of the cannon so he animates regardless of the body animation.
Coming from the iOS world where we have UIImageView and the property animationImages:
http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImageView_Class/Reference/Reference.html#//apple_ref/occ/instp/UIImageView/animationImages
Where animationImages is just an array of arbitrary animation frames. You specify the images (maybe 15), then set the total animation time (maybe 4 seconds) in one of the other properties, then just start the anim and the images in animationImages will play sequentially over the specified time with an even frame rate.
How would I do the same with WP7/Silverlight? This all Expression Blend seems wonderful, but I just can't find a way to animate the image source (I'm guessing it might be impossible). How would I do the same? Should I add a unique image object for each frame in the animation, then play around with visibility/opacity properties and manually have to create all the spaced out key frames? That sounds like a lot of extra work + overhead and not a nice way to go...
http://www.windowsphonegeek.com/articles/WP7-Animations-in-depthndash-Overview-and-Getting-Started
http://www.wearerighteous.com/wp7-development/xaml-animation-in-silverlight-for-windows-phone-7/
http://www.windowspresentationfoundation.com/?p=712
Try out these links. Especially the first one, I think the first one resolve all you doubts. In wp7 we can go for two options either XAML based (static) animations / or with the help of C# code. By using blend u can create all sot of static animation with out any issue. Here the animation is working on the basis of page frames. If u are interested in learning more about Animation try this too;
http://msdn.microsoft.com/en-us/library/cc189019(v=vs.95).aspx
You can actually animate the Image.Source property here's a tutorial.
Animating Images in WP7