2D animation is going reverse - animation

hi guys i am working in 2d game . i have created 2d animation in animation tab . it is working fine with normal speed but when i increase the key frame rate or animation speed in animation state option. it starts going in the reverse direction my animation is from let say (-100 to 0 to 100) . i have tried all the interpolation options Euler angle quaternion and Eular angle (quaternion approximation ) in animation tab but nothing fixed my issue what is possibly i m doing wrong?
thanx in advance.

Related

Get position from Translation and Scale Matrix (Direct2D)

I have a 2D camera defined by Direct2D 3x2 matrix like this :
ViewMatrix = ScaleMatrix * TranslationMatrix;
But when trying to do hit testing, I get at a point where I need to know my X,Y camera coordinate. I tried to keep track of hit in a vector but without success, scaling with offset center complicate a lot the work..
So I guess it should be possible to find my camera coordinate from these two matrix right ? But how ?
Thank a lot for help.

Flip 2D asymmetric animation in Unity3D

I want to flip my 2D character (asymmetric) from right to left using the animator in Unity3D
I have the sprite sheet with both left and right sprites and I did a controller with the animations facing right, now I need to flip the animations to the other side
Done:
Sprite sheet with both animations left and right
Animation controller with animations facing right
Goal:
Make my character change animations facig right to facing left and viceversa
I'm aware of the code to change the local scale, but I'm not interested in changing scale, I'm looking for a way to flip the animation
Thanks
You can flip the animations changing the x/y scale from positive to negative. Why you are not interest in changing the scale? You can flip the animations with this method.
Sorry for my English and good luck.

Rotational Circle in JavaFX

I'm creating an application which consists a simulation for uniformly rotational circle with decreasing acceleration. But it does not have to be exactly like in Physics. And I'm using JavaFX. I'm using Animation and Timeline in JavaFX. However, as far as I know, they just create animation in a fixed duration. However, my application requires that the circle decreases its speed to zero and then stops.
Any idea or clue on how should I do that. I really appreaciate your help!
Edit: If I need to rotate the circle according to the initial mouse speed. How shoudl I do that?
Use a RotateTransition and specify a custom interpolator.
I don't use JavaFX, but there should be something like a 'rotate(degrees)' method somewhere. If so, just rotate it a little less every frame until it stops. Here are some psuedo-code:
float degrees = 60;
JavaFXThing thing;
//Every frame
while (true){
thing.rotate(degrees);
thing.draw();
degrees -= 0.05;
}
Hope it helped!

How to properly flip 2D character with new Unity4.3 2D framework? (Rotation of gameobjects during animation)

i'm already checked official Unity 4.3 example project, and there they use
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
This works pretty well, but. But i'm encountered an trouble, not sure this trouble with this Flip or with something else.
I'm use Animator to animate my characters, i have Attack animation, which in addition to the sprite animation also move character's Hand, which can carry the Weapon. Problem is when i flip the character to opposite direction Hand will move wrong (not as planned), which is wrong. (video below will be more descriptive)
I discovered that this problem occure only if i modify the Hand's rotation in animation, so if i works only with .position this works well, but i need the rotation!
What is best way to get this work?
Here the youtube video: http://youtu.be/qpMK2gRgDz8
At video i show animation without rotation uses, hand moves correct. But next i show it with rotation, as you can see when character turned right this works well, but when left, its completely wrong.
What you want to do cannot be done with scaling cause scaling does not change the rotation of the object and so the forward vector remains the same. You must create double sided objects and just rorate them 180 degrees or you can ue a shader that draws a polygon even when its normal vector is against the camera.

Getting coordinates of the mouse in relation to 3D space in THREE.js

I have struggled for the past 3 weeks trying to figure this out. If anyone could help me I would appreciate it so much.
I'm developing a game similar to Geometry Wars in where I have a triangle in the middle of the screen which you can move around.
The problem is I need the triangle to rotate and face toward the direction of the mouse curser. I don't need to worry about the z-axis per-say as I always have the camera in a fixed position (z=500) and I am treating the scene as a "2D scene" - all the action occurs on the z=0 plane.
Calculating the angle between the triangle and the mouse is elementary:
targetAngle = Math.atan2(mouseCoord.y-this.position.y, mouseCoord.x-this.position.x)
where this is the mesh.
The problem is that the mouseCoords are in standed Dom window format whilst the position of the triangle is in Three.js format.
Q) How would I convert the mouse coords to represent the coords on the z=0 plane where the triangle is?
I have tryed so many ways including ray intersection but nothing works ;(
Thank you all for your help and thank you so much for an amazing framework!!!!
I don't actually see the problem. use the THREE.vector3 with the z coord in 0. then use something like triangle.rotate(THREE.vector3(targetAngle,0,0) or something
I suspect your intersection isn't working because of a CSS offset by your canvas within the DOM.
If you need the triangle to look at something specific, you should simply be able to use the "lookAt" method of the triangle.
To have it look at the camera for example:
triangleMesh.lookAt(camera.position);

Resources