Unity animation moves a game object. Should I create all my animations again from the scratch?

Unity animation moves a game object. Should I create all my animations again from the scratch? Or how can I fix the issue?

I recorded approximately 15 animations in Unity. Now I try to animate in place and simultaneously use the physics engine of Unity to move game object. But I found out that the animations actually change position of my game object.

I tried to follow the advice from here:

I came across with the same problem, and I fixed it with parent game object. But, there is a small trick: Create a new game object inside your problematic game object, the new game object gets the parent (0,0,0,) coordinates and this will be the origin coordinates. Then, put the old game object as a child to the new one and make all the positions as you like. Try a few times and you will get there.

But the result was just the same. The game object still changes its position during animation. So, now I am afraid that I will have to start everything over again and do animations once more. Last time it took me two weeks to complete all the animations. So, I am hoping to find another solution, which would help to fix my problem without remaking all the animations.

enter image description here

I’m having trouble with SetBool and animations on Unity. Can anyone help me?

I’m trying to get a Skeleton Model to go from its walking animation to its idle animation using a bool that checks for input. Currently, in-game, the skeleton doesn’t leave it’s walking animation and stays in it even when not walking. I’ve posted my code below. I’m kind of stumped so if anyone can give me some guidance it’d be greatly appreciated.

public class SkeletonMove : MonoBehaviour {  private float velocity = 5f;  public bool _isWalking = false;  Vector2 input;  void Update()     {         GetInput();          if (Mathf.Abs(input.x) < 1 && Mathf.Abs(input.y) < 1) return;          // CalculatedDirection();         Rotate();         Move();     }  void GetInput()     {         input.x = Input.GetAxisRaw("Horizontal");         input.y = Input.GetAxisRaw("Vertical");     }  void Move()     {         _controller.Move(transform.forward * velocity * Time.deltaTime);         _anim.SetBool("Walking", _isWalking);           if (input.x != 0 || input.y != 0)         {             _isWalking = true;         }          if (input.x == 0 && input.y == 0)         {             _isWalking = false;         }            //transform.position += transform.forward * velocity * Time.deltaTime;     } 

UE 4.25.3 – can’t make layered animations to work

I want to make my character’s upper body animations not connected to the lower body. For example, I have this set of animations: Running Jumping Crouching Kick Sliding Idle with sword Sword attack

I need the idle with sword and sword attack animations override upperbody for every other animation, but the slide and kick. So, I want my character to hold his hand with the sword in front and do sword attack even while running and jumping.

I tried using layered animation like in every tutorial on Youtube. I created the upperbody slot, created a montage for my desired upperbody animation, added the Layered blend per bone node in the animBP and set the bone there, but it doesn’t work. I don’t know if I’ve missed something.

How to disable all emojis, gifs, stickers, animations and so forth (with exceptions) in all my computer systems?

I have two computer systems: PC and Smartphone.

I hold a minimalist philosophy in regards to web applications thus generally I use only two applications for written communication: Gmail and Line.

I don’t use FaceBook/WhatsApp/Instagram/AirBnb.

And yet even with the quite “minimal” general environment of Gmail and Line I often feel frustrated or annoyed from getting emojis/gifs/stickers/animations and so forth.

Being late in maybe 10 years, I asked myself why should I even consent to use these forms of communication – I think I should be given the option to decide if I want only letters or these symbols as well which I very much (yet not necessarily totally), don’t.

How to disable all emojis, gifs, stickers, animations and so forth (with exceptions) in all my computer systems?

How to make a collider the follows all the animations of a prefab?

I have attached a capsule collider with my player(prefab) and made a script so that when Space key is down it does the jump animation in Unity. But because of the collider not jumping with the player, the player gets stopped by obstacles though he visually passed it. How can I make a collider that moves with my animations attached to a prefab?

Smooth animations for multiline text

This is basically what I’m trying to achieve: https://www.plasticbcn.com/about

I have searched around a lot on the wonderful webb and tried a few Javascript and CSS animation libraries, AOS, animate.css, Velocity.js, without any luck.

I have tried to recreate the animation here – https://taylerd2.herokuapp.com/webb/

As you might notice however the animations used here with AOS seems a bit clunky.

Would be tremendously appreciative if someone could point me in the right direction to a library or show some code examples of these kinds of animations! 🙂

Understanding ticksPerSecond and duration with skeletal animations

That’s my first question here so i hope to do all correctly. From various weeks i started surfing the net about Skeletal animation aiming to add a simple animation controller into my small game engine. After following a video tutorial by ThinMatrix, i successfully added skeletal animation into my engine (i used Assimp to load a .dae file from Blender with one animation in it). Once finished all the base stuff i started thinking about how to change animations speed by a factor (like x2 x3 etc…) and here i found some problems. As i think i understand every animation is measured by a duration field (in ticks) that, as i suppose, should be at least something like 25fps (to obtain some kind of smooth animation) times animation’s length in seconds. Then for every animation there is also another field called ticksPerSecond that (as the name says) is the amount of ticks in every second.

Into my engine i’ve a data structure called Animator that contains an array of Animation objects and for each one it has a ticks_per_second and duration array. The following code shows how i took data from assimp.

animator->ticks_per_second[animation_index] = scene->mAnimations[animation_index]->mTicksPerSecond != 0 ?     scene->mAnimations[animation_index]->mTicksPerSecond : 25.f; animator->duration[animation_index] = scene->mAnimations[animation_index]->mDuration; 

If i print the two variables i get this result:

DEBUG: ticks per sec: 1.000000 DEBUG: total ticks: 0.833333 

So here is my question: Why do these variables take on these values? I am trying to explain it to myself and the idea I found is that if ticks is equal to 1 the animation would go at the same mainloop’s frame rate but, at the end, I am not sure about it and I would appreciate your help.

Guidelines/best practices for CSS hover animations in web UI

What, if any, are the accepted guidelines and/or best practices for using CSS animated transitions on hover in a web-based user interface? When does it start to simply become annoying and distracting?

I’ve noticed it showing up on some technology related blogs (example – hover over links) and also on Stack Exchange sites in some places (such as the top navigation bar on security.stackexchange.com). It seems to me like it adds a nice touch to the interface. At the same time, I think there’s probably a point at which it stops being a good thing and starts to be distracting. And some other high-profile sites, such as other SE sites (this one) and jQuery’s site (example: the accordion UI demo) don’t use it at all.

How to control JavaFX’s animations execution order when animations “queue” is being altered in run-time?

Is there a best practice regarding synchronization between GUI animations’ execution order and the user’s dynamic input?

More specifically, I would like to know how to best enforce some logical conditioning on the execution’s order. While remembering, that the user’s input can not be foreseen.

For instance, a greatly simplified example:

  • 9 rectangles are shown on a screen.
  • A click on a rectangle fades it out.
  • The user clicks whichever rectangle he wants in whatever order he likes and as fast as he feels is right.
  • The condition here breaks into two simple ones:
    • The rectangles must not fade out simultaneously.
    • The rectangles’ fade out effect occurs in the same order as their clicks.

SSCCE:

FunExperiment class:

import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.stage.StageStyle; import model.startup.Skedaddle; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;  public class FunExperiment extends Application {    private static Logger logger = LogManager.getLogger(Skedaddle.class);    public static void main(String[] args) {     launch(args);   }    @Override   public void start(Stage primaryStage) {     logger.traceEntry();      Parent rootG = new Group();      for (int i = 0; i < 9; i++) {       Rectangle rectangle = new Rectangle(90, 90, Color.GREENYELLOW);       rectangle.setTranslateX(100 * (i / 3));       rectangle.setTranslateY(100 * (i % 3));        rectangle.setOnMouseClicked(e -> {         Thread newThread = new Thread(new AnimationPlayer(rectangle));         newThread.start();       });       ((Group) rootG).getChildren().add(rectangle);     }      Scene scene = new Scene(rootG, 300, 300, Color.TRANSPARENT);     primaryStage.setScene(scene);     primaryStage.initStyle(StageStyle.TRANSPARENT);      logger.debug("Showing stage...");     primaryStage.show();   }  } 

AnimationPlayer class:

import java.util.ArrayList; import javafx.animation.FadeTransition; import javafx.scene.Node; import javafx.util.Duration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;  class AnimationPlayer implements Runnable {    private static final Logger logger = LogManager.getLogger(AnimationPlayer.class);    private static Object aLock = new Object();    private static ArrayList<Integer> order = new ArrayList<>();   private static int counter = 1;   private Integer myNumber;   private Node node;    public AnimationPlayer(Node nodeToTransition) {     this.node = nodeToTransition;     myNumber = counter++;     logger.traceEntry("Thread with number " + myNumber + " was instantiated.");   }    @Override   public void run() {     order.add(myNumber);     order.sort(Integer::compareTo);     synchronized (aLock) {       while (!order.get(0).equals(myNumber)) {         logger.traceEntry("MyNumber: " + myNumber + ", I'm gonna wait.");         try {           aLock.wait();         } catch (InterruptedException e) {           logger.error(e);           e.printStackTrace();         }       }        logger.traceEntry("MyNumber: " + myNumber + ", I'm in!, initializing animation...");       FadeTransition fadeTransition = new FadeTransition();       fadeTransition.setNode(node);       fadeTransition.setToValue(0);       fadeTransition.setDuration(Duration.seconds(1));       fadeTransition.setOnFinished(handler -> {         synchronized (aLock) {           logger.traceEntry("MyNumber: " + myNumber + ", animation is over, notifying others...");           order.remove(myNumber);           order.sort(Integer::compareTo);           aLock.notifyAll();         }       });       fadeTransition.play();       logger.traceEntry("MyNumber: " + myNumber + ", Okay, got to go, bye bye.");     }   } } 

Log after clicking 4 rectangles:

Please note that the “i” in “Thread-i” and “MyNumber: i” aren’t the same number.

18:19:18.458 JavaFX Application Thread - Enter  18:19:18.580 JavaFX Application Thread - Showing stage...  18:19:19.688 JavaFX Application Thread - Enter Thread with number 1 was instantiated.  18:19:19.690 Thread-3                  - Enter MyNumber: 1, I'm in!, initializing animation...  18:19:19.693 Thread-3                  - Enter MyNumber: 1, playing animation...  18:19:19.877 JavaFX Application Thread - Enter Thread with number 2 was instantiated.  18:19:19.878 Thread-4                  - Enter MyNumber: 2, I'm gonna wait.  18:19:20.096 JavaFX Application Thread - Enter Thread with number 3 was instantiated.  18:19:20.096 Thread-5                  - Enter MyNumber: 3, I'm gonna wait.  18:19:20.290 JavaFX Application Thread - Enter Thread with number 4 was instantiated.  18:19:20.291 Thread-6                  - Enter MyNumber: 4, I'm gonna wait.  18:19:20.708 JavaFX Application Thread - Enter MyNumber: 1, animation is over, notifying others...  18:19:20.708 Thread-4                  - Enter MyNumber: 2, I'm in!, initializing animation...  18:19:20.708 Thread-4                  - Enter MyNumber: 2, playing animation...  18:19:20.708 Thread-6                  - Enter MyNumber: 4, I'm gonna wait.  18:19:20.709 Thread-5                  - Enter MyNumber: 3, I'm gonna wait.  18:19:21.716 JavaFX Application Thread - Enter MyNumber: 2, animation is over, notifying others...  18:19:21.716 Thread-6                  - Enter MyNumber: 4, I'm gonna wait.  18:19:21.716 Thread-5                  - Enter MyNumber: 3, I'm in!, initializing animation...  18:19:21.717 Thread-5                  - Enter MyNumber: 3, playing animation...  18:19:22.724 JavaFX Application Thread - Enter MyNumber: 3, animation is over, notifying others...  18:19:22.724 Thread-6                  - Enter MyNumber: 4, I'm in!, initializing animation...  18:19:22.724 Thread-6                  - Enter MyNumber: 4, playing animation...  18:19:23.731 JavaFX Application Thread - Enter MyNumber: 4, animation is over, notifying others...  

Since all the UI manipulations happen from within the JavaFX Application Thread, all the AnimationPlayer does is enforce an order rather than taking some work off the hands of the main thread.

Is there a better and/or a more correct way of implementing said example?

How about a more complicated condition?
In order to keep my question short and readable, I omitted other conditions I had in mind. If a more interesting challenge piques your interest, please let me know and I will add it as a comment.

I understand this might be a very broad question, nevertheless, any recommendation on what should one read in order to learn more about the different options, caveats, etc… would be greatly appreciated.

CSS position Absolute and position Relative clashing with Keyframe Animations (In React Project)

Look at .h1-div (Parsa Ventures Text)

If I make the div position relative, the animation works, but the h1 moves to the bottom of the screen below the content.

If I make the div position absolute, its very responsive and is positioned where it needs to be, but animation doesn’t work.

I need the responsiveness and the animation both to work on the h1.

enter image description here

(Imports and state not included in code)

import React from 'react' function App() {     return (         <>             <Home />          </>     ) }  export default App   

Home Component:

class Home extends React.Component {     render() {         return (             <div id="mainDiv" style={{ backgroundColor: '#FFFDF8', overflow: 'auto', width: '100%', height: 'auto',  position: 'relative'}}>                      <div className="h1-div">                         <h1>Parsa Ventures</h1>                       </div>                     <img src={leftTree} alt="a"  id="leftTree"/>                     <img src={swing} alt="a"  className="swing" id="swing"/>                    <img src={mSwing} alt="a" className="m-swing"  id="mSwing" />                     <img src={leftRope} alt="a"  className="left-rope" id="leftRope"/>                     <img src={rightTree} alt="a" className="right-tree" id="rightTree"/>                       <div className="pillow-a"  >                         <img src={pillowA} alt="" className={this.state.pillow ? 'enter' : 'leave'} id="p"/>                         <a href="#" onMouseEnter={this.handleEnter} onMouseLeave={this.handleLeave} id="p-a">About</a>                     </div>                     <div className="pillow-c"  >                         <img src={pillowA} alt="" className={this.state.pillow ? 'enter' : 'leave'} id="p"/>                         <a href="#" onMouseEnter={this.handleEnter} onMouseLeave={this.handleLeave} id="p-a">Contacts</a>                     </div>                     <div className="pillow-p"  >                         <img src={pillowA} alt="" className={this.state.pillow ? 'enter' : 'leave'} id="p"/>                         <a href="#" onMouseEnter={this.handleEnter} onMouseLeave={this.handleLeave} id="p-a">Projects</a>                     </div>                     <div className="pillow-m-a"  >                         <img src={pillowA} alt="" />                         <a href="#">About</a>                     </div>                     <div className="pillow-m-c">                     <a href="#">Contacts</a>                         <img src={pillowA} alt="" />                         </div>                     <div className="pillow-m-p"  >                     <a href="#">Projects</a>                         <img src={pillowA} alt="" />                      </div>              </div>         )     } }  export default Home 

SCSS:

.h1-div{      position: absolute;            width: 28%;     height:1%;     left: 67%;     top: 30%;         animation-name: pvh1;         animation-duration: 3s;         animation-fill-mode: forwards;          h1{             font-size: 3.7vw;             color: #38AFC9;             text-shadow: 6px 6px 0px rgba(255, 210, 225, 0.84);         }           }       @keyframes pvh1 {         0% {right: -25%; bottom: 50%;}         75% {right: 8.75%; bottom: 50%;}         100% {right: 5%; bottom: 50%;}     }    img{         max-width: 100%; }  .right-tree{     position: relative;     left: 40%;      max-width: 60%;  }  .swing{  position: absolute; left: 4%; top: 29.5%; width: 34.3%; height: auto; }  .left-rope{     position: absolute;     left: 4.6%;     top: 45%;     width: 3.7%;     height: auto;     z-index: 1; }