Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by NachoUJI · Jan 14, 2014 at 06:20 PM · cameranetworking

Using Different Cameras in Network.

Hi all,

I have a question using the Network and the cameras. I have a server and different clients can connect, they should have their own First Person Camera, so in the prefab i instantiate I have added a camera also i have a Main Camera for the server.

The problem is: when Client1 connects, he uses his own camera, and the server too. But when the Client2 connect, Server, Client1 and Client2 use the Client2 camera. And always like this. All the "players" uses the camera from the last client connected. I have looked information about this, but i cant find anything.

Thank you in advance.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KuPAfoo · Jan 14, 2014 at 06:26 PM 0
Share

You should be able to say 'new camera pCam' in the camera file. Then ins$$anonymous$$d of using the default camera as the scripted camera reference, you use the pCam so the engine knows your using the player specific camera

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Pangamini · Jan 14, 2014 at 06:51 PM

Let's say there's a world, it's populated by characters (and crates, bombs, monsters, rum whatever). Players connect to the server and each player controls one character. But the observer is the player, not the player's controlled character. Simply: there should only be one camera and it should not be part of the character.

What happens in your scenario is that each character spawns with a camera. When there's 2 or more, they simply draw over each other and you only see the last one. But no player is going to use other player's camera, they shouldn't even exist on their pc. So what you should do is:

Have a controller object, which is one in the scene. This controller will be set to control one of the characters (most likely the one the local player owns). It will read the local player's input (that's right, there is no Input.GetAnything in the character's code) and send commands to the controlled character. It will also read the character's state and move the camera to adequate position (dunno if you are doing first or third person, so this is up to you).

No matter what happens, there will not be multiple controllers in the scene at the same time.

Networking of a game is quite hard and tricky, you need to learn distinguish what's clientside (controller) and serverside (characters)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make camera position relative to a specific target. 1 Answer

How to apply target, while created at runtime? 1 Answer

camera only sticks to the master client 0 Answers

Follow camera jitters on multiplayer clients 1 Answer

How do I make a camera look for a specific GameObject while networking? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges