Hello there!
I’ve just tried to make a character controller which would move the character based on the world coordinates. It’s an game from isometric view with a fixed camera orientation, like in Secred of Mana on SNES.
I’ve already experimented a bit with first person and 3rd person cameras and they are quite easy to implement (at least there are plenty of tutorials and examples out there), but haven’t found one for isometric games with a fixed camera orientation.
// Update is called once per frame
void Update () {
// update movement only when the character is grounded
if(charController.isGrounded == true) {
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
// Display idle animation if the axis are below deadzone
if(Mathf.Abs(vertical) < deadZoneTolerance Mathf.Abs(horizontal)< deadZoneTolerance) {
animation.CrossFade("idle");
return;
} else {
if(Input.GetButton("Run")) {
animation.CrossFade("run");
walkSpeed = 4;
} else {
animation.CrossFade("walk");
walkSpeed = 1;
}
}
// Create an animation cycle for when the character is turning on the spot
if(horizontal!=0.00 vertical==0.00) {
//animation.CrossFade("walk");
}
moveDirection = new Vector3(horizontal,0,vertical);
moveDirection = transform.TransformDirection(moveDirection);
}
moveDirection.y -= gravity * Time.deltaTime;
charController.Move(moveDirection * (Time.deltaTime * walkSpeed));
}
That’s what I’ve tried so far, but it’s not working as expected, as it still moves the character based on local coordinates. This is my main problem so far. The other would be to rotate the char in the direction it’s walking depending on the value of Horizontal/Vertical axes. After the first person/3rd person code I thought this one would be similary easy, but seems I was wrong…
Anyone got any ideas how to do it?