Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Screen position out of view frustum (screen pos 574.000000, 266.000000) (Camera rect 0 0 1149 531) UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32)

$
0
0
code: using UnityEngine; using System.Collections; public class movement : MonoBehaviour { //Variables public float speed = 6.0F; public float jumpSpeed = 8.0F; public float gravity = 20.0F; private Vector3 moveDirection = Vector3.zero; public Transform cam; public float turnSmoothTime = 0.1f; float turnSmoothVelocity; void Update() { CharacterController controller = GetComponent(); // is the controller on the ground? if (controller.isGrounded) { //Feed moveDirection with input. float horizontal = Input.GetAxisRaw("Horizontal"); float vertical = Input.GetAxisRaw("Vertical"); Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized; //Multiply it by speed. moveDirection *= speed; //Jumping if (Input.GetButton("Jump")) moveDirection.y = jumpSpeed; } //Applying gravity to the controller moveDirection.y -= gravity * Time.deltaTime; //Making the character move controller.Move(moveDirection * Time.deltaTime); if (moveDirection.magnitude >= 0.1f) { float targetAngle = Mathf.Atan2(moveDirection.x, moveDirection.z) * Mathf.Rad2Deg; float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime); transform.rotation = Quaternion.Euler(0f, targetAngle, 0f); controller.Move(moveDirection * Time.deltaTime); } Cursor.lockState = CursorLockMode.Locked; } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>