Skip to content

swparkaust/UnityPressureTouchGestureRecognizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

UnityPressureTouchGestureRecognizer

Touch velocity detection for Unity using an accelerometer. Inspired by GarageBand for iOS.

demo unitypressuretouchgesturerecognizer

Read this in other languages: English, ํ•œ๊ตญ์–ด.

Installation

No dependencies other than Unity are required. Let me know if anything happens!

  1. Create an empty GameObject and name it PressureTouchGestureRecognizer.
  2. Download the PressureTouchGestureRecognizer.cs script and add it to the GameObject.
  3. When triggered, "pressure" is set to a float between 0.0f and 2.0f.
  4. Optionally, you can set the minimum and maximum touch sensitivity required for recognition.

Usage

	private PressureTouchGestureRecognizer recognizer;

	void Start()
	{
		recognizer = GetComponent<PressureTouchGestureRecognizer>();
		recognizer.SetAction(HandlePressureTouch);
	}

	void HandlePressureTouch(float pressure)
	{
		Debug.Log("pressure = " + pressure);
	}

About

๐Ÿ‘† Touch velocity detection for Unity using an accelerometer

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages