Hello! It’s my first post here so I hope I’ll do good
I have a pretty simple task to do for my college class - a game, that I figured out be a simple third person platformer with a cat as a main character. Currently I’m having a big problem with moving my cat the right way. This is how a part of my CatMovement script looks like:
void FixedUpdate () {
walkSpeed = Input.GetAxis ("Vertical");
turnSpeed = Input.GetAxis ("Horizontal");
if (walkSpeed < 0)
{
transform.Translate (0, 0, 0);
}
else
{
transform.Translate (0, 0, walkSpeed * 0.1f);
}
transform.Rotate (0, turnSpeed, 0);
if(!Input.GetKey("left") && !Input.GetKey("right"))
{
action = false;
animator.SetBool ("akcja", action);
}
else{
action = true;
animator.SetBool ("akcja", action);
}
animator.SetFloat ("chodzenie", walkSpeed);
animator.SetFloat ("obrot", turnSpeed);
if (transform.position.y < -2)
{
Die ();
}
}
It’s able to rotate at a slow speed, but whenever I click W or UP arrow - instead of going forward it goes to the right. In the FixedUpdate script I’m also changing values for an Animator, cause I want the walking animation to run then the speed goes up.
Can anyone suggest me what can I do about it? Maybe a different way to steer the cat? I tried using RigidBody, but whenever I start the game - the cat disappears. I tried exporting my cat model in a few different ways from 3ds MAX but nothing works. I’ve read the tip about creating an EmptyObj to be the parent of an imported object, but I don’t really know how would it work with an animation, mostly because I have to move the character (I want it to be third-person, so the cat in moving in the direction it’s facing.) and animate it. Maybe writing a script for the EmptyObj just for the movement, and a script for the cat to change the animator values, check for collisions etc?
Any help would be appreciated. And also sorry if my english isn’t that good, it’s not my native language