Where is IOS Camera support documented?

问:

Unity 3.5 release notes say there is support for the iOS Camera. Where is this documented?

I'm looking for a simple example of how to take a photo and apply it as a texture.


回答:

We were having a similar problem and got this reply from the great folks at Unity:

The cameras are accessed from the WebCamTexture class:-

http://unity3d.com/support/documentation/ScriptReference/WebCamTexture.html

When you create an instance of this class, you supply the name of the camera you want to use. A list of all cameras is available from the devices property. The entries in the list give the camera's name and whether or not it is front-facing. You could use code something like the following:-

function Start () { var devices : WebCamDevice[] = WebCamTexture.devices; var frontCamName: String; var backCamName: String; var frontTex: WebCamTexture; var backTex: WebCamTexture;

for( var i = 0 ; i < devices.length ; i++ ) {
  if (devices[i].isFrontFacing) {
    frontCamName = devices[i].name;
  } else {
    backCamName = devices[i].name;
  }
}

frontTex = new WebCamTexture(frontCamName, width, height, framesPerSec);
backTex = new WebCamTexture(backCamName, width, height, framesPerSec);

}

The WebCamTexture also has Play, Pause and Stop functions and GetPixels/SetPixels (like Texture2D) to enable you to analyse the captured image data.

I hope this helps address your question as far as accessing the cameras. -wm


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值