views:

77

answers:

1

I am developing game editor.To detect mouse hit on 3D model I am using mouse picking concept. But I want to implement translation & rotation widgets like other game editor with actual arrows at the center of model in three direction. How to achieve this..? Can anyone suggest sample code for the same?

+1  A: 

Any given object you select will have a local-to-world transform matrix.

Using DirectX its pretty easy to get the 3 Axes.
The first row of the matrix if the side (x) vector.
The second row is the up (y) vector.
The thidd row is the forward (z) vector.

Knowing the position (the 4th row) makes the trigonometry pretty easy to work out. Thus its pretty simple to do rotations and translations based on this info.

Goz