tom davies

Ranch Hand

Posts: 168

posted 4 years ago

Sorry if this is in the wrong place, i wasn't sure where it should go.

I am trying to do a simple display of an arm. I say simple as i am only modelling the three joints with triangles representing each part.

I want to to create a method which accepts three angles, with these being the rotation between each triangle. I cant seem to get the rotations and translations correct. My problem is that i can't get the triangles to line up as if they were connected, i have to manually change co ordinates so that they appear correct, obviously this isnt what i planned.

This is my current method where i have to manually input coordinates.

I have an idea of how it should work but i am not sure how to put it into practice. I was thinking i should draw all three triangles, do the first angle rotation, pop matrix, do the second angle rotation and so on. That should work but i am not sure how i would only choose the last two triangles to rotate, and then the last one on its own?

Draw arm method

Draw triangle method

I am trying to do a simple display of an arm. I say simple as i am only modelling the three joints with triangles representing each part.

I want to to create a method which accepts three angles, with these being the rotation between each triangle. I cant seem to get the rotations and translations correct. My problem is that i can't get the triangles to line up as if they were connected, i have to manually change co ordinates so that they appear correct, obviously this isnt what i planned.

This is my current method where i have to manually input coordinates.

I have an idea of how it should work but i am not sure how to put it into practice. I was thinking i should draw all three triangles, do the first angle rotation, pop matrix, do the second angle rotation and so on. That should work but i am not sure how i would only choose the last two triangles to rotate, and then the last one on its own?

Draw arm method

Draw triangle method

It is sorta covered in the JavaRanch Style Guide. |