Search Unity

Question FPS Animation based game with aim not working

Discussion in 'Animation' started by Kybo10, Jun 19, 2022.

  1. Kybo10

    Kybo10

    Joined:
    May 25, 2015
    Posts:
    11
    Hey guys, I am new to unity but I am a software developer by trade. I get the coding parts but I am confused when it comes to animation. I am currently making a FPS game that only plays when a button is held. This is because its for my mentally/physically disabled sister, so the regular FPS controllers didnt work for me.

    I currently downloaded the YBot character on mixamo, and the pistol idle animation. (https://www.mixamo.com/#/?page=1&query=pistol+idle&type=Motion,MotionPack)

    The way the scene currently plays out is I made an animation that moves the player position around a corner, then when its done it calls an event that lets the character know it can start aim/firing. I rigged up the player animation controller with a base layer that handles this movement of the player.

    The next move is given by a trigger in the script called "next", and the aim is a boolean.

    It should always do the base layer move, but only do the arms layer aim when the boolean is set.

    I got it to work with it only on the base layer, but I dont want to do a web of transitions between aim and each move animation.

    I thought about layer avatar masks, but since I am literally only animating the player transform position for the main game loop I didnt know if it would work. I also thought about just moving the gun and letting IK handle the rest of the work but whenever I move the gun even though its under the hand bone it doesnt move the hand.

    Does anyone know of a better way to have an animation moving the player transform AND an animation moving the gun from idle position to the aim position?

    Thanks!

    - aimPlayer animation
    aimPlayer.png

    - player controller - arms layer
    arms_controller.png

    - player controller - base layer controller.png

    - move animation - game loop move1.png