How do I stop the default walking animation in Roblox? - roblox

I want to anchor the primary part, to immobilize the player, but if I anchor it while they are walking, it will play the walking animation even if they release the walk key. How do I pause/stop the default walking animation?

To immobilize the player you could suspend the controls, like this:
controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
wait(5)
--suspending controls for 5 seconds:
controls:Disable()
wait(5)
--resuming controls
controls:Enable()

Related

How can i create a way for a animation to have root motion for npc

Ok I have a npc script, and I have a walking animation for a character, right now the character just slides to the player while playing the animation, and it does not move with each step that the rig is taking, and just doing the animation in place, while it is sliding to the character, how can i make it so it will move with each step, and also, it is a animation that would make a character take 2 steps, pause, take 2 more steps, so just lining up the timing would not work.
Your need to set the walk animation to loop. Set the trigger/bool in AnimatorController when the character is moving and set it to false it isn't moving.

Camera not follow my 3d character during animation Unity

I have a character with one animation. the animation is running. So during the animation start, my character will run one position to other position, but my camera doesnt follow the character.
Do you have a script controlling the position of the camera or is it just parented to your player object?
If the camera is parented to the player object, it'll follow it everywhere.
However, it'll follow the root of the player object, regardless of the animation currently playing. If during the animation, the player steps forward, its root won't change. The animation of an object has no effects on its position.
You should make your player move through code, not through animation. You shouldn't have any problem then.

Unity3D idle player animation overrides jump animation

I've followed the brackeys tutorials to make a 2D Player Character jump but having issues with the jump animation. When I hit jump, the Player goes into the air but it'll play the idle animation in the air til I give another keyboard input. If I hit jump again while in the air, it'll play the jump animation and go back to idle when hitting the ground.
In the animator I noticed that the jump animation triggers fast and seems to be overridden by the idle animation. I've loaded and compared the working final brackeys project, and rebuilt the animator nodes. The code and everything in the editor are the same but the only thing I can think of is that I'm using different art assets.
Here are the tutorials I followed.
2D Movement: https://www.youtube.com/watch?v=dwcT-Dch0bA
2D Animation: https://www.youtube.com/watch?v=hkaysu1Z-N8
Could you post some screenshots of your Animator Controller, its animation settings or code, please? I suspect it might have something to do with transitions or events.

Unity 2D Animations: How to implement a jumping + shooting at the same time?

I'm trying to create my first computer game and I'm finding myself spending a lot of time trying to make the transitions between the character animations.
I am trying to make a transition from Jumping to Shooting (which have a different animation). I am making the transition from "Any State" to jumping based on a boolean parameter which is true whenever the character is in the air and I'm making the transition to shooting based on a Trigger paramter. Whenever I'm shooting with my character while in the air, it shows the shooting animation for a moment but make the transition back to the jumping animation before finishing it (I assume because it uses the "Any State" to make the transition back to the jumping animation and not the transition between "ShootHorizontalJump).
How can I make the shooting in air animation finish before going back to jumping?
Thank you for you help :)
My Animator
If you are using an animated Sprite Sheet as an animation, You can not play two animations at the same time.
Otherwise, You can use Animation Layer. It's same on 2D and 3D. Check here.

best way to change 2d sprite to animation

I have a GameObject for Chest(with Collider and SpriteRenderer)
By default it is a static sprite on the screen
now i want to add animation to this game object when open is triggered (by script), I do not have Idle animation, idle animation must be the sprite itself
what is the best to add an animation(no looping, 1 time and then show the animated sprite) to sprite?
I can do it by adding the sprite array and using an coroutine to set the sprite periodically with 0.2f delay (it work fine but not sure if it is the only way which using coroutine with delays to simulate an animation by myself...).
I can do it by create 1 more GameObject with the Animator, when the box open event is triggered, I set the original GameObject to inactive and instantiate the GameObject with the animation (but it requires to create 2 prefabs for two different gameObject).
But none of them look proper way to do this. What is the best solution for this?