开发者

Eyeball rotation

I'm developing a interactive eye follower. I want to rotate 2 spheres according to mouse movement. These spheres开发者_如何学JAVA are representing the eyeballs.What is the best way to do this? I need to find the vector which points to the direction of the mouse current position, but i don't know how to find the rotation matrix for ball rotation. I am using silverlight+kit3d, but this is not relevant.. it could be opengl, directx or anything.. Thanks,


There is a paper by Möller and Hughes from the Journal of Graphics Tools called "Efficiently Building a Matrix to Rotate One Vector to Another" that is exactly what you want. There is also example code available.

Given your specific problem, you can probably simplify things a bit from the exact procedure suggested in the paper.


Ok i think this should work

picture at imagebin.ca/img/Bz7zhY.png http://imagebin.ca/img/Bz7zhY.png

30 is the distance of the mouse cursor from the centre of the screen (or the centre of the eye on the screen if you want them to move independently).

25 is the distance of the eye from the screen (Z axis)

This is only for one axis (X or Y) you need todo this for each axis


Do you really want to implement it or just use it. I have one similar one as a gadget in igoogle. you can search igoogle for one if you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜