Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

If you have any questions, reports, suggestions, or requests about Live2D, please send them to this forum.
※We cannot guarantee statements or answers from Live2D staff. Thank you for your understanding in advance.
 
Live2D Cubism
Cubism Products and Downloads
Cubism product manuals and tutorials
Cubism Editor Manual    Cubism Editor Tutorial    Cubism SDK Manual    Cubism SDK Tutorial
[About macOS Sequoia] (Updated October 22, 2024)
Live2D Cubism Editor 5.1.02 now supports macOS Sequoia.
Other Live2D Cubism products currently released are not guaranteed to work on macOS Sequoia.
Please refrain from upgrading macOS, as it may not operate properly.

Live2d Live Wallpaper Android (need help with hit area)

Like the title says, does anyone know how to do this?
I tried using the original live wallpaper sample but just couldn't get it to work with hit area.
I am using Eclipse (but I am sure no different with Android Studio).
I've seen some Android live wallpaper successfully implemented this also with the accel/gyro and moving background when user flicked the screen.

thanks :)

Comments

  • Solved the "hit area" issue, now I am still puzzled with gyro/accel and background not moving when flicking the screen horizontally.
    When I do eventually found the answer by myself, I will post the solution here.
  • edited May 2016
    So I come up with a solution based on @naotaro 's comment and help from
    community.live2d.com/discussion/235/how-to-set-an-image-as-the-background-in-the-live-wallpaper-on-android (please read the solution on this page 1st! there are files you need to copy)

    Not exactly my best solution because I am just a hobbyist, newbie at programming. The codes I am sharing might not be "efficient" (someone might be able to clean it up?).
    • Implemented Hit Area (tap face, chest . . .)
    • Implemented Accelerometer (shake / tilt device )
    Most of the codes are copied from "Live2D Sample Android" from the SDK, and modified with help from the previous post ( @naotaro THANK YOU!! )

    I want to share the codes but they are too much to be posted here, so I zip the eclipse source, including my model (my OC), for you guys to see what I did.

    Perhaps, @naotaro can clean/help with better/simpler solution

    1 thing that should be noticed for
    AccelHelper.java has been modified
    import jp.live2d.util.UtSystem; //import android.app.Activity; Disable THIS! import android.view.WindowManager; //import THIS!!!
    and under that:
    public class AccelHelper { //find this line //private final Activity activity; //Disable This! private final Context context; //CHANGE
    and finally:
    /* REPLACE WITH THE CODES BELLOW THIS ONE public AccelHelper(Activity activity) { sensorListener = new MySensorListener(); sensorManager = (SensorManager) activity.getSystemService(Activity.SENSOR_SERVICE); this.activity=activity; if(sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER).size()>0 && sensorManager.getSensorList(Sensor.TYPE_MAGNETIC_FIELD).size()>0){ accelerometer = sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER).get(0); magneticField = sensorManager.getSensorList(Sensor.TYPE_MAGNETIC_FIELD).get(0); }else { accelerometer=null; magneticField=null; } start(); } */ public AccelHelper(Context context) { this.accelerometerValues = new float[3]; this.geomagneticMatrix = new float[3]; this.accel = new float[3]; sensorListener = new MySensorListener(); sensorManager = (SensorManager) context.getSystemService("sensor"); this.context=context; if(sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER).size()>0 && sensorManager.getSensorList(Sensor.TYPE_MAGNETIC_FIELD).size()>0){ accelerometer = sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER).get(0); magneticField = sensorManager.getSensorList(Sensor.TYPE_MAGNETIC_FIELD).get(0); }else { accelerometer=null; magneticField=null; } start(); }



    Source code:
    https://dl.dropboxusercontent.com/u/18092757/CyrenBay/JewelWallpaperEclipse.zip
    APK demo:
    https://dl.dropboxusercontent.com/u/18092757/CyrenBay/JewelLiveWallpaper.apk

    Note: The source and APK demo uses "Jewel" my own original character, and my own artwork, please use only for testing, better yet, replace it with your model. :)

    I hope this helps :)
  • @Ronggowisnu
    Hey,


    thanks for solving your own issue :D . Sorry for not being able to on Java related things... :cold_sweat:
  • @andi.g@live2d no problem :smiley:

    Apparently there are a lot of un-necessary codes in my source files (discovered some of them) . I have not been able to update the source file on my 1st post yet.

    as for the live wallpaper apk, it is always updated as my experiment, you will notice now it has a "time checker" which can change background when the time is day or night (6am to 6pm), also a battery detection where my model can have different motions/expression depending on battery level, (also motion when plugged to charger lol)

    in time maybe I will post a more basic sample using the original live2D model.
  • Seems that some of the above links no longer works due to the update from dropbox which automatically turned off the ability to share files lol. so sorry about that.
    here is the working link :smile:
    https://dropbox.com/s/6xhpzxdmahf4cca/JewelWallpaperEclipse.zip?dl=0
    apparently I only have the source for eclipse and no apk :(
    anyway it has been over a year since I last medle with live2d stuff, so don't expect me to remember things I did XD
    PS: thanks "Nesa" for emailing me about the broken link :)
Sign In or Register to comment.