更改Directx网格中心
我用VB.NET编写的DirectX创建了一个网格框。当我旋转和缩放网格时,它是从中心开始旋转和缩放的 如何更改网格中心,如下图所示:更改Directx网格中心,directx,rotation,scale,mesh,cube,Directx,Rotation,Scale,Mesh,Cube,我用VB.NET编写的DirectX创建了一个网格框。当我旋转和缩放网格时,它是从中心开始旋转和缩放的 如何更改网格中心,如下图所示: 将网格矩阵平移到旋转/缩放中心,应用旋转/缩放,然后将矩阵平移回去。e、 g: matWorld = Matrix.Identity ' Translate to rotation/scaling center matWorld = matWorld * Matrix.Translate(0.1, 0.2, 0.3) ' Apply your rotatio
将网格矩阵平移到旋转/缩放中心,应用旋转/缩放,然后将矩阵平移回去。e、 g:
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
注意:我没有测试上述内容,因此可能存在语法问题。将网格矩阵平移到旋转/缩放中心,应用旋转/缩放,然后将矩阵平移回去。e、 g:
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
注意:我没有测试上述内容,因此可能存在语法问题