3

How to create a interactive 3D object in WPF? For example it can be a 3D Cube which can be rotated and with "tap" gesture for each side triggering different action.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Sel
  • 53
  • 5

3 Answers3

2

Take a look at the ViewPort3D class - it has a camera that you can rotate in 3d. Just hook up a MouseDown event handler and modify the camera position.

http://www.kindohm.com/technical/wpf3dtutorial.htm

James Cadd
  • 12,136
  • 30
  • 85
  • 134
  • 1
    Surface doesn't have a mousedown - it has touch events. Same idea, though - but you need to figure out what to do when you have 30 touches dragging the same object in different directions ;-p – Marc Gravell May 13 '09 at 20:16
  • Oh duh, i guess there's no mouse! Do the touch events come through the same mechanism as the Stylus (i.e. same as touch events in Windows 7)? – James Cadd May 13 '09 at 21:51
  • You can put a control(e.g. button) on each side of the cube as a texture and it will work as if you clicked on it, then you can simply implement ClickButton events. – synepis Jan 21 '10 at 21:43
1

Interactive 3D effects are certainly doable in WPF/Surface, although it'll take a bit of work. For example, have a look at the stuff here, especially the rolling globe about 1:50 into the first picture. The implementation shown is Surface, but that is largely WPF with some different input mechanisms... Unfortunately, he doesn't show the code...

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
0

Take a look at codeplex.com/3DTools. Wrap your ViewPort3D into Interactive3DDecorator.

bohdan_trotsenko
  • 5,167
  • 3
  • 43
  • 70