Jump to content
  • Advertisement
Sign in to follow this  
AghaKhan

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.

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


Link to post
Share on other sites
Advertisement

[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


Link to post
Share on other sites
Sign in to follow this  

  • 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!