0
\$\begingroup\$

I'm making an isometric dungeon crawler. I initially used transform to get isometric movement and things worked well, but I couldn't use collision which meant it was unsuitable. So I'm now trying to use Rigidbody and I'm having some weird issues.

First of all, this is the code I currently have:

public class CharControllerRigid : MonoBehaviour{
    [SerializeField]
    private Rigidbody characterRigid;
    private Vector3 inputVector;
    void Start()
    {
        characterRigid = GetComponent<Rigidbody>();   
    }

    void Update()
    {
        inputVector = new Vector3(Input.GetAxis("Horizontal") * 10f, characterRigid.velocity.y, Input.GetAxisRaw("Vertical"));
        transform.LookAt(transform.position + new Vector3(inputVector.x, 0, inputVector.z));      
    }
    private void FixedUpdate()
    {
        characterRigid.velocity = inputVector;
    }
}

I have two issues:

First, how do I get the movement to work on an isometric plain?

Second, how do I get the movement to work in all directions? Current when I move left and right the movement is good, but up and down are really slow in comparison.

\$\endgroup\$
  • \$\begingroup\$ If you're working in 3D, the "isometric" is just the perspective of your camera angle. It generally doesn't change the shape of the world or how things move in it. Can you give us more information on how your current code's behaviour differs from what you expect / want? \$\endgroup\$ – DMGregory Nov 19 '19 at 17:54
  • \$\begingroup\$ When you say left and right, do you mean towards the left / right side of the screen or towards the left / right side of the character? Because with the character, I'd expect same speed in all directions. This can be an effect of the isometric perspective in 3D, movement towards left and right will actually seem faster but it's the same distance (example: don't starve's movement is also like that). Try debugging with printing the position of your character, the position should change equally. Also, try an overhead camera style and see if the movement looks normal. \$\endgroup\$ – John Hamilton Nov 21 '19 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.