tag:blogger.com,1999:blog-5295746446529817470.post2876854214767719033..comments2023-05-09T16:29:24.130+02:00Comments on Dotnet by Example: Manipulating Holograms (move, scale, rotate) by gesturesJoost van Schaikhttp://www.blogger.com/profile/02182444268071162776noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-5295746446529817470.post-55918731802859940512017-12-20T19:59:19.151+01:002017-12-20T19:59:19.151+01:00Hi @Hpk it's Joost, but never mind;)
I don...Hi @Hpk it's Joost, but never mind;)<br /><br />I don't know if this will really work on UI elements. It relies on objects having a collider. Does it work on a 'normal' object, like a cube? If so, you might have to think of a work around<br />Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-73673226839303638952017-12-19T10:52:33.197+01:002017-12-19T10:52:33.197+01:00Hi Josh, thanks a lot for your tuto!
However I can...Hi Josh, thanks a lot for your tuto!<br />However I can't make it work on UI elements. I imported your package into my project and added components to my UI. Am I missing any steps here ?Hpk bloggerhttps://www.blogger.com/profile/16033905641211894335noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-28131802827984666292017-11-07T13:22:46.918+01:002017-11-07T13:22:46.918+01:00Have you downloaded the code and worked from that?...Have you downloaded the code and worked from that?Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-50652001169921560322017-11-06T23:29:54.467+01:002017-11-06T23:29:54.467+01:00Hey Joost!
I am getting an error in the AppStateM...Hey Joost!<br /><br />I am getting an error in the AppStateManager. It says that GetManipulator does not exist. <br /><br />I am implementing it directly from your code.<br /><br />Any help would be great!Anonymoushttps://www.blogger.com/profile/13838629617989547314noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-85558376768973882062017-07-12T11:06:29.430+02:002017-07-12T11:06:29.430+02:00Nice one, RJ! Thanks for being a community sport!Nice one, RJ! Thanks for being a community sport!Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-36653506493739099082017-07-11T16:31:31.204+02:002017-07-11T16:31:31.204+02:00That last one didn't work. I ended up taking t...That last one didn't work. I ended up taking the difference between the Z positions of the main camera and the game object, and if it was positive, I flipped the sign on manipulationData.<br /><br />Here's the code I went with:<br /><br />void Rotate(Vector3 manipulationData)<br /> {<br /> var rotFix = Camera.main.transform.position.z - gameObject.transform.position.z;<br /> if (rotFix < 0)<br /> {<br /> transform.RotateAround(transform.position, gameObject.transform.up,<br /> (-manipulationData.x) * RotateSpeed);<br /> }<br /> else<br /> {<br /> transform.RotateAround(transform.position, gameObject.transform.up,<br /> (manipulationData.x) * RotateSpeed);<br /> }<br /> }<br /><br />Thanks,<br />RJUnknownhttps://www.blogger.com/profile/07188145968159559066noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-12047435558105279982017-07-07T18:08:35.668+02:002017-07-07T18:08:35.668+02:00I came up with a quick fix by taking the angle bet...I came up with a quick fix by taking the angle between the raycast and the z-axis of the game object, rounding to the nearest 180 degrees, and adding that to the manipulationData.x angle. Basically as soon as you cross the x-axis of the object, it will switch positive values to negative. It's not pretty, but it should work. You might have a better idea though.<br /><br />Here's the method:<br /><br />void Rotate(Vector3 manipulationData)<br /><br />{<br /><br /> //calc angle<br /><br /> var cameraDir = Camera.mainCamera.transform.position;<br /><br /> var forward = transform.forward;<br /><br /> var angle = Vector3.Angle(cameraDir, forward);<br /><br /><br /><br /> var angOffset = (angle > -90) && (angle < 90) ? 0 : 180;<br /><br /><br /><br /> transform.RotateAround(transform.position, gameObject.transform.up,<br /><br /> (angOffset - manipulationData.x) * RotateSpeed);<br /><br />}<br /><br />Let me know what you think!Unknownhttps://www.blogger.com/profile/07188145968159559066noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-42730821615382647132017-07-07T11:20:04.485+02:002017-07-07T11:20:04.485+02:00That is an interesting question. I had not thought...That is an interesting question. I had not thought about that, but you are right. Even without trying it I can see that happen. I will need to think about that. Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-42632384100457332622017-07-05T18:08:18.431+02:002017-07-05T18:08:18.431+02:00Hi Joost, great stuff here. Love your website. I u...Hi Joost, great stuff here. Love your website. I used your tutorial for guidance on an app I'm developing but I'm running into a small issue.<br /><br />The hand gestures for rotation seem to get reversed when I walk to the opposite side of a hologram. Basically, when I look at the hologram initially, go into rotate mode, and move my hand right, it spins right. But then if I walk to the other side and move my hand right, it spins left. Any idea how I might go about fixing that? If it helps, I modified your code a little bit to make it only spin on one axis. Here's what I have:<br /><br />void Rotate(Vector3 manipulationData)<br /> {<br /> transform.RotateAround(transform.position, gameObject.transform.up,<br /> -manipulationData.x * RotateSpeed);<br /> }<br /><br />Thanks a lot!<br /><br />-RJUnknownhttps://www.blogger.com/profile/07188145968159559066noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-58414165317015204812017-06-29T08:13:41.268+02:002017-06-29T08:13:41.268+02:00@Lee Of course can, but then you have to find anot...@Lee Of course can, but then you have to find another way to select the functions. For instance with some kind of floating UI.Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-48160105626681467162017-06-29T03:35:34.323+02:002017-06-29T03:35:34.323+02:00Hi, I managed to get it working properly. Thank yo...Hi, I managed to get it working properly. Thank you so much for the codes but I would like to ask if this could work without adding in the voice commands?Anonymoushttps://www.blogger.com/profile/01805066547891475871noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-56175179845737282072017-06-19T07:55:40.816+02:002017-06-19T07:55:40.816+02:00Hi @Lee, can you be more specific on 'not work...Hi @Lee, can you be more specific on 'not working properly?' Does the app work, but it does not hear or understand you? Did you turn on speech capabilities? Does the app hear you and give a confirmation sound (pringggg) but doesn't it respond? Do you have trouble getting voice commands to work in my sample only, or do other apps have problems understanding you too? I have found out you pretty much need to speak English with what I perceive as an American accent to get the device to understand you.<br /><br />The explanation of the code is pretty much in the article. <br /> Joost van Schaikhttps://www.blogger.com/profile/02182444268071162776noreply@blogger.comtag:blogger.com,1999:blog-5295746446529817470.post-5799681016940327872017-06-16T10:38:25.219+02:002017-06-16T10:38:25.219+02:00Hi, I've tried using the codes that you provid...Hi, I've tried using the codes that you provided but I just couldn't get the speech commands working properly. Could you explain to me how the codes work? Thank youAnonymoushttps://www.blogger.com/profile/01805066547891475871noreply@blogger.com