View Full Version : Question about Coding

06-07-2002, 06:38 AM
ok, i have a question, how would I add a model onto another model...

umm...I want to stick a jetpack on someone. THe guy is one model and the jetpack is another.

and how can I make it so when a button is pressed he flys up? I mainly need the button press code here.

if you could help me that would be good

thanks :D

06-07-2002, 07:01 AM
Coincidentally I am working on a jetpack at this very moment. Currently the jetpack ignites ... and sends the player flying about like a madman. I need to work on the gravity effects...

Anyway, back on topic:

To add a model you should look at the trap_G2API_AddBolt() function. Check out g_weapon.c for an example of how the sabre is bolted on to a player's hand. What I was planning on doing was making a tag on my pack model and bolting it to the pelvis or thereabouts.

As far as pressing a button to fly goes, you're approaching the problem differently to me so I can't speak with any great authority about what you should do. I'd think you'd want to define a new button press in q_shared.h and check for it in the PMove() function somewhere.

Checking a bitwise AND of pm->cmd.buttons and your new button definition will tell you if that button is pressed so you can check for it and call the PM_JetpackMove() function (which you'll have to write) instead of one of the other PM_*Move() routines.

06-07-2002, 07:07 AM
hmm...thanks for that, that should get me on the right track :D