GithubHelp home page GithubHelp logo

sh42913 / vibration Goto Github PK

View Code? Open in Web Editor NEW

This project forked from benoitfreslon/vibration

0.0 0.0 0.0 65 KB

Use custom vibrations on mobile with this native Plugin for Unity (Android & iOS)

License: Apache License 2.0

Objective-C 3.83% C# 68.84% Objective-C++ 27.32%

vibration's Introduction

Vibration

Native free plugin for Unity for iOS and Android. Use custom vibrations on mobile.

If you like this free plugin, that's be cool if you can buy me a coffee ๐Ÿ˜€โ˜•๏ธ Send tips to https://paypal.me/UnityVibrationPlugin

Installation

Copy and paste the entire Vibration folder in your Unity3D Assets folder or download and import the Vibration.unitypackage file.

Use

Initiatlisation

Initialize the plugin with this line before using vibrations:

Vibration.Init();

Vibrations

iOS and Android

Default vibration

Use Vibration.Vibrate(); for a classic default ~400ms vibration

Pop vibration

Pop vibration: weak boom (For iOS: only available with the haptic engine. iPhone 6s minimum or Android)

Vibration.VibratePop();

Peek Vibration

Peek vibration: strong boom (For iOS: only available on iOS with the haptic engine. iPhone 6s minimum or Android)

Vibration.VibratePeek();

Nope Vibration

Nope vibration: series of three weak booms (For iOS: only available with the haptic engine. iPhone 6s minimum or Android)

Vibration.VibrateNope();


Android Only

Custom duration in milliseconds

Vibration.Vibrate(500);

Pattern

long [] pattern = { 0, 1000, 1000, 1000, 1000 };
Vibration.Vibrate ( pattern, -1 );

Cancel

Vibration.Cancel();


IOS only

vibration using haptic engine

Haptic Engine

Vibration.VibrateIOS(ImpactFeedbackStyle.Light);

Vibration.VibrateIOS(ImpactFeedbackStyle.Medium);

Vibration.VibrateIOS(ImpactFeedbackStyle.Heavy);

Vibration.VibrateIOS(ImpactFeedbackStyle.Rigid);

Vibration.VibrateIOS(ImpactFeedbackStyle.Soft);

Vibration.VibrateIOS(NotificationFeedbackStyle.Error);

Vibration.VibrateIOS(NotificationFeedbackStyle.Success);

Vibration.VibrateIOS(NotificationFeedbackStyle.Warning);

Vibration.VibrateIOS_SelectionChanged();

vibration's People

Contributors

aminsojoudi avatar benoitfreslon avatar oivoodoo avatar sh42913 avatar vhnunes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.