/** * Touch events for either: * - rotating movable objects around their Y axis * - imparting rotational motion on pickup-able objects (like a ball) */ public void OnTouchEvent(Vector2 touchLocation, BEControllerTouchStatus touchStatus) { Vector2 touchMovement; if (touchStatus == BEControllerTouchStatus.TouchMove) { touchMovement = touchLocation - lastTouchLocation; if (grabbing) { grabDistance += touchMovement.y; grabDistance = Mathf.Max(0.3f, grabDistance); // Clamp to minimum distance } else { bool highlight = hightlightObject.activeSelf; if (highlight) { Vector3 euler = transform.localEulerAngles; euler.y -= touchMovement.x * 180; transform.localEulerAngles = euler; } } } lastTouchLocation = touchLocation; }
/** * Called when the controller button is pressed */ void ControllerOnTouchEvent(Vector2 position, BEControllerTouchStatus status) { if (onControllerTouchEvent != null) { onControllerTouchEvent.Invoke(position, status); } }
private static void ControllerTouchEventCallback(beVector2 position, BEControllerTouchStatus status) { if (BridgeEngineUnity.main != null) { BridgeEngineUnity.main.ControllerOnTouchEvent(position.ToVector2(), status); } }
void OnTouchEvent(Vector2 position, BEControllerTouchStatus touchStatus) { Vector3 touchPosition = touch.localPosition; touchPosition.x = -position.x; touchPosition.y = position.y; touch.localPosition = touchPosition; }
public override void OnTouchEvent(Vector2 position, BEControllerTouchStatus touchStatus) { if (touchStatus == BEControllerTouchStatus.TouchFirstContact || touchStatus == BEControllerTouchStatus.TouchMove) { m_CarMotionData.motorTorque = Mathf.Sign(position.y) * Mathf.Pow( Mathf.Abs(position.y), m_ThrustPower); } if (touchStatus == BEControllerTouchStatus.TouchReleaseContact) { m_CarMotionData.motorTorque = 0; } }
public override void OnTouchEvent(Vector2 position, BEControllerTouchStatus touchStatus) { // Debug.Log("In A OnTouchEvent"); if (touchStatus == BEControllerTouchStatus.TouchFirstContact || touchStatus == BEControllerTouchStatus.TouchMove) { direction = Mathf.Sign(position.y); m_CarMotionData.motorTorque = direction * Mathf.Pow(Vector2.Distance(position, rootVector), m_ThrustPower); Debug.Log("In A OnTouchEvent position x is " + position.x); m_CarMotionData.steerAngle = Mathf.Pow(Mathf.Clamp(position.x / 0.8f, -1, 1), m_RotatePower); } if (touchStatus == BEControllerTouchStatus.TouchReleaseContact) { m_CarMotionData.steerAngle = 0; m_CarMotionData.motorTorque = 0; } }
// m_CarMotionData.steerAngle is updated here public override void OnTouchEvent(Vector2 position, BEControllerTouchStatus touchStatus) { Debug.Log("In C OnTouchEvent"); //base.OnTouchEvent(position, touchStatus); if (touchStatus == BEControllerTouchStatus.TouchFirstContact || touchStatus == BEControllerTouchStatus.TouchMove) { //m_CarMotionData.motorTorque = Mathf.Pow(position.y, 3); m_CarMotionData.steerAngle = position.x; direction = Mathf.Sign(position.y); } if (touchStatus == BEControllerTouchStatus.TouchReleaseContact) { m_CarMotionData.steerAngle = 0; } }
public virtual void OnTouchEvent(Vector2 position, BEControllerTouchStatus touchStatus) { //Debug.Log("In Parent OnTouchEvent"); }