Click to See Complete Forum and Search --> : 3D Graphics
dangerousdave
Oct 7th, 2000, 12:29 PM
This has proved hard to explain in the past but here goes.
OK. In the past couple of weeks I have been learning how to make 3d shapes appear and rotate or translate about an axis on the computer screen. Thats done and dusted. But now my next big thing is getting 2 or more 3d objects that are connected, move independantly but affect each other.
OK, that dont make much sense probably so heres a bit of backgound. Ultimately I am making a robotic arm simulation for a college project in VB. Nothing fancy, just a 3D wireframe robotic arm. So as mentioned above I can make 3D objects on the screen, I just dont know where to start as far as connecting them together to move and rotate is concerned.
Urgh. Please, someone out there's gotta understand what I mean.
/\/\isanThr0p
Oct 7th, 2000, 10:31 PM
Hm its more complicated than it seems on the first reading.
I don't think there are prebuild funcitons in D3D(I guess you use D3D IM right?)
But I think in one of the Microsoft modules there is something to determine if thw objects are in some way overlapping. Than you need to know the possible directions of movement of your robotarm. the next thing is to move it to the 'most opposite' direction of the object it is touching. (if you want to avoid the object of course)
Do you use a skeleton model for the arm? I thik it's the only way to get a realistic movement!
dangerousdave
Oct 9th, 2000, 05:10 PM
Actually I am doing it all as wireframe using the LINE method. I am using a similar basic system as 3D Studio MAX stores it's files to draw the cube, that is you have an array of points and then an array of lines and their respective points... eg
point(0).x = 100
point(0).y = 200
point(0).z = 200
point(1).x = 300
point(1).y = 300
point(1).z = 200
Lines(0).point1.x = point(0).x
Lines(0).point1.y = point(0).y
Lines(0).point2.x = point(1).x
Lines(0).point2.y = point(1).y
this is a good way of storing wireframe data I have found.
AHEM! Anyway. This is getting off course. I need to know how to get 2 (an eventually more) 3D objects stuck together, moving like joints in a robotic arm, not easy stuff when you think in programming terms... I cant handle the mathematics of it all.... Anyone help?
No D3D or anything, simple wireframe drawn using LINE method as I sed before.
/\/\isanThr0p
Oct 9th, 2000, 05:17 PM
Can you speak french? I founda good Game programming site where there wasa a tutorial about skeletons in 3D things.
I lost the page, but it was something like cdvg.com
there is actually also an english version, but it seems to have many dead links!
I'll search for the page again.
dangerousdave
Oct 9th, 2000, 05:35 PM
Unfortunatley, being an ignorant Englishman, I dont speak any other language. But it would be great if there was a site you could point me at with tutorials to help out.
/\/\isanThr0p
Oct 9th, 2000, 07:56 PM
lol. You should really learn another language! I'm staying in the USA in the moment, and it is really cool using the languages you learned!
Hm the english version is also cool, but the french explanaitons turned out to be easier to understand!
I'll search for the page, I think I can give the URL to you tomorrow. (but I think the skeleton example is not or only in french explained, but the source will help, too)
joey o.
Oct 9th, 2000, 11:56 PM
I'll take a shot at the logic, but I don't know a hell of a lot about the methods your going to be using.
1. I think the shoulder is not going to move around much, so center a point that this upper arm can hang on and calculate the arc the limb can swing at(this is the same for the whole limb).You can look up some pie chart stuff to give a limit to this arc.
2. The forearm's "begin points" are always equal to the upper arm's end points (or last points refrenced) so the lines there just get drawn to their end points.
3. The hand's the same as the forearm and doesn't need much arc at all.
4. An elbow would dis-joint if it was not at a positive angle in relation to the upperarm so make the arc so it's only positive (meaning from 0 to 160 degrees in relation to the forearm)
5. The hand can move between 270 to 40 degrees relative to the hand.
The formula probably isn't so bad with this out line (please post your project no matter what you do). You could move each end point a degree at a time in random directions along the arcs to get a really cool affect. If you do this then look up about "tweening" to cut down the code. This is gona eat some maga-space right up using the point and line methods.Good Luck!
HarryW
Oct 10th, 2000, 01:09 AM
Just sounds like a lot of geometry and some simple rules to me, modelling objects made up of 3D vectors and projecting a 2D image of those vectors (lines) onto a plane.
If I were you I would sort of model it all internally in 3D, and then use only two of the three dimensions to display it, if that makes sense.
Do you have to use collision detection to do stuff or are you just waving the arm around a bit?
Koralt
Oct 10th, 2000, 05:26 PM
First, have a velocity for every point. Then, have 'connectors'--ie, lines--between them. Different connectors can have different elasticity if you want--make sure to store the ideal length of the connectors, though.
Ok. It's a fairly simple matter to calculate the distance between two points:
xd = x1 - x2
yd = y1 - y2
zd = z1 - z2
dist = Sqr (xd * xd + yd * yd + zd * zd) 'Sqr is *very* slow! If you can get rid of it, do so.
With the distance, you can find out the ratio of how far apart they *are* to how far apart they *should* be. Find the midpoint, and then accelerate both endpoints towards the midpoint as necessary.
'I'll try to keep this simple ...
ratio = connect(t) / dist
xa = (x1 + x2) / (2 * elastic) * ratio 'Note: you can double all elastic values and drop the "/ (2 * elastic)" to "/ elastic"
ya = (y1 + y2) / (2 * elastic) * ratio
za = (z1 + z2) / (2 * elastic) * ratio
xv1 = xv1 + xa
yv1 = yv1 + ya
zv1 = zv1 + za
xv2 = xv2 - xa
yv2 = yv2 - ya
zv2 = zv2 - za
That should work, or be close. It may not be quite right. Not sure right at the moment ...
You can give each point a different mass fairly easily.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.