Sign in to follow this  
ashwathh

3D Cylinder.

Recommended Posts

Hello All, I have a .x(DirectX) file which i got from converting .3ds to .x file.I am rendering a 3D object(hollow cylinder)on the screen using the function "D3DXLoadMeshFromX" and "DrawSubset(0)".When i click on the cylinder and drag it then the cylinder should deform and it should look like a rope.How i can achieve this.Please help me in this. Thanking you in advance, Ashwath.

Share this post


Link to post
Share on other sites
You could apply a scale matrix to the cylinder mesh, scaling the mesh along it's main axis. If you don't need or want to actually change the mesh vertices, this is probably much easier. This method will result in a straight but stretched cylinder.

If you want the cylinder to curve in several places as you click and drag the mouse, you will need an algorithm to modify the vertices in the mesh vertex buffer, according to how you want the cylinder to change as you drag the mouse. That method will probably involve picking the triangle in the mesh where the mouse is clicked.

If you want to use the second method, the first thing to do is to write a routine for picking the correct location on the mesh. Look at the D3DXIntersect functions and get that working before you try to deform the mesh.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this