wrld3d / wrld-example-app

WRLD 3D Maps example app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use Built-in Camera Controls does nothing in unity when running demo.

gmyv opened this issue · comments

commented

I did the basic Unity tutorial, set the Camera field to the Main Camera (and only camera) and clicked the check box for built in controls. The camera stays static no matter what, no errors. Click and drag, scroll wheel, nothing works.

Edit: in the example scene, I see there is a "Fly Camera Behavoir" script added to the Main Camera, which the tutorial makes no mention of.

I guess the "Use Built-In Camera Controls" checkbox is deprecated and not mentioned in the documentation?

Hi,

The "Fly Camera Behavior" in the scene you're using is demonstrating an example of using a custom camera (particularly a first person camera controlled via WASD + Mouse) - see this tutorial for more information (under 'Disabling the Built-in Camera Controls'). If you wish to use the default built-in controls, simply remove the Fly Camera Behavior from Main Camera and re-check the "Use Built-In Camera Controls". This should make the camera be controlled by the default mouse controls.

We understand it's a bit confusing, and we've an update in the works that has the Fly Camera removed from these Scenes and defaults instead to just using the Built-In controls.

commented

Hierarchy:
image

image

image

clicking and draging does nothing. Removed FlyCameraBehavoir from the camera.

Those settings look correct, so looks like this is a bug. We'll get this investigated immediately.

In the meantime, can you tell us what version of Unity you're using, what OS you're running on, and confirm that the following cases are true:

  • Input.GetMouseButtonDown(0); and Input.GetMouseButtonUp(0); are working as expected when clicking the main mouse button.
  • Input.touchSupported is returning false while running in the Unity editor.
commented

Unity 5.6.0f3
Windows 10 Pro x64

I added Debug.Logs for those three items, and the first two log appropriately when I click the screen, and Input.touchSupported constantly returns true. Edit: I guess this should be false? Not sure how to set this, as I've never built for mobile before or worked with touch controls.

This was in a new project I made and pulled the plugin directly from the Asset Store inside Unity.

commented

Any update one this?

In my last post, I mentioned that Input.touchSupported is returning true in the editor. I'm not sure why, or how to change that setting. I set this project up in a completely empty project and didn't change any default settings.

If it is a simple setting to make Input.touchSupported return false in the editor, any idea what it is? This only affects my work computer for some reason.

Hi Gmyv,

Thanks for the reply and the issue report. We think this might be caused by some faulty logic in our camera controls. At the moment, we choose between mouse controls and touch-screen controls (for tablets & phones) by checking the value of Input.touchSupported and Input.multitouchEnabled. Of course, this neglects the fact that a user may want to use mouse controls with a device that supports touch.

The correct fix would be to allow the user to configure this. We’re hoping to schedule time for that soon. In the meantime, a short-term hack to get around this could involve making a change to the constructor of the CameraInputHandler type in Wrld/Scripts/Camera/CameraInputHandler.cs. This would involve commenting out lines 42-47 to make sure that m_isTouchInputSupported gets set to false and m_inputProcessor is initialised as a UnityMouseInputProcessor. I’ve pasted the code below for reference.

I hope this helps, please let us know if you have any further problems.

Kind regards,

John

public CameraInputHandler()
{
var inputHandler = new UnityInputHandler(NativePluginRunner.API);

/* !!! HACK - commented out to force use of mouse controls
if (UnityEngine.Input.touchSupported && UnityEngine.Input.multiTouchEnabled)
{
    m_isTouchSupported = true;
    m_inputProcessor = new UnityTouchInputProcessor(inputHandler, Screen.width, Screen.height);
}
else !!! END HACK */
{
    m_isTouchSupported = false;
    m_inputProcessor = new UnityMouseInputProcessor(inputHandler, Screen.width, Screen.height);
}
m_inputFrame = new InputFrame();
m_previousMousePosition = Vector2.zero;

}

commented

That worked perfectly! Thank you so much ... now I can easily test in the editor without compiling for phone. Thanks!