Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class CharacterController : MonoBehaviour {
  6.  
  7. public Transform myTransform;
  8. public GameObject gameObject;
  9. // Use this for initialization
  10. void Start()
  11. {
  12. myTransform = GetComponent<Transform>();
  13.  
  14. }
  15.  
  16.  
  17. // Update is called once per frame
  18. void Update () {
  19. if (Input.GetKey(KeyCode.Mouse1))
  20. {
  21. Vector3 zielPosition = Input.mousePosition;
  22. Vector3 personPosition = myTransform.position;
  23. var Geschwindigkeit = 0.2f;
  24. var Richtung = zielPosition-personPosition;
  25. Richtung.y = 10;
  26.  
  27. myTransform.position += Richtung * Geschwindigkeit
  28. * Time.deltaTime;
  29.  
  30. }
  31.  
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement