public void loadPhysics(String path) { IPlatformManager pm = Live2DFramework.getPlatformManager(); if (debugMode) { pm.log("Load Physics : " + path); } physics = L2DPhysics.load(pm.loadBytes(path)); }
void load() { live2DModel = Live2DModelUnity.loadModel(mocFile.bytes); for (int i = 0; i < textureFiles.Length; i++) { live2DModel.setTexture(i, textureFiles[i]); } float modelWidth = live2DModel.getCanvasWidth(); live2DCanvasPos = Matrix4x4.Ortho(0, modelWidth*zoom, modelWidth*zoom, 0, -50.0f, 50.0f); if (physicsFile != null) physics = L2DPhysics.load(physicsFile.bytes); }
private void load() { this.live2DModel = Live2DModelUnity.loadModel(this.mocFile.bytes); for (int i = 0; i < this.textureFiles.Length; i++) { this.live2DModel.setTexture(i, this.textureFiles[i]); } float right = this.live2DModel.getCanvasWidth(); this.live2DCanvasPos = Matrix4x4.Ortho(0f, right, right, 0f, -50f, 50f); if (this.physicsFile != null) { this.physics = L2DPhysics.load(this.physicsFile.bytes); } }
void load() { live2DModel = Live2DModelUnity.loadModel(mocFile.bytes); live2DModel.setRenderMode (Live2D.L2D_RENDER_DRAW_MESH); for (int i = 0; i < textureFiles.Length; i++) { live2DModel.setTexture(i, textureFiles[i]); } float modelWidth = live2DModel.getCanvasWidth(); live2DCanvasPos = Matrix4x4.Ortho(0, modelWidth, modelWidth, 0, -2.0f, 2.0f); if (physicsFile != null) physics = L2DPhysics.load(physicsFile.bytes); }
void load() { live2DModel = Live2DModelUnity.loadModel(mocFile.bytes); // モーションのインスタンスの作成(mtnの読み込み)と設定 motionAppeal = Live2DMotion.loadMotion( mtnFiles[ 0 ].bytes ); motionAppeal.setFadeOut (5000); motionAppeal.setLoop( this.isMotionLoop ); motionManager = new MotionQueueManager();//モーション管理クラスの作成. //play motionManager.startMotion(motionAppeal,true); for (int i = 0; i < textureFiles.Length; i++) { live2DModel.setTexture(i, textureFiles[i]); } float modelWidth = live2DModel.getCanvasWidth(); live2DCanvasPos = Matrix4x4.Ortho(0, modelWidth, modelWidth, 0, -50.0f, 50.0f); if (physicsFile != null) physics = L2DPhysics.load(physicsFile.bytes); }
public static L2DPhysics load(char[] buf) { L2DPhysics ret = new L2DPhysics(); Value json = Json.parseFromBytes(buf); List <Value> params_ = json.get("physics_hair").getVector(null); int paramNum = params_.Count; for (int i = 0; i < paramNum; i++) { Value param = params_[i]; PhysicsHair physics = new PhysicsHair(); Value setup = param.get("setup"); float length = setup.get("length").toFloat(); float resist = setup.get("regist").toFloat(); float mass = setup.get("mass").toFloat(); physics.setup(length, resist, mass); List <Value> srcList = param.get("src").getVector(null); int srcNum = srcList.Count; for (int j = 0; j < srcNum; j++) { Value src = srcList[j]; string id = src.get("id").toString();//param ID PhysicsHair.Src type = PhysicsHair.Src.SRC_TO_X; string typeStr = src.get("ptype").toString(); if (typeStr == "x") { type = PhysicsHair.Src.SRC_TO_X; } else if (typeStr == "y") { type = PhysicsHair.Src.SRC_TO_Y; } else if (typeStr == "angle") { type = PhysicsHair.Src.SRC_TO_G_ANGLE; } else { UtDebug.error("live2d", "Invalid parameter:hysicsHair.Src"); } float scale = src.get("scale").toFloat(); float weight = src.get("weight").toFloat(); physics.addSrcParam(type, id, scale, weight); } List <Value> targetList = param.get("targets").getVector(null); int targetNum = targetList.Count; for (int j = 0; j < targetNum; j++) { Value target = targetList[j]; string id = target.get("id").toString();//param ID PhysicsHair.Target type = PhysicsHair.Target.TARGET_FROM_ANGLE; string typeStr = target.get("ptype").toString(); if (typeStr == "angle") { type = PhysicsHair.Target.TARGET_FROM_ANGLE; } else if (typeStr == "angle_v") { type = PhysicsHair.Target.TARGET_FROM_ANGLE_V; } else { UtDebug.error("live2d", "Invalid parameter:PhysicsHair.Target"); } float scale = target.get("scale").toFloat(); float weight = target.get("weight").toFloat(); physics.addTargetParam(type, id, scale, weight); } ret.addParam(physics); } return(ret); }
public void loadPhysics(String path) { IPlatformManager pm = Live2DFramework.getPlatformManager(); if (debugMode) pm.log("Load Physics : " + path); physics = L2DPhysics.load(pm.loadBytes(path)); }
public static L2DPhysics load(char[] buf) { L2DPhysics ret = new L2DPhysics(); Value json = Json.parseFromBytes(buf); List<Value> params_ = json.get("physics_hair").getVector(null); int paramNum = params_.Count; for (int i = 0; i < paramNum; i++) { Value param = params_[i]; PhysicsHair physics = new PhysicsHair(); Value setup = param.get("setup"); float length = setup.get("length").toFloat(); float resist = setup.get("regist").toFloat(); float mass = setup.get("mass").toFloat(); physics.setup(length, resist, mass); List<Value> srcList = param.get("src").getVector(null); int srcNum = srcList.Count; for (int j = 0; j < srcNum; j++) { Value src = srcList[j]; string id = src.get("id").toString();//param ID PhysicsHair.Src type = PhysicsHair.Src.SRC_TO_X; string typeStr = src.get("ptype").toString(); if (typeStr == "x") { type = PhysicsHair.Src.SRC_TO_X; } else if (typeStr == "y") { type = PhysicsHair.Src.SRC_TO_Y; } else if (typeStr == "angle") { type = PhysicsHair.Src.SRC_TO_G_ANGLE; } else { UtDebug.error("live2d", "Invalid value. PhysicsHair.Src"); } float scale = src.get("scale").toFloat(); float weight = src.get("weight").toFloat(); physics.addSrcParam(type, id, scale, weight); } List<Value> targetList = param.get("targets").getVector(null); int targetNum = targetList.Count; for (int j = 0; j < targetNum; j++) { Value target = targetList[j]; string id = target.get("id").toString();//param ID PhysicsHair.Target type = PhysicsHair.Target.TARGET_FROM_ANGLE; string typeStr = target.get("ptype").toString(); if (typeStr == "angle") { type = PhysicsHair.Target.TARGET_FROM_ANGLE; } else if (typeStr == "angle_v") { type = PhysicsHair.Target.TARGET_FROM_ANGLE_V; } else { UtDebug.error("live2d", "Invalid value. PhysicsHair.Target"); } float scale = target.get("scale").toFloat(); float weight = target.get("weight").toFloat(); physics.addTargetParam(type, id, scale, weight); } ret.addParam(physics); } return ret; }
public void loadPhysics(string path) { IPlatformManager manager = Live2DFramework.getPlatformManager(); if (this.debugMode) { manager.log("Load Physics : " + path); } this.physics = L2DPhysics.load(manager.loadBytes(path)); }
public static L2DPhysics load(char[] buf) { L2DPhysics physics = new L2DPhysics(); List<Value> list = Json.parseFromBytes(buf).get("physics_hair").getVector(null); int count = list.Count; for (int i = 0; i < count; i++) { Value value3 = list[i]; PhysicsHair phisics = new PhysicsHair(); Value value4 = value3.get("setup"); float num3 = value4.get("length").toFloat(); float num4 = value4.get("regist").toFloat(); float num5 = value4.get("mass").toFloat(); phisics.setup(num3, num4, num5); List<Value> list2 = value3.get("src").getVector(null); int num6 = list2.Count; for (int j = 0; j < num6; j++) { Value value5 = list2[j]; string paramID = value5.get("id").toString(); PhysicsHair.Src srcType = PhysicsHair.Src.SRC_TO_X; string str2 = value5.get("ptype").toString(); if (str2 == "x") { srcType = PhysicsHair.Src.SRC_TO_X; } else if (str2 == "y") { srcType = PhysicsHair.Src.SRC_TO_Y; } else if (str2 == "angle") { srcType = PhysicsHair.Src.SRC_TO_G_ANGLE; } else { object[] args = new object[] { "Invalid value. PhysicsHair.Src" }; UtDebug.error("live2d", args); } float scale = value5.get("scale").toFloat(); float weight = value5.get("weight").toFloat(); phisics.addSrcParam(srcType, paramID, scale, weight); } List<Value> list3 = value3.get("targets").getVector(null); int num10 = list3.Count; for (int k = 0; k < num10; k++) { Value value6 = list3[k]; string str3 = value6.get("id").toString(); PhysicsHair.Target targetType = PhysicsHair.Target.TARGET_FROM_ANGLE; string str4 = value6.get("ptype").toString(); if (str4 == "angle") { targetType = PhysicsHair.Target.TARGET_FROM_ANGLE; } else if (str4 == "angle_v") { targetType = PhysicsHair.Target.TARGET_FROM_ANGLE_V; } else { object[] objArray2 = new object[] { "Invalid value. PhysicsHair.Target" }; UtDebug.error("live2d", objArray2); } float num12 = value6.get("scale").toFloat(); float num13 = value6.get("weight").toFloat(); phisics.addTargetParam(targetType, str3, num12, num13); } physics.addParam(phisics); } return physics; }
void load() { // .moc.bytesファイルをロードしてセット m_live2DModel = Live2DModelUnity.loadModel(m_mocFile.bytes); // テクスチャのファイル数だけ読み込んでセット for (int i = 0; i < m_textureFiles.Length; i++) { m_live2DModel.setTexture(i, m_textureFiles[i]); } // キャンバスを用意 float modelWidth = m_live2DModel.getCanvasWidth(); m_live2DCanvasPos = Matrix4x4.Ortho(0, modelWidth, modelWidth, 0, -50.0f, 50.0f); // 物理設定ファイルが空ならロード if (m_physicsFile != null) m_physics = L2DPhysics.load(m_physicsFile.bytes); // モーション管理用変数を用意 m_motionMgr = new MotionQueueManager(); // モーションファイルの数だけモーション管理用配列を確保 m_motions = new Live2DMotion[m_motionFiles.Length]; // モーションファイルの数だけモーションを読み込み for (int i = 0; i < m_motionFiles.Length; i++) { m_motions[i] = Live2DMotion.loadMotion(m_motionFiles[i].bytes); } }