Skip to main
Salsa de Movimiento artwork

Salsa de Movimiento

chaos

· 3:55 · 14 plays · v3-preview

Lyrics

private void UpdateMovement()

{

var movement = transform.forward * moveInput.y + transform.right * moveInput.x;

if (this._isLeftClicked && !this._shootingMode)

{

agent.updateRotation = false;

this.transform.localEulerAngles += new Vector3(0, this.mousePositionDiff.x * agent.angularSpeed, 0);

var y = this.playerCamera.transform.localEulerAngles.y - this.mousePositionDiff.y * agent.angularSpeed;

var rot = this.playerCamera.transform.localEulerAngles + new Vector3(y, 0, 0);

rot.x = Mathf.Clamp(Mathf.DeltaAngle(0, rot.x), -45, 45);

this.playerCamera.transform.localEulerAngles = rot;

}

this.mousePositionDiff = this.mousePosition - this.mousePositionOld;

this.mousePositionOld = this.mousePosition;

if (movement.sqrMagnitude > 1f)

{

movement.Normalize();

}

// NavMeshAgent expects a world-space movement vector.

agent.Move(movement * (agent.speed * Time.deltaTime));

}

Comments

No comments yet.