I'm trying to animate a spaceship barrel roll, and for some reason when the roll animation end, the ship goes back to the starting position. Attaching a GIF to display :
https://gfycat.com/glaringgrotesqueherring
https://gifyu.com/image/tQ8I
Here is how I set up the animator, as you can see there are no properites on the idle animation:
What am I doing wrong? Thank you.
Related
I'm working on 2D game in unity and the game has several animation clip like : Idle, Idle Stomach, Figure and etc.
Also I have two section in my scene: 1- home 2-character
My default animation is "Idle" and I use SetTrigger to run the specific animation clip.
Animation and trigger work fine but when I trigger from "Idle" to another animation like "Figure" and switch between home and character (character section false -> home section true -> home section false, character section true) , my Idle animation blend with another clip witch it has trigger before and it has some frame from figure or stomach animation.
How can I reset animator like when scene load? or reset Idle clip for example?
I try these separately :
true/false animator component
set trigger Idle animation again
use Play("normalState", 0, 0f);
but didn't work.
You could try the exit node in the animator, doing this will automatically make the animator go the default animation clip.
https://i.stack.imgur.com/XigM7.png
Add this to layer 0 and use Play("Exit", 0);
Please is it possible to make a Player with rigidbody or character controller run on wall just like The Flash. Please guide me on how to implement this.Here's a link of what I'm talking about. Thank you in advance.
Rotate the player to be vertical to the building, adjust the gravity parameter on your rigid body (make it lower so the added force won't be canceled by it) and just add the force (or set the velocity, whatever makes you happy)
I'm going to assume you already know how to move the player around on the ground. All you need to do is create some form of detection for when they want to begin running on the wall (maybe the player presses a button, or walks up to the wall), at which point you will want to do 2 things: rotate the player to have their feet on the wall, and change gravity to be pulling the player into the wall.
If we assume the player is facing the wall when they go up on it, you can just rotate 90 degrees backwards. Changing gravity should be easy too. Once the player is fully rotated, do something like this
Vector3 newGravityVector = tranform.down.normalized
Physics.gravity = transform.down.normalized * 9.8 //9.8 is the default gravitaty value, feel free to use a different multiplier if you wish.
(this script should be attached to your player)
So i made a animation for my sword in unity, the animation is basically the sword attack, the animation itself works perfectly, BUT when the animation finishes the sword just freezes on the position of the last frame in the animation, and before you ask; yes i do have Animator component on my sword, anyways, if i check the Loop Time option the animation just loops forever, if you have any solution's about the problem be sure to comment or answer about it, anyways, THANKS!
I would make the "loop" in the animaton window. Just copy&paste keys and make sure the first keyframe is the same as the last keyframe of your sword animation.
copy Transform properties of first keyframe and paste to the last keyframe of your sword animation, so that after one loop sword will come to its initial position
Does anyone know how to transition a game object to an existing animation?
Currently I have a cube object like this:
The cube Object has a preconfigured simple jumping animation with fixed location as Layer default state. Lets call this animation: "BoxJumping".
The player however can move the cube object to any position(using wsad) key.
When the player stop for 1 sec, I want the cube to transition back to the original position of the animation. Like this:
I can simply use:
private void playJumpAnim()
{
gameObject.GetComponent<Animation>().Play("BoxJumping");
}
However, it just directly move the cube to the preconfigure location which has been stored in the animation and play the animation without any smoothing transtion.
Does anyone know how to achieve this kind of transition?
A very simple solution is create an empty gameobject to be parent of the cube. When the Animator is a child, it performs the updates on local space.
Then you can move the cube by the parent gameobject.
Hi I was just wondering what position will take priority with a child objects position. Does the position of the parent object or a position set through a script take priority?
I'm asking this because I have a player with a camera as a child object which by default follows the parent. I'm trying to implement a system where I can set the transform.position of the camera to the other player in the game when you finish, sort of like a spectator mode. The original player that the camera follows is constantly falling when they complete the game as they fall out the map, and I can't destroy the player as it holds information about their score that I need later.
Possibly the constantly moving player (as it falls) is stopping the camera from lerping to the other player in the game?
In this case you need to change the parent of the camera to the player you want to follow (since the current parent is constantly changing it's position by falling down). You could also set the rigidbody of the player that is falling to kinematic so it won't move and disable it's renderer so he is not visible.