Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Handling the gun model (glue object to limb)

Author
Message
Aralox
19
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 13th Jul 2010 10:10
Hey guys, i need a little help here. Im looking for a good system of handing gun models, i.e. an efficient way of switching guns. What i would like to have is: loading all the gun objects, then attaching the right gun object to the 'gunlimb' on the player as required. (obviously hiding and unattaching when necessary).

However due to the dimension-screwing properties of 'glue object to limb', the system i have now is loading the gun object, creating a mesh from the gun object, appending the mesh to the player as the gunlimb (and hiding it), then gluing the gun object to the limb. If i wanted to keep this system, i would have to create meshes everytime i swapped a gun, or else have an individual 'gun limb' for every different gun i have. Is this viable? should i use exclude limb? You might be asking yourself, why bother with the gun object at all? I wanted the player to only see his gun, but for everyone else to see the whole model, so set object mask worked nicely here.

Sorry about the ramble, and hoping for a solution,
Aralox

(Im more interested in the gun model - but if anyone has got tips on handling the data im all ears. what i had in mind was a 'gun' integer type in my player() array, which gave the ID of the gun(ID) array, which held info on damage, accuracy etc.)

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Jul 2010 12:31
I think it would be better to deal with the problems wiht glue object.

I mean, if you take your character model, import it beside your gun in a modelling package, you could scale the gun to the correct proportions and use that. Then the gun should be the right size when glued onto the limb.

For a FPS view though, like the classic behind gun view - I would strongly advise just having it all as a single, animated model, with hands and everything. It's just not the done thing to glue a gun model to a hand in a FPS view, that's strictly for full character models. It makes sense, because then you have the chance to make the animations totally custom for each gun, make it much more authentic.

Even if the hand and gun models are seperate, you'd still never animated them seperately. For instance, you could export the animated hands and gun seperately, as 2 seperate objects, but with the same animation and bone structure. There's probably little use for that though, unless you are using seperate shaders.

If you have to be able to switch guns and arms around, like if your playing as different characters, then I would look into an alternative animation method like Enhanced Animations - which would allow you to replicate and control the animation - you might use the same bone structure for each set of hands, then you could use the same animations every time. It might be a bit clunky to have lots of variations of arms, so using enhanced anims would cut that down (just 1 record of the animation is needed).


Health, Ammo, and bacon and eggs!
Aralox
19
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 13th Jul 2010 13:09
Hey thanks for the help again Van B, i appreciate it.

Ill take your advice with the gun and body being the same mesh. I think what ill do now is ill have two objects to my body, the top half and bottom half, and for each one ill have many animations (eg for legs, frame 1 to 10 is running, frame 20 to 30 is crouching, etc and for arms, frame 1 to 10 is shotgun_idle, frame 20 to 30 is shotgun_shoot etc). i reckon this is better and more convenient than having separate objects for each animation state.

for my base object which the top and bottom are gonna glue onto ill just take say the arms holding any gun and the legs standing still and make limbs out of them - Im sure (i hope?) that wont screw with the scaling of the other models during gluing (of the top and bottom object with the appropriate limbs on the main object), due to the similarity between them.

This way i can switch guns while running around and jumping etc and it should look alright. Of course, the much easier and im sure effective way to go about this is by using enhanced animations. It looks awesome, but i'm just not willing to pay money for plugins at this stage. Later when i'm more serious about my coding, its definitely something ill get.

Thanks ,
Aralox

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Jul 2010 13:18
There is another option I forgot to mention, and that's using the new limb animation commands. Now you can specify which frames go to which limb - so you might have your whole character doing a running animation, then standing still aiming a gun - and in DBPro you can mix these up. So you could have your legs running around, while the torso has a completely different animation.

It might get a bit complex, but very useful if you can get that set up. I always draw a skeleton for character models once they are rigged, and mark each limb on that. No matter what the project, I always need to know what limb number is where.


Health, Ammo, and bacon and eggs!
Aralox
19
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 13th Jul 2010 14:02
No way! seriously? how do i get these? wait are you sure these arent part of enhanced animations?

PS: i did a search on this, and had a laugh when i found that 3 years ago i posted a question about limb animations, but yeah no such thing existed

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Jul 2010 14:44
Yeah, I think you just need SET OBJECT FRAME, and it's something like Obj,Frame,Limb - so it would need a custom animation system, no playing or looping animations, but you'd want that level of control anyway.

I'll check tonight, but I'm sure it's just an extra limb parameter on SET OBJECT FRAME.


Health, Ammo, and bacon and eggs!
Aralox
19
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 13th Jul 2010 14:49
nah not that one, set object frame:


Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Jul 2010 15:10
Ahh, maybe it's a SET LIMB FRAME command, something like that - I will check and let you know when I can get at those help files (still at work for 3 hours you see).

It's definitely in there now though, I haven't had a chance to experiment with them yet - but I was like 'Wow!, just what I've been looking for!' - even after I bought Enhanced Anims. I want to make a beat-em-up eventually, so EA will be good for that anyway, but for FPS games with gun poses it struck me as perfect to have native DBPro commands. I'm betting it was added for FPSC, because FPSC surely needed it to improve the character aiming.

But yeah, I will post back with the proper command to take control of this stuff.


Health, Ammo, and bacon and eggs!
Aralox
19
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 13th Jul 2010 15:17
cool no worries. i wish there was a way to rip scripts off fpsc and see how they did it actually, come to think of it, im sure there is. hmm maybe ill get the free version or something and see if i can find out how the engine ticks

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 13th Jul 2010 15:52
@Aralox. There are too many words in the posts to go over right now, so someone may have already said this: Model all the possible guns with your character and hide the ones not used in your program. If you have say, 10 guns, then your model will have 10 guns all in-hand within your modeling program. You may have different animations for some weapons, so do that for them. It will look like a mess in your modeling program, but when you get to DBP, you hide the ones not in use and *poof* no attach limb problems!

The fastest code is the code never written.
Aralox
19
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 13th Jul 2010 16:16
hey thanks for the suggestion, but i figured that instead of handling heaps of objects with different animations and hiding them in turn, ill just make one object with different sections of frames for different guns/animations. this way i can just change guns by changing the section of frames i loop with LOOP OBJECT.

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Jul 2010 17:58
Aha, it's not quite documented yet - but it was added with update 7.5

` * Added parameter to SET OBJECT FRAME obj,LIMB,frame,mode (used for per limb animation frame control)
set object frame 1,11,wrapvalue(timer()/10.0)/36.0,1

That will take limb 11 and go from frame 0 to 10 just on that limb.


Health, Ammo, and bacon and eggs!
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 13th Jul 2010 18:01
@Van B, now that's an interesting development!

The fastest code is the code never written.
Aralox
19
Years of Service
User Offline
Joined: 16th Jan 2007
Location: Melbourne
Posted: 14th Jul 2010 03:35
the update looks really good, i installed it and the editor looks sexy. But nothing seems to compile. Not in the new editor, not in codesurge, and not in the old editor.

Login to post a reply

Server time is: 2026-07-25 03:25:39
Your offset time is: 2026-07-25 03:25:39