Check device input options (mouse and gyroscope)? - unity3d

I'm working on a game that uses the gyroscope and accelerometer as input.
To test it on my PC I created an option to use the mouse as input, however I want to be able to know whether the device has a gyroscope and a mouse so I can change the controls accordingly. This would be extra useful to make my game multiplatform.
How is this possible in Unity3D?

SystemInfo.supportsGyroscope checks whether the device as gyro or not.
Input.mousePresent checks whether mouse is avialable or not.
To correct the other answer:
Input.gyro.enable is used to enable or disable the usage of gyro.

You can check Input.gyro.enabled to see if the gyroscope is enabled.

Related

iOS - Capture data when shutter fires

Is there an easy way to capture gyroscope at the exact time the shutter is fired on the camera? I am currently using the IUImagePickerController and I can't find an easy way to interrupt or tie into the image taking process.
The closest you'll be able to do is implement:
imagePickerController:didFinishPickingImage:editingInfo:
and save the gps coords and gyro at that time. However its not fired the instance that the shutter is fired but it should be very close. If I were you I recommend just saving GPS location, not the gyro. Not only is it hard to reproduce, but also you wont have the elevation which would change the picture. (ie: if your taking the shot from a skyscrapper.) Also make sure you enable the GPS BEFORE you start the camera so that theres no delay/ask the user for permission.

core location autopause, effects of activity type

Hi does anyone know the effect that using different CLActivity type constants has on the behavior of auto pause? For example, will the location manager resume from a pause more readily if activityType is set to CLActivityTypeAutomotiveNavigation or CLAcitivtyTypeFitness?
Thanks for your help.
The activity type flags affect the internal auto pause logic. For instance CLActivityTypeFitness is more likely to pause when the user is stationary with no accelerometer motion and when the user is moving fast with accelerometer motion similar to a vehicle and vice versa for CLActivityTypeAutomotiveNavigation. CLActivityTypeOther is supposed to be a catch-all setting for everything else. However the exact logic and thresholds are only known to Apple.
As far as I know, the location updates are only resumed if your app becomes active again, there is no auto-resume depending on the user motion. But you can always start region monitoring in your didPause callback to resume tracking again when the user does move.

ios zxing with front or rear camera

Im using ZXing, is working fine on my new app, but i would like to integrate the option of front or rear camera,
so far the only reference to this i've found is on the google group
But is not very clear what they mean with that,
so any pointers on what i have to do to accomplish this?
thanks !
ZXWidgetController doesn't provide that functionality and it's not really set up to make it easy to change.
The code that needs to change is in - (void)initCapture. It calls [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]. This returns the default camera and you don't want the defalt.
You need code similar to that in - (ZXCaptureDevice*)device in ZXCapture.mm. That code won't work out of the box (it's designed to work with both AVFF and QTKit) but it's the same idea. Instead of using the default video input device, go through the devices and look at device position to find the device you want.
Be nice to port that code to the widget but that hasn't happened at this point.

Can I monitor the iPhone proximity sensor without turning off screen? Also, landscape

I've got the proximity sensor working so that I can trigger events when in proximity, but I'm trying to use it as a sort of dead man switch. The problem is that whenever in proximity, the screen turns off, which drastically reduces the usability of the app :P Also, the proximity sensor doesn't seem to activate when in landscape mode (I can't see the flashing light in my camera). Is there any way to get around these standard events and methods?
Your current UIDevice has a proximityState property on it. May be useful.

How can i test tilt efftect? - IPhone Simulator

I am trying to write a game. That game uses tilt effect, but i don't know how to test it on Iphone Simulator 3.0.
I search it on internet, but the result is zero. How can i...?
Short answer: You can't, not directly. You have to use a real device.
Longer answer: You could subclass UIAccelerometer and do as you like. You could simulate input, or write a client and server pair that sends acceleration information from a real device to your app running in the simulator, or from your Macbook's accelerometer if you fancy waving your laptop around.
Try https://code.google.com/p/accelerometer-simulator/. It does the same thing as iSimulate -- it sends accelerometer events from the phone to your computer -- but it's free and open source.
There's an application in the AppStore called iSimulate which lets you feed an actual device's accelerometer inputs into the sim. You do need to have a device for testing.
ON a related note, you can also capture accelerometer data from safari running on your iphone/ipad
See this demo http://www.webdigi.co.uk/blog/2012/using-an-ios-device-to-control-a-game-on-your-browser/
Just saw this when asking a similar question - you can actually set the interface orientation now in the new xcode, so even though you can't 'tilt' it directly, you can make it to where it only supports landscape - then it will load the landscape view in the emulator! :D
From: http://developer.apple.com/library/ios/#documentation/IDEs/Conceptual/iOS_Simulator_Guide/InteractingwiththeiOSSimulator/InteractingwiththeiOSSimulator.html
Place the pointer where you want the rotation to occur.
Hold down the Option key.
Move the circles that represent finger touches to the start position.
Move the center of the pinch target by holding down the Shift key, moving the circles to the desired center position, and releasing the Shift key.
Hold down the mouse button, rotate the circles to the end position, and release the Option key.