Exemple #1
0
        //!
        //! reposition the camera to predefined positions
        //!
        public void repositionCamera()
        {
            if (!arMode && activeMode != Mode.lookThroughLightMode)
            {
                setPerspectiveCamera();
                if (SceneLoader.SceneCameraList.Count > 0)
                {
                    GameObject        camObject   = SceneLoader.SceneCameraList[camPrefabPosition];
                    SceneObjectCamera soc         = camObject.GetComponent <SceneObjectCamera>();
                    GameObject        camGeometry = camObject.transform.GetChild(0).gameObject;
                    camGeometry.SetActive(false);
                    cameraAdapter.registerNearObject(camGeometry);
#if USE_AR
                    scene.transform.position = Vector3.zero;
                    scene.transform.rotation = Quaternion.identity;
                    GameObject.Find("Cameras").GetComponent <ARSessionOrigin>().MakeContentAppearAt(scene.transform, Camera.main.transform.position);
                    Quaternion newRotation = Camera.main.transform.rotation * Quaternion.Inverse(camObject.transform.rotation);
                    GameObject.Find("Cameras").GetComponent <ARSessionOrigin>().MakeContentAppearAt(scene.transform, newRotation);
                    Vector3 newPosition = -(camObject.transform.position + Camera.main.transform.position);
                    GameObject.Find("Cameras").GetComponent <ARSessionOrigin>().MakeContentAppearAt(scene.transform, newPosition);
                    Camera.main.nearClipPlane = 0.01f;
                    Camera.main.farClipPlane  = soc.far * 2f;
                    Camera.main.fieldOfView   = soc.fov;
#else
                    Camera.main.transform.position = camObject.transform.position;
                    Camera.main.transform.rotation = camObject.transform.rotation;
                    Camera.main.nearClipPlane      = 0.01f;
                    Camera.main.farClipPlane       = soc.far * 2f;
                    Camera.main.fieldOfView        = soc.fov;

                    // callibrate
                    cameraAdapter.calibrate(camObject.transform.rotation);
#endif
                    // set camera properties
                    CameraObject camScript = camObject.GetComponent <CameraObject>();
                    if (camScript != null)
                    {
                        Camera.main.fieldOfView = camScript.fov; //.hFovToVFov(); // convert horizontal fov from Katana to vertical
                                                                 //Camera.main.nearClipPlane = camScript.near * VPETSettings.Instance.sceneScale;
                                                                 //Camera.main.farClipPlane = camScript.far * VPETSettings.Instance.sceneScale;
                        UpdatePropertiesSecondaryCameras();
                    }
                }
                if (SceneLoader.SceneCameraList.Count == 0)
                {
                    camPrefabPosition = 0;
                }
                else
                {
                    camPrefabPosition = (camPrefabPosition + 1) % SceneLoader.SceneCameraList.Count;
                }
            }
        }
Exemple #2
0
        //!
        //! function create the object from mesh data
        //! @param  node   object which holds the data
        //! @param  parentTransform   parent object
        //!
        public static GameObject CreateCamera(SceneNodeCam nodeCam, Transform parentTransform)
        {
            // Tranform
            Vector3    pos = new Vector3(nodeCam.position[0], nodeCam.position[1], nodeCam.position[2]);
            Quaternion rot = new Quaternion(nodeCam.rotation[0], nodeCam.rotation[1], nodeCam.rotation[2], nodeCam.rotation[3]);
            Vector3    scl = new Vector3(nodeCam.scale[0], nodeCam.scale[1], nodeCam.scale[2]);

            // set up object basics
            GameObject objMain = new GameObject();

            objMain.name = Encoding.ASCII.GetString(nodeCam.name);

            // add camera dummy mesh
            GameObject cameraObject   = Resources.Load <GameObject>("VPET/Prefabs/cameraObject");
            GameObject cameraInstance = GameObject.Instantiate(cameraObject);

            cameraInstance.SetActive(false);
            cameraInstance.name = cameraObject.name;
            cameraInstance.transform.SetParent(objMain.transform, false);
            cameraInstance.transform.localScale    = new Vector3(1, 1, 1) * VPETSettings.Instance.sceneScale * 20.0f;
            cameraInstance.transform.localPosition = new Vector3(0, 0, 0);
            cameraInstance.transform.localRotation = Quaternion.AngleAxis(180, Vector3.up);

            // add camera data script and set values
            //if (nodeCam.editable)
            //{
            SceneObjectCamera sco = objMain.AddComponent <SceneObjectCamera>();

            sco.id   = idCount++;
            sco.fov  = nodeCam.fov;
            sco.near = nodeCam.near;
            sco.far  = nodeCam.far;
            //}

            // place camera
            objMain.transform.parent        = parentTransform;
            objMain.transform.localPosition = pos;
            objMain.transform.localRotation = rot;
            objMain.transform.localScale    = scl;

            // Rotate 180 around y-axis because lights and cameras have additional eye space coordinate system
            //objMain.transform.Rotate(new Vector3(0, 180f, 0), Space.Self);

            // TODO: what for ??
            objMain.layer = 0;

            // add to list for later access as camera location
            SceneLoader.SceneCameraList.Add(objMain);

            return(objMain);
        }
        public void setCamParamFocalLength(float focalLength)
        {
            float fov = Extensions.lensToVFov(focalLength);

            serverAdapter.SendObjectUpdate(currentSceneObject, ParameterType.FOV);
            SceneObjectCamera currentCamera = (SceneObjectCamera)currentSceneObject;

            if (currentCamera)
            {
                currentCamera.fov = fov;
            }
            if (activeMode == Mode.lookThroughCamMode)
            {
                cameraAdapter.Fov = fov;
            }
        }
Exemple #4
0
        //!
        //! reposition the camera to predefined positions
        //!
        public void repositionCamera()
        {
            if (!arMode && activeMode != Mode.lookThroughLightMode)
            {
                setPerspectiveCamera();
                if (SceneLoader.SceneCameraList.Count > 0)
                {
                    GameObject        camObject   = SceneLoader.SceneCameraList[camPrefabPosition];
                    SceneObjectCamera soc         = camObject.GetComponent <SceneObjectCamera>();
                    GameObject        camGeometry = camObject.transform.GetChild(0).gameObject;
                    camGeometry.SetActive(false);
                    cameraAdapter.registerNearObject(camGeometry);

                    Camera.main.transform.position = camObject.transform.position;
                    Camera.main.transform.rotation = camObject.transform.rotation;
                    Camera.main.nearClipPlane      = 0.1f * VPETSettings.Instance.sceneScale;
                    Camera.main.farClipPlane       = soc.far;
                    Camera.main.fieldOfView        = soc.fov;

                    // callibrate
                    cameraAdapter.calibrate(camObject.transform.rotation);

                    // set camera properties
                    CameraObject camScript = camObject.GetComponent <CameraObject>();
                    if (camScript != null)
                    {
                        Camera.main.fieldOfView = camScript.fov; //.hFovToVFov(); // convert horizontal fov from Katana to vertical
                                                                 //Camera.main.nearClipPlane = camScript.near * VPETSettings.Instance.sceneScale;
                                                                 //Camera.main.farClipPlane = camScript.far * VPETSettings.Instance.sceneScale;
                        UpdatePropertiesSecondaryCameras();
                    }
                    // set properties for DOF component from CameraObject
                    //Camera.main.GetComponent<DepthOfField>().focalLength = camScript.focDist;
                    //Camera.main.GetComponent<DepthOfField>().focalSize = camScript.focSize;
                    //Camera.main.GetComponent<DepthOfField>().aperture = camScript.aperture;
                }
                if (SceneLoader.SceneCameraList.Count == 0)
                {
                    camPrefabPosition = 0;
                }
                else
                {
                    camPrefabPosition = (camPrefabPosition + 1) % SceneLoader.SceneCameraList.Count;
                }
            }
        }
Exemple #5
0
        ////! function to be called to send a lock signal to server
        ////! @param  obj             Transform of GameObject to be locked
        ////! @param  locked          should it be locked or unlocked
        //public void sendLock(Transform obj, bool locked)
        //{
        //    if (locked) // lock it
        //    {
        //        if (currentlyLockedObject != null && currentlyLockedObject != obj && !deactivatePublish) // is another object already locked, release it first
        //        {
        //            string msg = "client " + id + "|" + "l" + "|" + vpet.Extensions.getPathString(currentlyLockedObject, scene) + "|" + false;
        //            SendObjectUpdate<ObjectSenderBasic>(msg);
        //            // print("Unlock object " + currentlyLockedObject.gameObject.name );
        //        }
        //        if (currentlyLockedObject != obj && !deactivatePublish) // lock the object if it is not locked yet
        //        {
        //            string msg = "client " + id + "|" + "l" + "|" + vpet.Extensions.getPathString(obj, scene) + "|" + true;
        //            SendObjectUpdate<ObjectSenderBasic>(msg);
        //            // print("Lock object " + obj.gameObject.name);
        //        }
        //        currentlyLockedObject = obj;
        //    }
        //    else // unlock it
        //    {
        //        if (currentlyLockedObject != null && !deactivatePublish) // unlock if locked
        //        {
        //            string msg = "client " + id + "|" + "l" + "|" + vpet.Extensions.getPathString(obj, scene) + "|" + false;
        //            SendObjectUpdate<ObjectSenderBasic>(msg);
        //            // print("Unlock object " + obj.gameObject.name);
        //        }
        //        currentlyLockedObject = null;
        //    }
        //}  // commented at sync update rewrite


        //! function parsing received message and executing change
        //! @param  message         message string received by server
        public void parseTransformation(byte[] msg)
        {
            if (msg[0] != m_id)
            {
                ParameterType paramType   = (ParameterType)msg[1];
                int           objectID    = BitConverter.ToInt32(msg, 2);
                SceneObject   sceneObject = sceneObjectRefList[objectID];

                switch (paramType)
                {
                case ParameterType.POS:
                {
#if !SCENE_HOST
                    if (!mainController.isTranslating)
#endif
                    {
                        sceneObject.transform.localPosition = new Vector3(BitConverter.ToSingle(msg, 6),
                                                                          BitConverter.ToSingle(msg, 10),
                                                                          BitConverter.ToSingle(msg, 14));
                    }
                }
                break;

                case ParameterType.ROT:
                {
#if !SCENE_HOST
                    if (!mainController.isRotating)
#endif
                    {
                        sceneObject.transform.localRotation = new Quaternion(BitConverter.ToSingle(msg, 6),
                                                                             BitConverter.ToSingle(msg, 10),
                                                                             BitConverter.ToSingle(msg, 14),
                                                                             BitConverter.ToSingle(msg, 18));
                    }
                }
                break;

                case ParameterType.SCALE:
                {
#if !SCENE_HOST
                    if (!mainController.isScaling)
#endif
                    {
                        sceneObject.transform.localScale = new Vector3(BitConverter.ToSingle(msg, 6),
                                                                       BitConverter.ToSingle(msg, 10),
                                                                       BitConverter.ToSingle(msg, 14));
                    }
                }
                break;

                case ParameterType.LOCK:
                {
#if SCENE_HOST
                    if (!sceneObject.isAnimatedCharacter)
                    {
#endif
                    bool locked = BitConverter.ToBoolean(msg, 6);
                    sceneObject.enableRigidbody(!locked);
                    sceneObject.locked = locked;
#if !SCENE_HOST
                    sceneObject.updateLockView();
#endif
#if SCENE_HOST
                }
#endif
                }
                    break;

                case ParameterType.HIDDENLOCK:
                {
#if SCENE_HOST
                    if (!sceneObject.isAnimatedCharacter)
#endif
                    {
                        bool locked = BitConverter.ToBoolean(msg, 6);
                        sceneObject.enableRigidbody(!locked);
                        sceneObject.locked = locked;
                    }
                }
                break;

                case ParameterType.KINEMATIC:
                {
                    sceneObject.globalKinematic = BitConverter.ToBoolean(msg, 6);
                }
                break;

                case ParameterType.FOV:
                {
                    SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                    if (soc)
                    {
                        soc.fov = BitConverter.ToSingle(msg, 6);
                    }
                }
                break;

                case ParameterType.ASPECT:
                {
                    SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                    if (soc)
                    {
                        soc.aspect = BitConverter.ToSingle(msg, 6);
                    }
                }
                break;

                case ParameterType.FOCUSDIST:
                {
                    SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                    if (soc)
                    {
                        soc.focDist = BitConverter.ToSingle(msg, 6);
                    }
                }
                break;

                case ParameterType.FOCUSSIZE:
                {
                    SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                    if (soc)
                    {
                        soc.focSize = BitConverter.ToSingle(msg, 6);
                    }
                }
                break;

                case ParameterType.APERTURE:
                {
                    SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                    if (soc)
                    {
                        soc.aperture = BitConverter.ToSingle(msg, 6);
                    }
                }
                break;

                case ParameterType.COLOR:
                {
                    SceneObjectLight sol = (SceneObjectLight)sceneObject;
                    if (sol)
                    {
                        sol.transform.GetChild(0).GetComponent <Light>().color = new Color(BitConverter.ToSingle(msg, 6),
                                                                                           BitConverter.ToSingle(msg, 10),
                                                                                           BitConverter.ToSingle(msg, 14));
                    }
                }
                break;

                case ParameterType.INTENSITY:
                {
                    SceneObjectLight sol = (SceneObjectLight)sceneObject;
                    if (sol)
                    {
                        sol.transform.GetChild(0).GetComponent <Light>().intensity = BitConverter.ToSingle(msg, 6);
                    }
                }
                break;

                case ParameterType.EXPOSURE:
                {
                    // no exposure for unity lights
                    // used for katana
                }
                break;

                case ParameterType.RANGE:
                {
                    SceneObjectLight sol = (SceneObjectLight)sceneObject;
                    if (sol)
                    {
                        sol.transform.GetChild(0).GetComponent <Light>().range = BitConverter.ToSingle(msg, 6);
                    }
                }
                break;

                case ParameterType.ANGLE:
                {
                    SceneObjectLight sol = (SceneObjectLight)sceneObject;
                    if (sol)
                    {
                        sol.transform.GetChild(0).GetComponent <Light>().spotAngle = BitConverter.ToSingle(msg, 6);
                    }
                }
                break;

                case ParameterType.BONEANIM:
                {
                    Vector3 hipPosition = new Vector3(BitConverter.ToSingle(msg, 6),
                                                      BitConverter.ToSingle(msg, 10),
                                                      BitConverter.ToSingle(msg, 14));

                    int          offset         = 12;
                    int          numBones       = Enum.GetNames(typeof(HumanBodyBones)).Length - 1;
                    Quaternion[] animationState = new Quaternion[numBones];
                    for (int i = 0; i < numBones; i++)
                    {
                        animationState[i] = new Quaternion(BitConverter.ToSingle(msg, offset + 6),
                                                           BitConverter.ToSingle(msg, offset + 10),
                                                           BitConverter.ToSingle(msg, offset + 14),
                                                           BitConverter.ToSingle(msg, offset + 18));
                        offset += 16;
                    }
#if !SCENE_HOST
                    if (!mainController.isTranslating)
#endif
                    sceneObject.gameObject.GetComponent <CharacterAnimationController>().bodyPosition   = hipPosition;
                    sceneObject.gameObject.GetComponent <CharacterAnimationController>().animationState = animationState;
                }
                break;

                case ParameterType.PING:
                {
                    // only for sync server
                }
                break;

                case ParameterType.RESENDUPDATE:
                {
                    // only for sync server
                }
                break;

                case ParameterType.CHARACTERTARGET:
                {
#if SCENE_HOST
                    NavMeshAgent navMeshAgent = sceneObject.transform.GetComponent <NavMeshAgent>();
                    if (navMeshAgent)
                    {
                        navMeshAgent.destination = new Vector3(BitConverter.ToSingle(msg, 6),
                                                               BitConverter.ToSingle(msg, 10),
                                                               BitConverter.ToSingle(msg, 14));
                    }
#endif
                }
                break;

                default:
                    Debug.Log("Unknown paramType in ServerAdapter:ParseTransformation");
                    return;

                    break;
                }
#if SCENE_HOST
                if (recordUpdates)
                {
                    buildRecordMessage(sceneObject, paramType);
                }
#endif
            }
        }
Exemple #6
0
        public override void SendObject(byte cID, SceneObject sceneObject, ParameterType paramType, bool sendParent, Transform parent)
        {
            if (!sceneObject)
            {
                return;
            }

            string dagPath = vpet.Extensions.getPathString(sceneObject.transform, root);

            // HACK check missing '/' upstream
            dagPath = "/" + dagPath;

            //Debug.Log(dagPath);

            NodeType nodeType = NodeType.GROUP;

            if (sceneObject is SceneObjectLight)
            {
                nodeType = NodeType.LIGHT;
            }
            else if (sceneObject is SceneObjectCamera)
            {
                nodeType = NodeType.CAMERA;
            }

            if (paramType == ParameterType.POS ||
                paramType == ParameterType.ROT ||
                paramType == ParameterType.SCALE)

            {
                if (nodeType == NodeType.LIGHT) // do transform for lights to katana differently
                {
                    Transform obj = sceneObject.transform;

                    Vector3    pos = obj.localPosition;
                    Quaternion rot = obj.localRotation;
                    Vector3    scl = obj.localScale;

                    Quaternion rotY180 = Quaternion.AngleAxis(180, Vector3.up);
                    rot = rot * rotY180;
                    float   angle = 0;
                    Vector3 axis  = Vector3.zero;
                    rot.ToAngleAxis(out angle, out axis);

                    sendMessageQueue.Add(Encoding.UTF8.GetBytes(String.Format(lightTransRotTemplate,
                                                                              dagPath,
                                                                              (-pos.x + " " + pos.y + " " + pos.z),
                                                                              (angle + " " + axis.x + " " + -axis.y + " " + -axis.z),
                                                                              (scl.x + " " + scl.y + " " + scl.z))));
                }
                else if (nodeType == NodeType.CAMERA) // do camera different too --> in fact is the same as for lights??
                {
                    Transform obj = sceneObject.transform;

                    Vector3    pos = obj.localPosition;
                    Quaternion rot = obj.localRotation;
                    Vector3    scl = obj.localScale;

                    Quaternion rotY180 = Quaternion.AngleAxis(180, Vector3.up);
                    rot = rot * rotY180;
                    float   angle = 0;
                    Vector3 axis  = Vector3.zero;
                    rot.ToAngleAxis(out angle, out axis);

                    sendMessageQueue.Add(Encoding.UTF8.GetBytes(String.Format(camTransRotTemplate,
                                                                              dagPath,
                                                                              (-pos.x + " " + pos.y + " " + pos.z),
                                                                              (angle + " " + axis.x + " " + -axis.y + " " + -axis.z),
                                                                              (scl.x + " " + scl.y + " " + scl.z))));
                }
                else
                {
                    Transform obj = sceneObject.transform;

                    Vector3    pos = obj.localPosition;
                    Quaternion rot = obj.localRotation;
                    Vector3    scl = obj.localScale;

                    float   angle = 0;
                    Vector3 axis  = Vector3.zero;
                    rot.ToAngleAxis(out angle, out axis);

                    sendMessageQueue.Add(Encoding.UTF8.GetBytes(String.Format(objTemplateQuat,
                                                                              dagPath,
                                                                              (-pos.x + " " + pos.y + " " + pos.z),
                                                                              (angle + " " + axis.x + " " + -axis.y + " " + -axis.z),
                                                                              (scl.x + " " + scl.y + " " + scl.z))));
                }
            }
            else if (paramType == ParameterType.ANGLE ||
                     paramType == ParameterType.COLOR ||
                     paramType == ParameterType.INTENSITY ||
                     paramType == ParameterType.RANGE ||
                     paramType == ParameterType.EXPOSURE ||
                     paramType == ParameterType.FOV)
            {
                if (nodeType == NodeType.LIGHT)
                {
                    SceneObjectLight sol       = (SceneObjectLight)sceneObject;
                    Light            light     = sol.SourceLight;
                    LightTypeKatana  lightType = (LightTypeKatana)(light.type);

                    if (sol.isAreaLight)
                    {
                        lightType = LightTypeKatana.rect;
                    }

                    sendMessageQueue.Add(Encoding.UTF8.GetBytes(String.Format(lightIntensityColorTemplate,
                                                                              dagPath,
                                                                              (lightType).ToString(),
                                                                              light.color.r + " " + light.color.g + " " + light.color.b,
                                                                              light.intensity / VPETSettings.Instance.lightIntensityFactor,
                                                                              sol.exposure,
                                                                              light.spotAngle)));
                }
                else if (nodeType == NodeType.CAMERA)
                {
                    SceneObjectCamera sol = (SceneObjectCamera)sceneObject;

                    sendMessageQueue.Add(Encoding.UTF8.GetBytes(String.Format(camFOVTemplate,
                                                                              dagPath,
                                                                              Extensions.vFovToHFov(sol.fov, 16, 9))));
                }
            }
        }
Exemple #7
0
        public override void SendObject(byte cID, SceneObject sceneObject, ParameterType paramType, bool sendParent, Transform parent)
        {
#if SCENE_HOST
            if (sceneObject && paramType != ParameterType.LOCK)
            {
                if (!sceneObject.selected)
                {
                    sceneObject.unlockTime = 0.5f;
                    sceneObject.selected   = true;
                    SendObject(cID, sceneObject, ParameterType.LOCK, sendParent, parent);
                }
            }
#endif
            byte[] msg = null;
            switch (paramType)
            {
            case ParameterType.POS:
            {
                Vector3 locPos;
                if (sendParent)
                {
                    locPos = sceneObject.transform.position - parent.position;
                }
                else
                {
                    locPos = sceneObject.transform.localPosition;
                }

                msg = new byte[18];

                msg[0] = cID;
                msg[1] = (byte)paramType;
                Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locPos.x), 0, msg, 6, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locPos.y), 0, msg, 10, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locPos.z), 0, msg, 14, 4);
            }
            break;

            case ParameterType.ROT:
            {
                Quaternion locRot;
                if (sendParent)
                {
                    locRot = Quaternion.Inverse(parent.rotation) * sceneObject.transform.rotation;
                }
                else
                {
                    locRot = sceneObject.transform.localRotation;
                }
                msg = new byte[22];

                msg[0] = cID;
                msg[1] = (byte)paramType;
                Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locRot.x), 0, msg, 6, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locRot.y), 0, msg, 10, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locRot.z), 0, msg, 14, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locRot.w), 0, msg, 18, 4);
            }
            break;

            case ParameterType.SCALE:
            {
                Vector3 locScale = sceneObject.transform.localScale;
                msg = new byte[18];

                msg[0] = cID;
                msg[1] = (byte)paramType;
                Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locScale.x), 0, msg, 6, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locScale.y), 0, msg, 10, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(locScale.z), 0, msg, 14, 4);
            }
            break;

            case ParameterType.LOCK:
            {
                msg = new byte[7];

                msg[0] = cID;
                msg[1] = (byte)paramType;
                Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                msg[6] = Convert.ToByte(sceneObject.selected);
            }
            break;

            case ParameterType.HIDDENLOCK:
            {
                msg = new byte[7];

                msg[0] = cID;
                msg[1] = (byte)paramType;
                Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                msg[6] = Convert.ToByte(sceneObject.isPhysicsActive || sceneObject.isPlayingAnimation);
            }
            break;

            case ParameterType.KINEMATIC:
            {
                msg = new byte[7];

                msg[0] = cID;
                msg[1] = (byte)paramType;
                Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                msg[6] = Convert.ToByte(sceneObject.globalKinematic);
            }
            break;

            case ParameterType.FOV:
            {
                SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                if (soc)
                {
                    msg = new byte[10];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(soc.fov), 0, msg, 6, 4);
                }
            }
            break;

            case ParameterType.ASPECT:
            {
                SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                if (soc)
                {
                    msg = new byte[10];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(soc.aspect), 0, msg, 6, 4);
                }
            }
            break;

            case ParameterType.FOCUSDIST:
            {
                SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                if (soc)
                {
                    msg = new byte[10];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(soc.focDist), 0, msg, 6, 4);
                }
            }
            break;

            case ParameterType.FOCUSSIZE:
            {
                SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                if (soc)
                {
                    msg = new byte[10];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(soc.focSize), 0, msg, 6, 4);
                }
            }
            break;

            case ParameterType.APERTURE:
            {
                SceneObjectCamera soc = (SceneObjectCamera)sceneObject;
                if (soc)
                {
                    msg = new byte[10];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(soc.aperture), 0, msg, 6, 4);
                }
            }
            break;

            case ParameterType.COLOR:
            {
                SceneObjectLight sol = (SceneObjectLight)sceneObject;
                if (sol)
                {
                    Color color = sol.getLightColor();
                    msg = new byte[18];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(color.r), 0, msg, 6, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(color.g), 0, msg, 10, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(color.b), 0, msg, 14, 4);
                }
            }
            break;

            case ParameterType.INTENSITY:
            {
                SceneObjectLight sol = (SceneObjectLight)sceneObject;
                if (sol)
                {
                    msg = new byte[10];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(sol.getLightIntensity()), 0, msg, 6, 4);
                }
            }
            break;

            case ParameterType.EXPOSURE:
            {
                SceneObjectLight sol = (SceneObjectLight)sceneObject;
                if (sol)
                {
                    msg = new byte[10];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(sol.exposure), 0, msg, 6, 4);
                }
            }
            break;

            case ParameterType.RANGE:
            {
                SceneObjectLight sol = (SceneObjectLight)sceneObject;
                if (sol)
                {
                    msg = new byte[10];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(sol.getLightRange()), 0, msg, 6, 4);
                }
            }
            break;

            case ParameterType.ANGLE:
            {
                SceneObjectLight sol = (SceneObjectLight)sceneObject;
                if (sol)
                {
                    msg = new byte[10];

                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(sol.getLightAngle()), 0, msg, 6, 4);
                }
            }
            break;

            case ParameterType.BONEANIM:
            {
                Animator animator = sceneObject.gameObject.GetComponent <Animator>();

                if (animator)
                {
                    int numHBones = Enum.GetNames(typeof(HumanBodyBones)).Length - 1;
                    msg = new byte[18 + numHBones * 16];

                    //TODO: check what needs to be send here to support all character variants
                    Vector3 locPos = animator.bodyPosition;
                    msg[0] = cID;
                    msg[1] = (byte)paramType;
                    Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(locPos.x), 0, msg, 6, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(locPos.y), 0, msg, 10, 4);
                    Buffer.BlockCopy(BitConverter.GetBytes(locPos.z), 0, msg, 14, 4);
                    int offset = 12;

                    for (int i = 0; i < numHBones; i++)
                    {
                        Transform t = animator.GetBoneTransform((HumanBodyBones)i);
                        if (t)
                        {
                            Buffer.BlockCopy(BitConverter.GetBytes(t.localRotation.x), 0, msg, offset + 6, 4);
                            Buffer.BlockCopy(BitConverter.GetBytes(t.localRotation.y), 0, msg, offset + 10, 4);
                            Buffer.BlockCopy(BitConverter.GetBytes(t.localRotation.z), 0, msg, offset + 14, 4);
                            Buffer.BlockCopy(BitConverter.GetBytes(t.localRotation.w), 0, msg, offset + 18, 4);
                            offset += 16;
                        }
                    }
                }
            }
            break;

            case ParameterType.PING:
            {
                msg = new byte[2];

                msg[0] = cID;
                msg[1] = (byte)paramType;
            }
            break;

            case ParameterType.RESENDUPDATE:
            {
                msg = new byte[2];

                msg[0] = cID;
                msg[1] = (byte)paramType;
            }
            break;

            case ParameterType.CHARACTERTARGET:
            {
                Vector3 targetPos = sceneObject.targetTranslation;

                msg = new byte[18];

                msg[0] = cID;
                msg[1] = (byte)paramType;
                Buffer.BlockCopy(BitConverter.GetBytes((Int32)sceneObject.id), 0, msg, 2, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(targetPos.x), 0, msg, 6, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(targetPos.y), 0, msg, 10, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(targetPos.z), 0, msg, 14, 4);
            }
            break;

            default:
            {
                Debug.Log("Unknown paramType in ObjectSenderBasic:SendObject");
            }
            break;
            }
            if (msg != null)
            {
                sendMessageQueue.Add(msg);
            }
        }