会社を辞めたソフトウェアエンジニアがUnityでゲームを作って稼げるのか?

会社を辞めたソフトウェアエンジニアがUnityでゲームを作ってお金を稼ごうとしているブログです。

iTweenでRotateToが動かない!

===================================
「ひつじさん、かぞえてゲットン!」というアプリを作りました!
是非遊んでみてください!
android
https://play.google.com/store/apps/details?id=com.uphydn.straysheep
iOS
https://itunes.apple.com/jp/app/straysheep/id1442473289?mt=8
===================================

 

 

iTweenは便利ですがちょっと挙動があやしいコトがあります。

 

RotateTo()でオブジェクトを回転させようとした時に回転しない場合は、角度指定を+360度余分に指定すると回転するコトがあります。

 


iTween.RotateTo(RightEar,
iTween.Hash(
"z", (float) (360f + 90f),
"time", 0.05f,
"easetype", iTween.EaseType.easeOutBounce
));

iTween.RotateTo(LeftEar,
iTween.Hash(
"z", (float) (-360f + -90f),
"time", 0.05f,
"easetype", iTween.EaseType.easeOutBounce
));

 

こんな感じ。

 

ちょっとハマったのでメモ。