コード例 #1
0
    public void LoadModelForAll(string modelName)
    {
        Vector3 spawnPosition      = Camera.main.transform.position + Camera.main.transform.forward * 2.5f;
        Vector3 localSpawnPosition = worldAnchor.InverseTransformPoint(spawnPosition); // get coordinates in world-anchor-local space

        BoundingBoxId id = new BoundingBoxId();

        CustomMessages.Instance.SendModelSpawn(modelName, id, localSpawnPosition); // broadcast spawn event

        ModelLoadManager manager = new ModelLoadManager(localSpawnPosition, worldAnchor, id, false);

        manager.Load(modelName); // load model
    }
コード例 #2
0
    public void RemoteModelSpawned(NetworkInMessage msg)
    {
        Debug.Log("Received remote model spawn");
        long userId = msg.ReadInt64();

        if (userId != SharingStage.Instance.Manager.GetLocalUser().GetID())
        {
            string           modelName     = msg.ReadString();
            int              localBoxId    = msg.ReadInt32();
            BoundingBoxId    boundingBoxId = new BoundingBoxId(userId, localBoxId);
            Vector3          spawnPosition = CustomMessages.Instance.ReadVector3(msg);
            ModelLoadManager manager       = new ModelLoadManager(spawnPosition, worldAnchor, boundingBoxId, true);
            manager.Load(modelName);
        }
    }