   whats wrong about this working code?
  Hi,i'm simply trying to face an object into a direction giving by a 3D vector.i only want to do the Y-rotation.After hours of research and testing, i came up with the folowing working code:float rot;rot = atan2(v.x, v.z);rot += D3DXToRadian(180);But why did i have to switch v.x and v.z in atan2and rotate it by 180 degrees?if i dont do these two steps, the rotation is completely wrong.hope that somebody of you can tell me whats wrong.   
  It depends on how the object is stored, if the object is stored such that an atan() of zero will not need to rotate the object at all, then you could have used the parameters in the default configuration.But because your object is stored differently than this, then you must manipulate the result of atan to get the desired results.For starters, if you stored the object 180 degrees from how it is now, you could remove the += 180. The reason you flipped the x and z is because atan is made to work on x and y. That is with +x going to the right, and +y going up. When you plot x vs z, +z would go down with +x going to the right (following the right handed coordinates rule). You could have probably left them in the correct order and just negated the z.Note: swapping the x and z like you have will account for 90 degrees of the 180. So be sure to test these changes 1 at a time, they are connected. (In other words if you remove the 180 you wont have to mess with the swap, if you fix the swap the 180 will be come 90).These sort of swapping, negating, and adding offsets is pretty common when doing things like this. It's just converting between multiple different conventions, it's not going to be pretty.Hope that helps.   ;  bzroom, thank you once again!ah yeah the model was facing to me without rotation applied. i didnt consider that.