1

VB.NET で記述された DirectX でメッシュ ボックスを作成しました。メッシュを回転およびスケーリングすると、中心からそうしています。

次の図のようにメッシュの中心を変更するにはどうすればよいですか。

メッシュセンター

4

1 に答える 1

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

注: 上記はテストしていないため、構文上の問題がある可能性があります。

于 2012-05-06T01:00:11.640 に答える