public void UpdateVRObject(int vrObjectId, double xPos, double yPos, double zPos, double xScale, double yScale, double zScale, int xRot, int yRot, int zRot, string value, string colour) { VRObject vrObject = _VRObjectRepository.Get(vrObjectId); if (vrObject != null) { if (vrObject.ObjectType == "QuestionObject") { xScale = 2; yScale = 2; zScale = 0.1; } vrObject.xPos = xPos; vrObject.yPos = yPos; vrObject.zPos = zPos; vrObject.xScale = xScale; vrObject.yScale = yScale; vrObject.zScale = zScale; vrObject.xRot = xRot; vrObject.yRot = yRot; vrObject.zRot = zRot; vrObject.Colour = colour; if (vrObject.ObjectType == "TextObject" || vrObject.ObjectType == "HotSpotObject" || vrObject.ObjectType == "QuestionObject") { vrObject.Value = value; } _VRObjectRepository.UpdateVRObject(vrObjectId, vrObject); } }
private void Init() { vrObject = new VRObject(); WriteTextMessage("{\"id\":\"session/list\",\"serial\":0}"); JObject value = GetResponse(0); // stap 2 (get response) try { var properSession = value["data"].Where(e => e["clientinfo"]["user"].ToObject <string>() == Environment.UserName).Last(); var sessionId = properSession["id"]; this.ServerResponses[0] = null; WriteTextMessage("{\"id\":\"tunnel/create\",\"data\":{\"session\":\"" + sessionId + "\"}}"); } catch (Exception e) { Console.WriteLine(e); throw; } //Console.WriteLine(sessionId); // stap 3 (getting id) Debug.WriteLine("Na tunnel create"); JObject response = GetResponse(0); // stap 4 (get response) var tunnelId = response["data"]["id"]; TunnelId = (string)tunnelId; Debug.WriteLine("Init(): " + TunnelId); this.ServerResponses[0] = null; WriteTextMessage(GenerateMessage(Scene.Reset(2))); WriteTextMessage(GenerateMessage(Scene.Skybox.SetTime(999, 12f))); }
public void AddVRImageObject(IFormFile file, int sceneId, string assetName) { byte[] p1 = null; using (var fs1 = file.OpenReadStream()) using (var ms1 = new MemoryStream()) { fs1.CopyTo(ms1); p1 = ms1.ToArray(); } VRObject imageObject = new VRObject() { AssetName = assetName, ObjectType = "ImageObject", Value = System.Convert.ToBase64String(p1), SceneId = sceneId, Colour = "#FFFFFF", xPos = 0, yPos = 0.5, zPos = -1, xScale = 2, yScale = 2, zScale = 2 }; _VRObjectRepository.Add(imageObject); }
public void DeleteVRObject(int objectId) { VRObject vrObject = _VRObjectRepository.Get(objectId); if (vrObject != null) { _VRObjectRepository.Remove(vrObject); } }
public VRObject GetVROBject(int vrObjectId) { VRObject vrObject = _VRObjectRepository.Get(vrObjectId); if (vrObject != null) { return(vrObject); } else { return(null); } }
private void Release() { if (grabJoint != null) { Physics.IgnoreCollision(grabAttachPoint.GetComponent <Collider>(), grippedObject.GetComponent <Collider>(), false); //vro.SetLayerOfChildren(8); grippedObject.Released(this); Rigidbody rb = grabJoint.gameObject.GetComponent <Rigidbody>(); DestroyImmediate(grabJoint); grabJoint = null; grippedObject = null; RestoreAngularDrive(); } }
public void AddVideoObject(string filePath, int sceneId, string assetName) { VRObject videoObject = new VRObject() { AssetName = assetName, ObjectType = "VideoObject", Value = filePath, SceneId = sceneId, Colour = "#FFFFFF", xPos = 0, yPos = 0.5, zPos = -1, xScale = 2, yScale = 2, zScale = 2 }; _VRObjectRepository.Add(videoObject); }
public void ReplaceVRImageObject(IFormFile file, int objectId) { if (file != null) { byte[] p1 = null; using (var fs1 = file.OpenReadStream()) using (var ms1 = new MemoryStream()) { fs1.CopyTo(ms1); p1 = ms1.ToArray(); } VRObject vrObject = _VRObjectRepository.Get(objectId); if (vrObject != null) { _VRObjectRepository.ReplaceVRImageObject(p1, objectId); } } }
public void AddAudio(string fileName, int sceneId, string assetName) { VRObject audioObject = new VRObject() { AssetName = assetName, ObjectType = "AudioObject", Value = fileName, SceneId = sceneId, Colour = "#FFFFFF", xPos = 0, yPos = 0.5, zPos = -1, xScale = 1, yScale = 1, zScale = 1, }; _VRObjectRepository.Add(audioObject); }
private void OnTriggerExit(Collider other) { Debug.Log("Exit: " + other.gameObject.name); VRObject vrObj = other.gameObject.GetComponent <VRObject>(); if (!vrObj) { vrObj = other.gameObject.GetComponentInParent <VRObject>(); } if (vrObj) { VRObjectCollidingList.Remove(vrObj); } GrabPoint grabPoint = other.gameObject.GetComponent <GrabPoint>(); if (grabPoint) { GrabPointCollidingList.Remove(grabPoint); } }
public void AddVRTextObject(string Text, int SceneId, string assetName) { VRObject textObject = new VRObject() { AssetName = assetName, ObjectType = "TextObject", Value = Text, SceneId = SceneId, Colour = "#000000", xPos = 0, yPos = 0.5, zPos = -1, xScale = 4, yScale = 4, zScale = 4, xRot = 0, yRot = 0, zRot = 0 }; _VRObjectRepository.Add(textObject); }
public void AddVRObject(VRObject backgroundObject) { _VRObjectRepository.Add(backgroundObject); }
private void Grip() { if (grabJoint == null) { //We try to grab GrabPoints before trying to grab VRObjects themselves. VRObject objectToGrip = null; GrabPoint grabbedGrabPoint = null; int highestPriority = int.MinValue; foreach (GrabPoint grabPoint in GrabPointCollidingList) { VRObject grabPointParent = grabPoint.GetParentVRObject(); if (grabPointParent.priority + 1 > highestPriority) { objectToGrip = grabPointParent; highestPriority = grabPointParent.priority + 1; grabbedGrabPoint = grabPoint; } } foreach (VRObject vrObj in VRObjectCollidingList) { if (vrObj.priority > highestPriority) { objectToGrip = vrObj; highestPriority = vrObj.priority; grabbedGrabPoint = null; } } if (objectToGrip) { Debug.Log("gripped", this); if (grabbedGrabPoint) { grabAttachPoint.transform.rotation = objectToGrip.transform.rotation; Vector3 grabPointRotationOffset = grabbedGrabPoint.transform.eulerAngles - grabAttachPoint.transform.eulerAngles; grabAttachPoint.transform.eulerAngles += grabPointRotationOffset + grabbedGrabPoint.rotationOffset; grabAttachPoint.transform.position = objectToGrip.transform.position; Vector3 grabPointPositionOffset = grabbedGrabPoint.transform.position - grabAttachPoint.transform.position; grabAttachPoint.transform.position += grabPointPositionOffset + grabbedGrabPoint.postitionOffset; Physics.IgnoreCollision(grabAttachPoint.GetComponent <Collider>(), objectToGrip.GetComponent <Collider>()); } grabJoint = grabAttachPoint.gameObject.AddComponent <FixedJoint>(); grabJoint.enablePreprocessing = false; if (objectToGrip.grabList.Count > 0) { RemoveAngularDrive(); } grabJoint.enableCollision = false; grabJoint.connectedBody = objectToGrip.GetComponent <Rigidbody>(); objectToGrip.Gripped(this); grippedObject = objectToGrip; } } }
public void DeleteVRObject(int objectId) { VRObject vrObject = _VRObjectService.GetVROBject(objectId); _VRObjectService.DeleteVRObject(objectId); }
public void TestGetVROBject_Success() { VRObject result = _objectService.GetVROBject(0); Assert.Equal(expectedObject, result); }
public void TestGetVROBject_IncorrectID_ShouldBeNull() { VRObject result = _objectService.GetVROBject(1); Assert.Null(result); }
public void TestGetVROBject_IncorrectID() { VRObject result = _objectService.GetVROBject(1); Assert.NotEqual(expectedObject, result); }
public void SetParentVRObject(VRObject newParent) { parentVRObject = newParent; }