Release mouse control to use GUI and to paint

Realgar

New member
Hi everybody, (this i s probably a silly question, and perhaps I must found it in the documentation), but how could I fix or block the camera movement , to release my mouse cursor and use tools on my GUI ? I made a 3d painting app, and I need to have a key which let the user paint or use GUI to select color or textures. Then he could hit the key to reactivate the FPS mode with the camera... Thank's a lot if you can help me and save time ! (Before I used right mouse to have a orbit move of the cam, and the painting or the UI access was not while the camera moved...)
 

Andrew

Moderator
Staff member
To unlock the cursor, set Cursor.lockState to CursorLockMode.None.

To freeze the camera's movement and rotation, you could add an additional check at the beginning of CameraController.Rotate/Move that checks if a particular ability on the character is active and return if so.
 

maaxiim

New member
Would using OnEnableGameplayInput help in this case?


C#:
private void OnYourPaintGUIDisabled()
{
    ExecuteEvent(m_Character, "OnEnableGameplayInput", true);
}

private void OnYourPaintGUIEnabled()
{
    ExecuteEvent(m_Character, "OnEnableGameplayInput", false);
}
Where those 2 methods I just invented to illustrate how you could use it? I'm pretty much an Opsive newbie myself, but I did use that successfully to stop camera movement while activating a radial menu...
 

Andrew

Moderator
Staff member
As far as I know there isn't an out-of-the-box solution for that. You can always set the CameraController's character anchor transform to a stationary object (although this would only block the camera's movement, not rotation - blocking its rotation may require a little custom code, e.g. what I suggested in my previous post).
 
Top