-
-
Save ditzel/0257d74a7a04626efce7bd1f7a6cfaa0 to your computer and use it in GitHub Desktop.
using UnityEngine; | |
using UnityEngine.EventSystems; | |
public class FixedTouchField : MonoBehaviour, IPointerDownHandler, IPointerUpHandler | |
{ | |
[HideInInspector] | |
public Vector2 TouchDist; | |
[HideInInspector] | |
public Vector2 PointerOld; | |
[HideInInspector] | |
protected int PointerId; | |
[HideInInspector] | |
public bool Pressed; | |
// Use this for initialization | |
void Start() | |
{ | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
if (Pressed) | |
{ | |
if (PointerId >= 0 && PointerId < Input.touches.Length) | |
{ | |
TouchDist = Input.touches[PointerId].position - PointerOld; | |
PointerOld = Input.touches[PointerId].position; | |
} | |
else | |
{ | |
TouchDist = new Vector2(Input.mousePosition.x, Input.mousePosition.y) - PointerOld; | |
PointerOld = Input.mousePosition; | |
} | |
} | |
else | |
{ | |
TouchDist = new Vector2(); | |
} | |
} | |
public void OnPointerDown(PointerEventData eventData) | |
{ | |
Pressed = true; | |
PointerId = eventData.pointerId; | |
PointerOld = eventData.position; | |
} | |
public void OnPointerUp(PointerEventData eventData) | |
{ | |
Pressed = false; | |
} | |
} |
MoveJoystick.inputVector is equals to MoveJoystick.Direction
i dont find FuxedJoystick srcipt please some one can send me
Help error CS1061: 'FixedJoystick' does not contain a definition for 'InputVector' and no accessible extension method 'InputVector' accepting a first argument of type 'FixedJoystick' could be found (are you missing a using directive or an assembly reference?)
CS1061 'object' does not contain a definition for 'x' and no accessible extension method 'x' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)please help me in this anyone?
Error CS0029 Cannot implicitly convert type 'UnityEngine.Quaternion' to 'UnityEngine.Vector3'
also this error is come to distrub me please help me solve this ?
Error CS1061 'object' does not contain a definition for 'y' and no accessible extension method 'y' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Help
error CS1061: 'FixedJoystick' does not contain a definition for 'InputVector' and no accessible extension method 'InputVector' accepting a first argument of type 'FixedJoystick' could be found (are you missing a using directive or an assembly reference?)FixedJoystick has Direction.
--Level.cs
void Update(){ //... var player = fps.GetComponent<PlayerMovement>(); player.RunAxis = FixedJoistick.Direction; //... } //...
--PlayerMovement.cs
public CharacterController controller; .. public Vector2 RunAxis; ... void Update(){ //... float x = RunAxis.x; float z = RunAxis.y; Vector3 move = transform.right * x + transform.forward * z; controller.Move(move*speed*Time.deltaTime); velocity.y += gravity * Time.deltaTime; controller.Move(velocity * Time.deltaTime); //... }
Hope it will help.
Can please tell me in which componet this both file is put or tell can i create this two file
pls help me everyone, i can't touch field and get's error
Will You Help Plz Plz.Plz
Please Help Me Please