New answers tagged

0

It sounds like it greatly depends on your game and where you want to go with it, but here's my 2 cents: I don't think you should include translation or rotation into the animations themselves. Rotation should probably be saved for orienting the character in the proper direction (in Street Fighter this is usually left or right). Baking in the animation ...


0

Is your player's rotation always controlled by animation, and is there a rigidbody attached to the child object? If so, this would explain the discrepancy you are seeing. The values you see in the inspector will be after the animations are applied, while the values you get during Update will be from before. Do you get different values in your replay ...


-1

Erm. Well, this is more of an art question, but either of two answers should work. You can make a single sprite that appears to be separating, and then after the last part, 2 separate entity sprites. Or you could have two entity sprites that look attached by overlapping animations. As for the art part, that's up to you.


1

I can't understand your question but refer this URL to Create more then animation to one gameobject https://www.youtube.com/watch?v=O_0gZuqW6y8 https://www.youtube.com/watch?v=giSjcA109CE https://www.youtube.com/watch?v=MtJhZ4pJXlM


0

If possible, you could have 1 animation running on the actual object, and run the second on a parent object, since all the values in the parent object automatically transfer to the animating object. Just make sure that the parent animation doesn't use the child object for one of the animating "properties".


1

Animator.Play() works with the state in the Animator not the actual animation. I'm guessing you are not returning from the Flip-Forward state. Make sure to create a transition from to that state back to the default state and that the transition Has Exit Time property be ticked. This is a simple example of how the state machine should look. However I ...


3

Here: perlin.lerp(v, perlin.lerp(u, perlin.grad(self[AB + 2], x , y , z - 1), This should have AA + 2 instead.


0

The usual way to animate 2d graphics is the good old method we use since the first days of animated cartoons: draw a separate graphic for each step of the animation and then display them in a loop. To get the animation phases right it often helps to look at the real thing and study how it moves.


3

There are two common ways to animate something. One of them is what you described: morphs or per-vertex animation. You have number of different models representing each frame in your animation, and you interpolate the position of the vertices individually between the previous frame and the next to achieve smooth animation. This technique is usually applied ...


0

You can define an integer value to use as counter, meaning how long the user has kept his finger on the screen to track a long press: int timer = 0; Then, you're going to detect just an event - the mouse pressed event - and increment the timer at your will: void Update() { // Increment the timer if (Input.GetMouseButton (0)) { timer ...


0

If you measured the time in ms from the start of the animation, the formula would be: var frame_nr = Math.floor(FPS * time / 1000); This way if your time was say 500 [ms] and your FPS was 60, the frame_nr would be 30. You'd need to handle the case when the frame_nr exceeds your animation's length. If you wanted the animation to loop, you could use the ...


0

you should use Scriptable object using UnityEngine; using UnityEditor; using System.Collections; [CustomEditor(typeof(TestManager))] public class TestManagerEditor : Editor { #region Variables TestManager targetMgr; string path = "Assets/Database/Data.asset"; #endregion #region Main Methods // Use this for ...


2

You can override the size of the enum, if needed: enum CombatMove : int //implied, 32-bits, max value 2147483647 { RightMiddleJab = 0, //0 LeftMiddleJab = 1, //1 RightUpperJab = 3, //3 LeftUpperJab, //4 } And since you can cast them, there is probably no reason to refer to them by name: CombatMove combatMove = CombatMove.LeftUpperJab; ...


1

I would decouple the different concepts, and having 3 systems with separate goals: Position/Render system: updates/applies the visual position of your object every time this is rendered (60Hz) Logic system: takes decisions like "now I want to go towards point B" (15 Hz) Motion (or similar) system: "translates" the decisions taken by the Logic into whatever ...


0

If you go to the definition of AnimationCurve (F12 in VS), you'll see that it is not marked [System.Serializable] and no amount of coaxing will change that. When you change your code and go back to the editor, everything that was there is Unity.Serialized() (don't look for it; not a real thing) to native, the new managed code is loaded, and then the old ...


1

You can do this by storing the AnimationCurve variable in a ScriptableObject. Unlike MonoBehaviours that are attached to GameObjects, ScriptableObjects are created as scene independent assets, so they're not reset when exiting playmode.


1

You cant save complex types in PlayerPrefs. You can only save floats,ints and strings. I suggest you search online for a way to serialize the AnimationCurve object. Maybe you can use a binnary formatter like here. In one of my projects i used ProtoBuff to serialize my own classes and it works great on both android and iOS. Here is a nifty tutorial


1

Would this do it? enum CombatMove { RightMiddleJab, LeftMiddleJab, RightUpperJab, LeftUpperJab, LastCombatMove, Unknown } call example.. CombatMove move; if( findCombatMove("RightUpperJab", out move) == true ) { // do something with move int intValue = (int)(move); } . ...


0

Well, I don't know why you get this tearing. Perhaps the spritesheet itself is too small and unity is messing up. I suggest you try two things to solve your problem. 1. Up the resolution of the sprite and see if that solves the problem 2. If the animation is bobbing up and down you dont need a frame by frame animation. Just animate the transform component ...


0

Your code is fine as is, maybe some lines can be written better and optimizations are possible. But it does work. The reason your character animation glitches is because of the related collision mask. When your character runs, his legs move and - right like in real life - there's a brief moment when both of them aren't touching the ground. Because of the ...



Top 50 recent answers are included