Where are soldiers/skinnedmesh materials defined?

Making or wanting help making your own asset? Check in here
Post Reply
User avatar
Senshi
PR:BF2 Developer
Posts: 358
Joined: 2010-04-29 10:44

Where are soldiers/skinnedmesh materials defined?

Post by Senshi »

For most objects this is easy, they have this nice mapMaterial section where the relevant materials are assigned. Easy peasy.

How is it done for soldiers, though?
I was curious which factions/soldiers use what types of armor, and which faces/polys are affected. I didn't find anything in the code so far (looked at Objects\soldiers\pr_us\pr_us_soldier1.con/tweak and the like). Even tried BFMeshView, to no avail.

In short, I'm confused :) .

Can one of you give me pointers where I can find the soldier's collision mesh/material mappings? Thanks!
User avatar
Senshi
PR:BF2 Developer
Posts: 358
Joined: 2010-04-29 10:44

Re: Where are soldiers/skinnedmesh materials defined?

Post by Senshi »

Bump. Nobody knows this?

Unrelated, but I got another query in the meantime:
Can someone explain ObjectTemplate.gearratios to me?
I've looked at different engines and this can be an array of variable size, but I'm not sure what defines the size and what the individual values actually mean.
User avatar
Mats391
PR:BF2 Lead Developer
Posts: 7643
Joined: 2010-08-06 18:06

Re: Where are soldiers/skinnedmesh materials defined?

Post by Mats391 »

Senshi wrote:For most objects this is easy, they have this nice mapMaterial section where the relevant materials are assigned. Easy peasy.

How is it done for soldiers, though?
I was curious which factions/soldiers use what types of armor, and which faces/polys are affected. I didn't find anything in the code so far (looked at Objects\soldiers\pr_us\pr_us_soldier1.con/tweak and the like). Even tried BFMeshView, to no avail.

In short, I'm confused :) .

Can one of you give me pointers where I can find the soldier's collision mesh/material mappings? Thanks!
They are defined per bone. You can find that in the soldier tweaks. To see where those bones are you have to import the skeleton into 3ds max. You also have

Code: Select all

Renderer.soldier.debugDrawCollision bool -> bool
Renderer.soldier.debugDrawSkeletons bool -> bool
But they seem to crash the editor :(

Code: Select all

rem boneName, material, offset, radius, length
ObjectTemplate.setSkeletonCollisionBone left_upperleg 24 0/0.03/0 0.09 -0.35 
ObjectTemplate.setSkeletonCollisionBone right_upperleg 24 0/0.03/0 0.09 0.35

ObjectTemplate.setSkeletonCollisionBone left_lowerleg 77 0/0.03/0.02 0.08 -0.32 
ObjectTemplate.setSkeletonCollisionBone right_lowerleg 77 0/0.03/0.02 0.08 0.32 

ObjectTemplate.setSkeletonCollisionBone head 25 0/-0.02/0.02 0.07 -0.08 
ObjectTemplate.setSkeletonCollisionBone spine2 24 0/-0.05/-0.03 0.15 -0.16 
ObjectTemplate.setSkeletonCollisionBone spine3 24 0/-0.03/0.02 0.16 -0.05 

ObjectTemplate.setSkeletonCollisionBone right_shoulder 77 0.01/0.03/0 0.06 0.2 
ObjectTemplate.setSkeletonCollisionBone right_low_arm 77 -0.01/0.03/0 0.045 0.18 

ObjectTemplate.setSkeletonCollisionBone left_shoulder 77 0.01/0.03/0 0.06 -0.2 
ObjectTemplate.setSkeletonCollisionBone left_low_arm 77 -0.01/0.03/0 0.045 -0.18 
Senshi wrote:Bump. Nobody knows this?

Unrelated, but I got another query in the meantime:
Can someone explain ObjectTemplate.gearratios to me?
I've looked at different engines and this can be an array of variable size, but I'm not sure what defines the size and what the individual values actually mean.
Never remember it really, but there is a nice thread explaining all the land physics: Battlefield 1942 Mods, Modding Tutorials. Forums and Mod Downloads. ? View topic - Vehicle Study.
Size = Amount of gears set in setNumberOfGears (5 max)
If more than 1 gear, last gear = reverse
What the ratios actually do, i dont know :(
Image

Mineral: TIL that Wire-guided missiles actually use wire
M42 Zwilling
Retired PR Developer
Posts: 613
Joined: 2012-06-10 11:27

Re: Where are soldiers/skinnedmesh materials defined?

Post by M42 Zwilling »

Edit: partially ninja'd

As far as ObjectTemplate.setGearRatios, I believe the number of values that follow is supposed to be set the same as ObjectTemplate.setNumberOfGears, but obviously that's not always the case. Each value is one of the gear ratios the engine can swap between based on some of the other gear settings. IIRC the last one is for the single reverse gear, any others are for forward. The higher values produce higher top speed but lower slope-climbing ability. :)
Image


"How many posts have there been about how much better PR was back in 0.X? The fact is that if we played the older versions we would start to remember the shortcomings, but we tend to hold onto the good memories tighter than the bad ones." - Murphy
User avatar
Senshi
PR:BF2 Developer
Posts: 358
Joined: 2010-04-29 10:44

Re: Where are soldiers/skinnedmesh materials defined?

Post by Senshi »

Thank you both very much for the info.

Projectile COL being assigned per bone is ... interesting. How does this actually affect damage calculation? Does the relation of COL bone to "triangle hit" stem from how the .skinnedmesh is mapped? As in: "If this tri is mapped to bone spine2, the COL material of the spine2 bone is used for the damage calculation"?


Regarding gearratios, I figured that gearratios should match number of gears to make sense, but was confused because this isn't always the case. Maybe it gets ignored if this doesn't match, but doesn't produce any ill effects, as is true for most erroneous code values. I always found it curious that BF2 has this seemingly overly realistic engine simulation for its arcade-ish intents.

Just so you know what I need it for:
I'm currently working on a DB-backend-Web-frontend BF2 object data viewer & damage calculator. First alpha (GenericFireArms vs soldiers& vehicles& objects) will come next month at the earliest. So much new web-coding stuff to learn...

EDIT:
Also, both these:

Code: Select all

Renderer.soldier.debugDrawCollision bool -> bool
Renderer.soldier.debugDrawSkeletons bool -> bool
do work just fine in the BF2Editor for me :) .
User avatar
Mats391
PR:BF2 Lead Developer
Posts: 7643
Joined: 2010-08-06 18:06

Re: Where are soldiers/skinnedmesh materials defined?

Post by Mats391 »

Yea dont really know how hit reg works. Most of the case it doesnt :p
The thing is soldiers have way more bones than just those that have material assigned.
Image

Mineral: TIL that Wire-guided missiles actually use wire
User avatar
Senshi
PR:BF2 Developer
Posts: 358
Joined: 2010-04-29 10:44

Re: Where are soldiers/skinnedmesh materials defined?

Post by Senshi »

Tthat's why I thought one of you crack devs has figured out how that actually works. I mean, COLs on soldiers is kind of a core mechanic in the game, right? ;)

Maybe it's a simple "get closest COL bone to hitt" relation?
User avatar
Mats391
PR:BF2 Lead Developer
Posts: 7643
Joined: 2010-08-06 18:06

Re: Where are soldiers/skinnedmesh materials defined?

Post by Mats391 »

Senshi wrote:Tthat's why I thought one of you crack devs has figured out how that actually works. I mean, COLs on soldiers is kind of a core mechanic in the game, right? ;)

Maybe it's a simple "get closest COL bone to hitt" relation?
We took soldier completely from BF2, no questions asked there :) FH2 made their own soldier models, maybe they will know more.
My guess: It checks what bone the face is assigned to, if that bone has no col material set ignore an pass to the next face. That would mean fingers would have no hit box. Should be easy enough to test ;)
Image

Mineral: TIL that Wire-guided missiles actually use wire
Post Reply

Return to “PR:BF2 Community Modding”