IEnumerator Start() { yield return(FileUtil.preparePath("apose.dat")); posture_apose_ = JsonUtility.FromJson <Posture>(FileUtil.content); yield return(FileUtil.preparePath("pre_throw_l_arm.dat")); posture_pre_throw_l_arm_ = JsonUtility.FromJson <Posture>(FileUtil.content); yield return(FileUtil.preparePath("pre_throw_r_arm.dat")); posture_pre_throw_r_arm_ = JsonUtility.FromJson <Posture>(FileUtil.content); yield return(FileUtil.preparePath("throw_l_arm.dat")); posture_throw_l_arm_ = JsonUtility.FromJson <Posture>(FileUtil.content); yield return(FileUtil.preparePath("throw_r_arm.dat")); posture_throw_r_arm_ = JsonUtility.FromJson <Posture>(FileUtil.content); yield return(FileUtil.preparePath("pre_jump.dat")); posture_pre_jump_ = JsonUtility.FromJson <Posture>(FileUtil.content); muscle_motion_ = new MuscleMotion(); muscle_motion_.init(posture_apose_, 80f /* damper */, 1500f /* spring */); set_params_body(body_damper_, body_spring_); set_params_arm(arm_damper_, arm_spring_); set_params_leg(leg_damper_, leg_spring_); { /* tales */ float damper = 4f; float spring_ratio = 40f; muscle_motion_.setParams(MuscleMotion.Parts.L_Tale1, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Tale2, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Tale3, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Tale4, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Tale1, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Tale2, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Tale3, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Tale4, damper, spring_ratio); } { /* ribbons */ float damper = 2f; float spring_ratio = 100f; muscle_motion_.setParams(MuscleMotion.Parts.L_Ribbon1, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Ribbon2, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Ribbon1, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Ribbon2, damper, spring_ratio); } { /* suso */ float damper = 10f; float spring_ratio = 200f; muscle_motion_.setParams(MuscleMotion.Parts.L_SusoBack, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_SusoFront, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_SusoBack, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_SusoFront, damper, spring_ratio); } current_posture_ = posture_apose_; }
void set_params_body(float damper, float spring_ratio) { muscle_motion_.setParams(MuscleMotion.Parts.Ribs, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.Ribs2, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.Ribs3, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.Hip, damper, spring_ratio); }
public IEnumerator initialize() { base.init(); yield return(FileUtil.preparePath("apose.dat")); posture_apose_ = JsonUtility.FromJson <Posture>(FileUtil.content); Debug.Assert(posture_apose_ != null); yield return(FileUtil.preparePath("pre_throw_l_arm.dat")); posture_pre_throw_l_arm_ = JsonUtility.FromJson <Posture>(FileUtil.content); Debug.Assert(posture_pre_throw_l_arm_ != null); yield return(FileUtil.preparePath("pre_throw_r_arm.dat")); posture_pre_throw_r_arm_ = JsonUtility.FromJson <Posture>(FileUtil.content); Debug.Assert(posture_pre_throw_r_arm_ != null); yield return(FileUtil.preparePath("throw_l_arm.dat")); posture_throw_l_arm_ = JsonUtility.FromJson <Posture>(FileUtil.content); Debug.Assert(posture_throw_l_arm_ != null); yield return(FileUtil.preparePath("throw_r_arm.dat")); posture_throw_r_arm_ = JsonUtility.FromJson <Posture>(FileUtil.content); Debug.Assert(posture_throw_r_arm_ != null); yield return(FileUtil.preparePath("pre_jump.dat")); posture_pre_jump_ = JsonUtility.FromJson <Posture>(FileUtil.content); Debug.Assert(posture_throw_r_arm_ != null); throwing_cnt_l_ = 0; throwing_cnt_r_ = 0; jump_tame_duration_ = 0f; jump_propel_remain_ = 0f; on_ground_ = true; on_ground_time_ = 100f; bullet_tame_left_ = 0f; bullet_tame_right_ = 0f; // hit_time_ = 0f; somersault_ = false; muscle_motion_ = new MuscleMotion(); muscle_motion_.init(posture_apose_, 80f /* damper */, 1500f /* spring */); MuscleMotion.Node root_node = muscle_motion_.getRootNode(); look_at_ = new Vector3(0f, 1f, 0f); rigidbody_.setPosition(0f, 1f, 15f); var rot = Quaternion.LookRotation(look_at_ - rigidbody_.transform_.position_); rigidbody_.setRotation(ref rot); rigidbody_.setDamper(10f); rigidbody_.setRotateDamper(50f); root_node.rigidbody_.setDamper(10f); root_node.rigidbody_.setRotateDamper(40f); collider_ = MyCollider.createPlayer(); MyCollider.initSpherePlayer(collider_, ref rigidbody_.transform_.position_, 1f /* radius */); // muscle_motion_.fix(MuscleMotion.Parts.Ribs, 0.4f /* interpolate_ratio */); // muscle_motion_.fix(MuscleMotion.Parts.Ribs2); // muscle_motion_.fix(MuscleMotion.Parts.Ribs3, 0.4f /* interpolate_ratio */); // muscle_motion_.fix(MuscleMotion.Parts.Hip, 0.1f /* interpolate_ratio */); { /* body */ float damper = 60f; float spring_ratio = 800f; muscle_motion_.setParams(MuscleMotion.Parts.Ribs, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.Ribs2, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.Ribs3, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.Hip, damper, spring_ratio); } { /* arms */ float damper = 50f; float spring_ratio = 1000f; muscle_motion_.setParams(MuscleMotion.Parts.L_Shoulder, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_UpperArm, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_ForeArm, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Wrist, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Shoulder, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_UpperArm, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_ForeArm, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Wrist, damper, spring_ratio); } { /* legs */ float damper = 30f; float spring_ratio = 500f; muscle_motion_.setParams(MuscleMotion.Parts.L_Thigh, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Knee, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Ancle, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Toe, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Thigh, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Knee, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Ancle, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Toe, damper, spring_ratio); } { /* tales */ float damper = 10f; float spring_ratio = 200f; muscle_motion_.setParams(MuscleMotion.Parts.L_Tale1, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Tale2, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Tale3, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Tale4, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Tale1, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Tale2, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Tale3, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Tale4, damper, spring_ratio); } { /* ribbons */ float damper = 2f; float spring_ratio = 100f; muscle_motion_.setParams(MuscleMotion.Parts.L_Ribbon1, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_Ribbon2, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Ribbon1, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_Ribbon2, damper, spring_ratio); } { /* suso */ float damper = 10f; float spring_ratio = 200f; muscle_motion_.setParams(MuscleMotion.Parts.L_SusoBack, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.L_SusoFront, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_SusoBack, damper, spring_ratio); muscle_motion_.setParams(MuscleMotion.Parts.R_SusoFront, damper, spring_ratio); } }