2012-05-05 6 views
1

私はDirectXでVB.NETで書かれたメッシュボックスを作成しました。メッシュを回転してスケーリングすると、中心からそうしています。その後、行列が戻って翻訳し、回転/スケーリングを適用し、回転/スケーリングの中心にメッシュ行列を翻訳DirectXメッシュセンターを変更

Mesh Center

答えて

1

は、どのように私は、次の画像のように、メッシュの中心を変更できます。例えば:

matWorld = Matrix.Identity 

' Translate to rotation/scaling center 
matWorld = matWorld * Matrix.Translate(0.1, 0.2, 0.3) 

' Apply your rotation/scaling 
matWorld = matWorld * Matrix.RotationZ(0.01) 

' Translate from rotation/scaling center 
matWorld = matWorld * Matrix.Translate(-0.1, -0.2, -0.3) 

' Assign matWorld as world transformation matrix 
device.Transform.World = matWorld 

注:私は上記のテストしていないので、構文の問題があるかもしれません。