|
Post by laurie on May 22, 2019 4:26:17 GMT
I've tried switching camera state to a Free Directional state (my default state is a Fixed Angle) but other than a brief camera wobble I can see no effect. I was expecting the camera to rotate and zoom with mouse / touch input, but I can't get it to do anything. I've stepped through vThirdPersonCamera.ChangeState() in the debugger to confirm that the state is switching (i.e. I didn't mis-spell the state name or something), so I know the correct state is being activated. It just doesn't cause any difference in camera behaviour.
It's probably not going to be what I need anyhow; I'm using an isometric view and I probably want both a fixed angle of view with free rotation about only the Y axis. I want to test with the Free Directional camera mode and see if zeroing out one or other of the limit angles will get me what I want.
Any suggestions to get this working?
|
|
|
Post by laurie on May 22, 2019 4:37:04 GMT
It just occurred to me that I don't have cursor lock enabled (the interface is click to move via NavMesh / NavMeshAgent). That probably explains the problem. I guess I'll have to dig through the API and hook up my own inputs to camera rotation and zoom (particularly as I don't think there's any support for zoom via touch anyway...)
|
|
|
Post by Invector on May 22, 2019 15:04:09 GMT
Did you look at the vMansion demo scene? we have examples there on how to change the camera state from fixed to free or the other way around
|
|
|
Post by laurie on May 22, 2019 19:59:08 GMT
Thanks for the pointer; I hadn't looked at that demo. I'll see what I can figure out.
[Edit]: so that's using the vTriggerCameraChangeState behaviour. I searched the documentation and it's not mentioned, but I found a footnote at the end of the CREATING A NEW CAMERA STATE section that does mention it (without the 'v' prefix though, hence the failed search). Looking at that component, it sets `changeCameraState` and `customCameraState` on the `vThirdPersonInput` component, which should result in that camera state propagating to the camera.
I tried doing the same thing but it didn't work. `changeCameraState` in `vThirdPersonInput` is always 'false` during `UpdateCameraStates()`. I changed the member variable to a property getter/setter that logs when it's set, and I see it being set to `true` from my code, yet it still evaluates to false :-/
The only thing I can think of at this point is that I'm sub-classing `vThirdPersonInput` to add nav mesh based character movement. Perhaps `changeCameraState` is somehow getting shadowed, though I don't see anything in my code that would do that.
Back to debugging...
|
|
|
Post by laurie on May 22, 2019 20:52:45 GMT
And mystery solved; for testing I was using `FindComponentOfType<vThirdPersonInput>()` but switching to my sub-class for the type worked -- I was able to set the `changeCameraState/customCameraState` pair or just call `ChangeCameraState()` and get the expected result. Better, fixing the min/max Y angle got me the right camera rotation behaviour sort of. Since it's driven by mouse movement, it conflicts with my point-and-click control scheme and doesn't do anything on mobile. But (mouse based) zoom works so now I can look into remapping inputs and/or driving the camera rotation and zoom programmatically from my touch gesture recognition code.
I would suggest updating the documentation to reference the correct method to call and possibly looking into why calling it on a `vThirdPersonInput` reference to a subclass instance doesn't work (although that may have been my fault since I was hacking Invector code trying to figure out why things weren't working as documented).
|
|