この連載コラムの1~5を参考にして、Win7のUnityでAndroidアプリとしてAR機能をつけてみました。
AR機能自体は驚くほどあっさりと実装できたのですが、なにかカメラの範囲がおかしい。

真っ黒の部分は完全に無反応。
左下のエリアだけカメラが機能しているという不思議な状態になりました。
ARカメラの設定項目をひたすらいじりまくっても、一向にカメラ範囲は変化してくれません。
ググっても全く情報がでてきません。
なにこれ!
Unityでゲーム開発をやってます。
開発しててわかったちょっとしたことを忘備録としてメモしておきます。
ニュースを見て気になったデータのグラフ化とか、
しょーもないネタを書く時とかもあります。

jQuery('#check').click(function(){
alert(jQuery('#check').attr('checked'));
});
jQuery('#check').attr('checked',true).checkboxradio('refresh');
jQuery('#check').click(function(){
alert(jQuery('#check').attr('checked'));
});
jQuery('#check').attr('checked',true).checkboxradio('refresh');
jQuery('#check').click(function(){
alert(jQuery('#check').next().find(":eq(0) :eq(1)").hasClass("ui-icon-checkbox-on"));
});
function Start(){
var cb0 : WWW = new WWW("http://yourserver.com/cb0.js");
yield cb0;
var cb1 : WWW = new WWW("http://yourserver.com/cb1.js");
yield cb1;
var Url = 'https://twitter.com/';
var webViewObject = new GameObject("WebViewObject").AddComponent(WebViewObject);
webViewObject.Init(function(msg){
Debug.Log(String.Format("CallFromJS[{0}]", msg));
});
webViewObject.LoadURL(Url);
webViewObject.SetMargins(20,20,20,Screen.height/2);// このタイミングでサイズ指定
webViewObject.SetVisibility(true);
switch (Application.platform) {
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
case RuntimePlatform.IPhonePlayer:
webViewObject.EvaluateJS(cb0.text);
break;
}
webViewObject.EvaluateJS(cb1.text);
}
window.addEventListener('load', function() {
window.Unity = {
call:function(msg) {
var iframe = document.createElement('IFRAME');
iframe.setAttribute('src', 'unity:' + msg);
document.documentElement.appendChild(iframe);
iframe.parentNode.removeChild(iframe);
iframe = null;
}
}
}, false);
window.addEventListener('load', function(){
var id = setInterval(function(){
if (document.getElementsByClassName("blue").length){
Unity.call('clicked');
clearInterval(id);
var p = document.getElementsByClassName("black")[0];
p.parentNode.removeChild(p);
}
},300);
}, false);
private static readonly string PostTweetURL = "http://api.twitter.com/1/statuses/update.xml?status={0}";
private static readonly string PostTweetURL = "https://api.twitter.com/1.1/statuses/update.json?status={0}";
// Need to fill body since Unity doesn't like an empty request body.
byte[] dummmy = new byte[1];
dummmy[0] = 0;
// HTTP header
Hashtable headers = new Hashtable();
headers["Authorization"] = GetHeaderWithAccessToken("POST", url, consumerKey, consumerSecret, response, parameters);
WWW web = new WWW(url, dummmy, headers);
WWWForm form = new WWWForm();
string str = GetHeaderWithAccessToken("POST", url, consumerKey, consumerSecret, response, parameters);
str = str.Replace("\"","");
string[] p = str.Split(',');
p[0] = "status=" + UrlEncode(text);
foreach (string obj in p){
string[] tmp = obj.Split ('=');
form.AddField(tmp[0], tmp[1]);
}
WWW web = new WWW("http://yourserver.com/tweet.php", form);
$str = "";
foreach ($_POST as $key => $value){
$str .= $key."=".$value."&";
}
$str = substr($str,0,strlen($str)-1);
$opts = array(
'http'=>array(
'method'=> 'POST',
'content'=> $str
)
);
$context = stream_context_create($opts);
file_get_contents("https://api.twitter.com/1.1/statuses/update.json",0,$context);
Array ( [status] => test2 [oauth_consumer_key] => zUAiZ5W0sAnLTrbwjEibGA [oauth_nonce] => 178919DE [oauth_signature_method] => HMAC-SHA1 [oauth_timestamp] => 1375233480 [oauth_token] => 126559571-GQoRFeEkeum8kB1PqIfJiBjj0L8MH36Iumsy1Vgg [oauth_version] => 1.0 [oauth_signature] => 3ZpEhBQDv0rYmPCNapxbd2yoWdY%3D )
Array ( [http] => Array ( [method] => POST [content] => status=test2&oauth_consumer_key=zUAiZ5W0sAnLTrbwjEibGA&oauth_nonce=178919DE&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1375233480&oauth_token=126559571-GQoRFeEkeum8kB1PqIfJiBjj0L8MH36Iumsy1Vgg&oauth_version=1.0&oauth_signature=3ZpEhBQDv0rYmPCNapxbd2yoWdY%3D ) )
insert into もぐらハイスコア set id=3,スコア=100 on duplicate key update id=3,スコア=greatest((select スコア from もぐらハイスコア where id=3),300)