Question about models

Started by
3 comments, last by Mike00 23 years, 9 months ago
I''m pretty new to OpenGL and am making a game. I''ve made a model of a person and a sword (2 separate models) and have turned them into code with 3dExploration. Now I want the sword to always stay in the person''s hand wherever he moves. It''d also be nice to be able to change between different swords. I have no idea where to start, except using the same variables for the coordinates of the hand and the handle of the sword. But I don''t really understand code made by 3dExploration too much, like for example, which part says where it places the model. Thanks!
Advertisement
well my advice if youre just starting is do something simple first anyone for pong?
to answer your question go

position and rotate the man
draw the man
glTranslate( upwards and forwards a bit)
draw the sword

I agree that you should start with the basics.

Your ''sword in hand'' problem is best solved by an object hierachy system. I do this by holding a list of pivots with each object. Each pivot has a child object. To move objects properly you simply start from the bottom of the hierachy and work your way up. Each pivot is made up of a coord and normal so the child object is attatched facing the right way and at the right place.

In this way you can have any type of animation and it is not very hard to implement. I know of no better solution.

If this seems too vague, go look it up. After all, I just nicked this idea off someone else. (it works by the way)

The code 3dExploration generates is easy to understand (!?). If you don''t get it you need to read the tutorials on this site
Anonymous, do you know of any sites that describe that? What exactly do you mean by pivots?
Learn to use matrix stacks (glPushMatrix, glPopMatrix), it''ll come in handy for "hierachical animation".

Remember that in OpenGL, everything you do takes effect immediately.

EL

----------------------------------------
"Inash neteia haeg joa kavari quilm..." SD4
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4

This topic is closed to new replies.

Advertisement