Search code examples
wpfgeometrytexture-mapping

Getting x,y coordinates of a texture mapped on sphere (WPF, synch, no visualtreehelper.hittest)


technology: WPF, C#

pretext: I am making a game with a custom gyroscope+accelerometer device. I have a sphere that has a labyrinth map on it. The texture is mapped by a set of positions and texture coordinates generated from 3rd party. The user rotates the sphere via device trying to solve the labyrinth.

question: I need to get the map coordinates (x,y) from sphere coordinates (alfa,gama,theta) with custom mapping so i can check if the user is hitting a wall. I cannot use visualtreehelper.hittest because it's asynchronous and I need the data in my game loop.

thanks.


Solution

  • I changed my approach. I baked my texture in a 3D software and exported it back with unwrap. Now I use this map in my code-behind.