Public Group

# How to transform

This topic is 2608 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

[font="Times New Roman"][/font][font="Calibri"]I am working with XNA, where I have built a cubewith 8 vertexes based on VertexPositionColor. [/font]
[font="Calibri"] [/font][font="Calibri"]I am able to see the cube with this setup.[/font]
[font="Calibri"]
[/font][font="Calibri"]basicEffect = new BasicEffect(GraphicsDevice);
[/font][font="Calibri"]
[/font][font="Calibri"]basicEffect.World = Matrix.Identity;
[/font][font="Calibri"]
[/font][font="Calibri"]basicEffect.View = Matrix.CreateLookAt(new Vector3(-5, 5,5), new Vector3(0,0,0), Vector3.Up);
[/font][font="Calibri"]
[/font][font="Calibri"]basicEffect.Projection =Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,GraphicsDevice.Viewport.AspectRatio,0.1f, 100.0f);
[/font][font="Calibri"]
[/font][font="Calibri"]basicEffect.VertexColorEnabled = true;
[/font][font="Calibri"]
[/font][font="Calibri"]
[/font][font="Calibri"] [/font][font="Calibri"]I want to do some transformation on the cube but not on the camera.[/font]
[font="Calibri"] [/font][font="Calibri"]How this can be done? All the vertexes of the cube have position and color.How to apply such transformation on the cube? Your help will be very muchappreciated.[/font]

[font="Times New Roman"][/font]

##### Share on other sites
You need to make transformation matrix and transform each vertex using that matrix.

##### Share on other sites

[font="Times New Roman"] [/font][font="Calibri"]I am working with XNA, where I have built a cubewith 8 vertexes based on VertexPositionColor. [/font]
[font="Calibri"]I am able to see the cube with this setup.[/font]
[font="Calibri"] [/font][font="Calibri"]basicEffect = new BasicEffect(GraphicsDevice);
[/font][font="Calibri"] [/font][font="Calibri"]basicEffect.World = Matrix.Identity;
[/font][font="Calibri"] [/font][font="Calibri"]basicEffect.View = Matrix.CreateLookAt(new Vector3(-5, 5,5), new Vector3(0,0,0), Vector3.Up);
[/font][font="Calibri"] [/font][font="Calibri"]basicEffect.Projection =Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,GraphicsDevice.Viewport.AspectRatio,0.1f, 100.0f);
[/font][font="Calibri"] [/font][font="Calibri"]basicEffect.VertexColorEnabled = true;
[/font][font="Calibri"] [/font][font="Calibri"] [/font] [font="Calibri"]I want to do some transformation on the cube but not on the camera.[/font]
[font="Calibri"]How this can be done? All the vertexes of the cube have position and color.How to apply such transformation on the cube? Your help will be very muchappreciated.[/font]

[font="Times New Roman"] [/font]

To further what has been said, basicEffect.World contains the matrix that will transform the cube, while basicEffect.View contains the camera's inverse transform.

1. 1
2. 2
3. 3
4. 4
Rutin
15
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633724
• Total Posts
3013556
×