问题
How can I play test my GearVR game on my development computer without building and running on my phone?
I'm looking for either an answer for a game built with either Unreal Engine or a Unity3D.
回答1:
Dont playtest without a headset
"Playtesting" on a PC completely misses the point of playtesting in it's regular meaning.
Playtesting VR apps is important, and has to be performed with a headset. One of the biggest challenges of designing VR games is ensuring a comfortable (not nauseating) experience and percise, intuitive input/controls. If you run your app on a PC with the WSAD/mouse duo, your playtest will be pretty much worthless.
Cheap alternative
Google cardboard is the cheapest option, if you have a decent smartphone. The experience wont be as good as when using Gear VR, but it will be a lot closer the real thing than using a PC. It will let you test actual gameplay as intended.
If you really need mouselook
I found that testing some features (not gameplay itself!) is a lot faster if I cut out deploying to a device from the workflow, so I actually implemented what you ask for.
I dont have Unity at hand right now, but it is quite easy to do. In a initialization script you can check if you are running on Gear VR or a PC, and enable the appropriate control script. it could look like this:
void Start() {
#if UNITY_ANDROID && !UNITY_EDITOR
setAndroidCameraRig();
#endif
#if UNITY_EDITOR
setEditorCameraRig ();
#endif
}
Your SetEditorCameraRig
could look something like this:
pcRotateHead pcHead = gameObject.GetComponentInChildren<pcRotateHead> ();
pcHead.enabled = true;
Where pcRotateHead
is a script that updates it's object orientation each frame based on mouse movement:
public class pcRotateHead : MonoBehaviour {
public float XSensitivity = 5f;
public float YSensitivity = 5f;
public void Update()
{
float yRot = Input.GetAxis("Mouse X") * XSensitivity;
float xRot = Input.GetAxis("Mouse Y") * YSensitivity;
Vector3 baseRotation = transform.rotation.eulerAngles;
Vector3 newRotation = new Vector3(-xRot + baseRotation.x, yRot + baseRotation.y, baseRotation.z);
Quaternion newQuatRotation = Quaternion.Euler (newRotation);
transform.rotation = newQuatRotation;
}
}
Check out the Unity manual: http://docs.unity3d.com/Manual/PlatformDependentCompilation.html
来源:https://stackoverflow.com/questions/29082825/play-test-gearvr-game-on-dev-computer