Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Please limit one question/topic per post.
Please provide the following details depending on types of question

▼ For question regarding Editor, please provide:
- Live2D Software Version: (e.g. Cubism Editor 3.1.02, Euclid Editor 1.2.02)
- OS & Version: (e.g. Windows 10, macOS HighSierra)
- PC Model: (e.g. MacBookPro 2017)
- Graphics Specifications: (e.g. GeForce GTX 950M)
- Memory: (e.g. 8GB)
- Illustration Software used: (e.g. Photoshop, ClipStudio, SAI)
- Attach screenshot or capture video to show your problem:
---------------------------
▼ For question regarding SDK, please provide:
- For us to reproduce the issue you wish to inquire about, please provide either a minimum project file which has the issue. or specific instructions on how to reproduce the issue.
- Types and version of Cubism SDK you are using.
---------------------------
▼ For question regarding Cubism Software License,
For issues related to purchasing, your order, license key, and subscription, please contact us via contact form:
https://www.live2d.jp/eng/contact/

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[email protected] 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.