AdvancedIsoObjectController#

class in UltimateIsometricToolkit.Scripts.IsoController / Inherits from MonoBehaviour

Description#

Character controller that makes use of physics

See also (SimpleIsoObjectController)

Hint

This controller requires both an IsoCollider and IsoRigidbody which will be automatically attached if needed.

Variables#

Type Name Description
float Speed speed threshold in units per second
float JumpForce absolute JumpForce (not relative to IsoRigidbody.Mass)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
"""Update loop"""
void Update() {
            //read inputs and change velocity
            _isoRigidbody.Velocity = new Vector3(Input.GetAxis("Vertical") * Speed, _isoRigidbody.Velocity.y, -Input.GetAxis("Horizontal") * Speed);

      //we want to jump
            if (Input.GetKeyDown("space")) {
                //check vertical distance
                IsoRaycastHit hit;
                var maxDistanceToGround = 1f;
        //check the distance to ground
                if (IsoPhysics.Raycast(_isoTransform.Position, Vector3.down, out hit, maxDistanceToGround)) {
                    //add upp force
                    _isoRigidbody.AddForce(Vector3.up*JumpForce);
                }
            }
        }