简体   繁体   中英

Hololens movement recognition

I started to work with Hololens (1 gen.) and now I need to recognize, if the glasses are moving (like somebody wears them and eg rotates the head or goes forward) or they are staying motionless (eg lie on the table). Is there any tool or library for it? Or maybe any access to the sensors data?

EDIT: I took the example app from Microsoft , prebuilt it in Unity and run in VS2017. Then I found the code to get Camera position:

float quaternionX = Camera.main.transform.rotation.x;

but it always throws me System.AccessViolationException

EDIT 2:

Ok, it looks like I call Camera in wrong thread. If I put the same call inside of SpatialMappingObserver.Update() (Part of this Microsoft example), it works fine. I'm wondering, how the exceptions in VS2017 are unclear.

As u didnt provide much information and I don't know what you are using I'm gonna share my idea how I would do it in my project. So I'm using the latest HoloToolkit(some call it just mrtk, not v1 and not v2) and Unity LTS 2017. There I have a camera in the scene, which represents the hololens, so you could just access the transform of it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM