Top Down Local Multiplayer camera

motomax

New member
Hi guys,

I just started with TPS, I am a dev with extensive knowledge, but I do not understand how to setup a top down game with local multiplayer functionality (i.e. 2 characters, one controlled by gamepad, the other one by mouse/keyboard). I would write a simple camera script on my own (which just zooms and pans with the 2 char. in focus). I don't understand how to "disconnect" cam controller and character controller; I get the "missing look source" exception. Can you give me a little hint?
 
If you are getting missing look source errors make sure you specify the character that each camera should be assigned to within the Camera Controller. This is for first person but your setup should look similar to:


You do not need to perform steps 5, 6, or 7.
 
Thanks for your quick reply.
Sorry, I guess I wasn't clear. The game is ONE camera total, with 1-4 players in an arena. No splitscreen. This one camera should always show all players. How can I solve the "missing look source" exception, as I can assign only ONE character to the camera controller?

Unbenannt.jpg
 
The camera controller currently doesn't support that use case. I can add it to my list but for right now you will need to implement a new ILookSource for each character and then create a new camera controller which can show all of the characters. For a sample look source implementation take a look at the LocalLookSource component.
 
The camera controller currently doesn't support that use case. I can add it to my list but for right now you will need to implement a new ILookSource for each character and then create a new camera controller which can show all of the characters. For a sample look source implementation take a look at the LocalLookSource component.
Hello,

I am doing something very similar, except I am using Unity Cinemachine to create the top down view. I have a character with Top Down movement type and attached the LocalLookSource component. I want the character to look at the direction that he is moving and only mouse position when aiming and shoot. However, the character can walk forward, but if I press back, right or left the character will spinning itself.

I am not sure how this LocalLookSource component work. Can you explain it further? Thanks

Derek
 
If I understand correctly you want the player to look in his movement direction, until the Aim ability is used, when he should start looking towards the cursor? You can use the "Look In Move Direction" on the Third Person Top Down movement type, then you'd need to create a state preset which disables it during the Aim state.
 
If I understand correctly you want the player to look in his movement direction, until the Aim ability is used, when he should start looking towards the cursor? You can use the "Look In Move Direction" on the Third Person Top Down movement type, then you'd need to create a state preset which disables it during the Aim state.

almost correct. Think of a game like overcooked. Multiple local player with ONE camera only.

I cannot assign multiple characters on the camera control. You mentioned LocalLookSource component or ILookSource at the top. I don’t quite understand how it works.


If I don’t assign character to camera controller, it will give me a no look source error. If I attach the LocalLookSource component on to the character, it will keep on spin except moving forward.
 
If I understand correctly you want the player to look in his movement direction, until the Aim ability is used, when he should start looking towards the cursor? You can use the "Look In Move Direction" on the Third Person Top Down movement type, then you'd need to create a state preset which disables it during the Aim state.
One more thing i just notice, when I am using Cinemachine ViewType on with camera pointing downward. My character projectile will shoot downward.....
 
Last edited:
If you want the setup with multiple characters and one camera, you can use an approach as suggested by @motomax, i.e. create a transform that dynamically moves to the center point between all the characters. You shouldn't need a look source component in this case. The demo scene has a top-down example area that should help demonstrate how to set this up. If you still get this spinning movement issue could you share a gif/vid of it and steps to reproduce?
 
Hello,

I am doing something very similar, except I am using Unity Cinemachine to create the top down view. I have a character with Top Down movement type and attached the LocalLookSource component. I want the character to look at the direction that he is moving and only mouse position when aiming and shoot. However, the character can walk forward, but if I press back, right or left the character will spinning itself.

I am not sure how this LocalLookSource component work. Can you explain it further? Thanks

Derek
Hi, have you fixed that spinning problem? I have the same problem with Third Person Adventure Movement Type.
 
The camera controller currently doesn't support that use case. I can add it to my list but for right now you will need to implement a new ILookSource for each character and then create a new camera controller which can show all of the characters. For a sample look source implementation take a look at the LocalLookSource component.
Just wanted to chime in that I also have this use case. Just about everything else about the character controller and camera works as I need it, but the provided camera stuff can't track multiple characters.

I'm trying to do what motomax did but I tried disabling the camera controller and handler with third person top down movement. That does allow me to do my own camera stuff, but then I get the character looking in one direction at all times no matter which way they're moving. I think I'll need to override some stuff in the third person top down camera code to get it to do what I want.
 
Top