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
0
Question by RichieJ · Oct 07, 2014 at 04:07 AM · spawningfloating

Player Model Floating after Spawn

Hi, I've been following this tutorial.

https://www.youtube.com/watch?v=yxt6Nbxk8Hw

I'm trying to do the create fps multiplayer but now that I have set everything up. My character is now floating in the air. Before I added the Model to my player controller my character was spawning on the ground, I think but just as a capsul. This is what it looks like now. after I have added the model to my player controller

http://imgur.com/1YOLXN9 playmode http://imgur.com/JIw0aIY nonplaymode1 http://imgur.com/Jhf6tym nonplaymode2

Here is the Network Manager script using UnityEngine; using System.Collections;

public class NetworkManager : MonoBehaviour {

 public GameObject standbyCamera;
 SpawnSpot[] spawnSpots;

 // Use this for initialization
 void Start () {
     spawnSpots = GameObject.FindObjectsOfType<SpawnSpot> ();
     Connect ();
 }

 void Connect() {
     PhotonNetwork.ConnectUsingSettings ( "MultiFPS v001" );
 }

 void OnGUI() {
     GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ());
 }

 void OnJoinedLobby() {
     Debug.Log ("OnJoinedLobby");
     PhotonNetwork.JoinRandomRoom ();
 }

 void OnPhotonRandomJoinFailed() {
     Debug.Log ("OnPhotonRandomJoinFailed");
     PhotonNetwork.CreateRoom (null);
 }

 void OnJoinedRoom() {
     Debug.Log ("OnJoinedRoom");

     SpawnMyPlayer ();
 }

 void SpawnMyPlayer() {
     if (spawnSpots == null) {
          Debug.LogError ("WTF");
          return;
     }

     SpawnSpot mySpawnSpot = spawnSpots [Random.Range (0, spawnSpots.Length)];
     GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate ("PlayerController", mySpawnSpot.transform.position, mySpawnSpot.transform.rotation, 0);
     standbyCamera.SetActive (false);
     myPlayerGO.GetComponent<FPSInputController>().enabled = true;
     myPlayerGO.GetComponent<MouseLook>().enabled = true;
     myPlayerGO.GetComponent<CharacterMotor>().enabled = true;
     myPlayerGO.transform.FindChild ("Main Camera").gameObject.SetActive (true);
 }

}

Here is NetworkCharacter Script

using UnityEngine; using System.Collections;

public class NetworkCharacter : Photon.MonoBehaviour {

 Vector3 realPosition = Vector3.zero;
 Quaternion realRotation = Quaternion.identity;

 // Use this for initialization
 void Start () {
 
 }
 
 // Update is called once per frame
 void Update () {
     if (photonView.isMine) {
         // Do nothing -- the character motor/input/etc... is moving us
     }
     else {
         transform.position = Vector3.Lerp (transform.position, realPosition, 0.1f);
         transform.rotation = Quaternion.Lerp (transform.rotation, realRotation, 0.1f);
     }
 }

 public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
     if(stream.isWriting) {
         // This is OUR player. We need to send our actual position to the network.
         
         stream.SendNext (transform.position);
         stream.SendNext (transform.rotation);
     }
     else {
         // This is someone else's player. We need to receive their position (as of a few
         // millisecond ago, and update our version of that player.
         
         realPosition = (Vector3)stream.ReceiveNext();
         realRotation = (Quaternion)stream.ReceiveNext();
     }
     
 }

}

Here is spawnspots script

using UnityEngine; using System.Collections;

public class SpawnSpot : MonoBehaviour {

 public int team=0;


}

The white blox are my spawnspots

please if you can help me I've been stuck here a while.. Thank you very much. Also, if you need any more information please let me know.

Richie

Comment
Add comment
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

2 Replies

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

Answer by theANMATOR2b · Oct 07, 2014 at 03:29 PM

Hey Richie I know this is a simple (non coder) answer and you've probably already tried this but it looks like your character mesh should be roughly centered in the middle of the character capsule collider instead of at the top of it. http://docs.unity3d.com/Manual/class-CharacterController.html

Comment
Add comment · Show 1 · 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
avatar image RichieJ · Oct 09, 2014 at 01:29 AM 0
Share

Thank you, I was changing the location of the graphics within the collider.. I was forgetting to hit apply after.

Thanks, Richie

avatar image
0

Answer by conceptfac · May 09, 2019 at 04:45 AM

Here is happening the same problem, but offline mode all is normal

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

I made a better shader how do i fix[add _Shadow Strength]help???>Sorry that im asking for to much 1 Answer

Spawning A Grid Of Cubes 2 Answers

JS: Access var inside class 1 Answer

Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers


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