Switch tanks controller from isometric to first/third person
chaenator last edited by Baroni
I am trying to switch the tanks controller from isometric to first/third person view for shooter gameplay and was wondering about good approach to this.
Obviously, I gotta change the right 'joystick' control and camera script but not too sure where to look or how to make the modification. Any advice would be appreciated
Thanks in advance,
Baroni last edited by Baroni
Hi there, thanks for registering.
For modifying any joystick actions, everything you would need is written in the Player script. First, it is defined what the joysticks actually do.
UNET: OnStartLocalPlayer(). Photon: Start() method
//=left joystick for movement, =right joystick for shooting GameManager.GetInstance().ui.controls.onDragBegin += ShootBegin; GameManager.GetInstance().ui.controls.onDrag += RotateTurret; GameManager.GetInstance().ui.controls.onDrag += Shoot;
You would want to look at the RotateTurret method. Currently, the turret rotation is simply an int value ranging from 0-359. That's the angle that should be applied in a top-down view, around the tank. Depending on if you don't want to let the player move the turret up or down, you could even keep it like this. Otherwise, you would need to rewrite the turret rotation value and network synchronization to Vector3 (or an array of integer values, for the different axis angles).
Regarding the camera, please have a look at the FollowTarget script (on the camera) and its "distance" and "height" values in the inspector. By decreasing those values, you can already move it to a third person view.