#Thread
1 messages · Page 1 of 1 (latest)
sure, thanks so much for helping aswell
the animatorcontroller, can you check whether the states actually have animations?
sure
the thing is, its really annoying because it worked before & I have videos of it working
well that seems fine. Is the animatorcontroller assigned to an animator component on the model?
https://media.discordapp.net/attachments/497874004401586176/1048212791946915860/code.png
is 'walkin()' actually called?
can you check
did it?
put a debug there, see if the code gets called
alr sure
the old project and this one were on same version
by the way I don't see a state called 'idle', so that won't work
check if the triggers get set in the animatorcontroller during play mode
that's a trigger
ik and im setting the trigger
I was replying to the screenshot with Play("idle")
okay so looks like it's running the animation there?
might want to set the animation to loop
well it is playing, I can see that in the animatorcontroller. But the character isn't moving?
Switching states works in the animatorcontroller?
yeah I think the script is fine, the animatorcontroller is fine; but the animatorcontroller doesn't like the model hierarchy
yeah, the attack animation works in the controller - like it fires
but the animation just doesn't show
heres what it looked like before
very weird
so, import settings or object hierarchy
is the animator on the correct gameobject
try opening the animation window again with the model selected in the scene hierarchy
what gameobject is the Animator component on
the Player component
which is the uhh
i forgot the word
capsule
then the golem is the child of the capsule
Well this animation expects it to be on the golem
put it on Golem_Pose
ill try to put it on the golem rn
how would I add the golem_pose animator to the Player object scripts
turn 'apply root motion' on
although I have no idea how the movement speed and stuff from 'player' class is intended to be used
wheres that
on the animator
oh alr
nope, nothing. I think this is my issue instead of yours because i just tested it again and the character doesn't move
yeah i don't know how it's supposed to move
maybe try putting all those scripts on the golem
instead of Player
kk
heres a video of it moving
if that helps
nope.
the player script would be more helpful
the whole script?
using System.Security.Cryptography;
using System.Collections.Specialized;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour {
#region Private Variables
[SerializeField] private Animator playerAnim;
[SerializeField] private float walkSpeed, originalSpeed, runSpeed, rotateSpeed;
[SerializeField] private bool walking;
[SerializeField] private Transform tf;
[SerializeField] private Rigidbody rb;
#endregion
void FixedUpdate(){
if(Input.GetKey(KeyCode.W)) {
rb.velocity = transform.forward * walkSpeed * Time.deltaTime;
}
if(Input.GetKey(KeyCode.S)) {
rb.velocity = -transform.forward * walkSpeed * Time.deltaTime;
}
}
void Update(){
walkin();
rotating();
attacking();
ultimateSlam();
if (Input.GetKeyDown(KeyCode.L)) {
Debug.Log("Idle: setTrigger 1 ");
playerAnim.SetTrigger("idle");
Debug.Log("Idle: setTrigger 2 ");
}
}
void walkin() {
if(Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.S)) {
playerAnim.SetTrigger("walk");
playerAnim.ResetTrigger("idle");
walking = true;
}
if(Input.GetKeyUp(KeyCode.W) || Input.GetKeyUp(KeyCode.S)) {
playerAnim.ResetTrigger("walk");
playerAnim.SetTrigger("idle");
walking = false;
rb.velocity = Vector3.zero;
}
if (walking && Input.GetKeyDown(KeyCode.LeftShift)) {
playerAnim.SetTrigger("run");
playerAnim.ResetTrigger("walk");
walkSpeed = walkSpeed + runSpeed;
}
if (walking && Input.GetKeyUp(KeyCode.LeftShift)) {
walkSpeed = originalSpeed;
playerAnim.SetTrigger("walk");
playerAnim.ResetTrigger("run");
}
}
void attacking() {
bool hasAttacked = false;
if (Input.GetButtonDown("Fire1")) {
playerAnim.SetTrigger("attack");
playerAnim.ResetTrigger("slam");
hasAttacked = true;
}
if (playerAnim.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && hasAttacked) {
playerAnim.ResetTrigger("attack");
hasAttacked = false;
}
}
void ultimateSlam() {
bool hasAttackedSlam = false;
if(Input.GetButtonDown("Fire2")) {
playerAnim.SetTrigger("slam");
hasAttackedSlam = true;
}
if (playerAnim.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && hasAttackedSlam) {
playerAnim.ResetTrigger("slam");
playerAnim.ResetTrigger("attack");
hasAttackedSlam = false;
}
}
private void rotating() {
if(Input.GetKey(KeyCode.A)) {
tf.Rotate(0, - rotateSpeed * Time.deltaTime, 0);
}
if(Input.GetKey(KeyCode.D)) {
tf.Rotate(0, rotateSpeed * Time.deltaTime, 0);
}
}
}
looks like it's not using any root motion or whatever, just rigidbody
yeah
so that has nothing to do with the animations
yeah ik, I said i believe its on my end
it's all on your end 😛