Jump to content
• Advertisement

Public Group

How to transform

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

If you intended to correct an error in the post then please contact us.

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 this post

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

Share this post

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.

Share this post

Share on other sites

• Advertisement
• Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• Advertisement

• Popular Now

• 15
• 12
• 9
• 11
• 15
• Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!