Ragdoll scale problem

  • Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Benjamin

Grizzled Veteran
May 17, 2009
3,631
635
113
France
I'm experimenting with altering specimen sizes, and have realised that the ragdoll spawned when the specimen dies does not scale at all. It seems the scale of the bones is scaled but not the actual offsets themselves, for example:

attachment.php


As of yet I have no idea what is causing this, as apparently the ragdoll's scale variable (KScale) is supposed to automatically be kept in sync with the actor's DrawScale variable. Although, even when I provide my own KParams object with a modified KScale it doesn't seem to change anything.

Anyway, here's the code:

Mutator:
Code:
class SmallClotMut extends Mutator;

function PostBeginPlay()
{	
	SetTimer(0.1, false);
}

function Timer()
{
	local KFGameType KF;
	local byte i;

	KF = KFGameType(Level.Game);
	KF.InitSquads.Length = 1;
	KF.InitSquads[0].MSquad.Length = 8;
	for( i=0; i<8; i++ )
		KF.InitSquads[0].MSquad[i] = class'SmallClot';
}

defaultproperties
{
	GroupName="KFSmallClotMut"
	FriendlyName="Small Clots Mutator"
	Description="Replaces clots with smaller version."
}

SmallClot:
Code:
class SmallClot extends ZombieClot;

defaultproperties
{
	DrawScale=0.5
	Prepivot=(Z=-1.1)
	CollisionHeight=19.8
	CollisionRadius=11.7
	ColOffset=(Z=21.6)
	ColRadius=11.25
	ColHeight=2.25
	HeadScale=0.5
	SeveredHeadAttachScale=0.355
	SeveredLegAttachScale=0.355
	SeveredArmAttachScale=0.355
	GroundSpeed=10
	MeleeRange=11.7
	MeleeDamage=0
}

If you want to see that the ragdoll size remains exactly the same, add this to the specimen code to restore the original DrawScale when it dies:

Code:
simulated function PlayDyingAnimation(class<DamageType> DamageType, vector HitLoc)
{
	SetDrawScale(1.1);
	Super.PlayDyingAnimation(DamageType, HitLoc);
}

Any ideas?
 

Attachments

  • Shot00000.jpg
    Shot00000.jpg
    46.9 KB · Views: 0

HeLL_BREATH

FNG / Fresh Meat
Oct 31, 2009
93
2
0
I guess you are the First one(Maybe the Only One), who was tried to do something like this :) , maybe someone will help you, maybe not.

P.S.
I even didnt realize before your post, that when Specimen's get killed, spawns ragdoll. Thx You for this !
 
Last edited:

HeLL_BREATH

FNG / Fresh Meat
Oct 31, 2009
93
2
0
I'm wondering, if those Specimen's are using sometimes RagDoll's, why Physics side is so hard to do ? Ragdoll its very simple for this.
 

PsYcH0_Ch!cKeN

Grizzled Veteran
Nov 27, 2005
1,677
200
63
39
Brisbane, Australia
www.ragequit.com
Ah, native code. My favourite thing in the whole world. There's nothing like invisible and undocumented code to make me want to curl into a ball and cry...

KScale is a constant, so your attempts to set it manually are being ignored by the engine, even as a default property. Frankly I suspect the whole "kept in sync" comment in the KarmaParamsCollision class is a bit of a lie. There's a lot of instances within UE2.5 where a comment will claim one thing, but the reality is entirely different.

I'm not sure that scaling of ragdoll capable meshes was ever really intended. It seems more geared towards more simple physics objects (i.e. thrown weapons, simple world objects, etc). When a Karma ragdoll is spawned, it's using its own bones with its own config - it's completely unrelated to the mesh's skeleton (or so the documentation would have us believe anyway). Those bones are defined within .ka files (basically a renamed XML file) in the KarmaData folder. The files were generated by KAT (Karma Authoring Tool) based on a scale and bone locations/offsets that were all set before the data was calculated and I'm not sure that the engine is necessarily even capable of recalculating the new offsets for a given change in mesh scale. You could create a new karma profile and specific asset for your miniaturised clot, but you'd have to do it through manual edits (as KAT requires the original PSK) and that's rarely pretty.

Out of curiosity I did create and reference a new .ka profile and asset specifically for the small clot, but strangely none of the adjustments I made had any noticeable difference. Of course, I may have missed something important so you could have better luck.

If you do decide to go down that road, be careful not to double up on .ka profile or asset names. Unreal automatically searches the entire game folder tree for .ka files every time you start the game and if it finds one, regardless of its name, it will load it. That can lead to some interesting conflicts and fun crashes.

This isn't a huge help to you I realise, but I think it's about the only response you're likely to get around here. So much of the Karma system is native that really, the only people who'll know much about it will be engine licencees and there aren't many of them around here besides TW themselves, who're generally pretty busy. Good luck in any case, and if you do find a solution, let me know. :)
 

Benjamin

Grizzled Veteran
May 17, 2009
3,631
635
113
France
I'm not sure that scaling of ragdoll capable meshes was ever really intended.

Me neither, actually. I just had a bit of hope that it might be supported since just about everything else can be dynamically (at run-time, and even during the life of a pawn) altered to change the scale of an enemy. Oh well, looks like I'll have to just default to gibbing all the time instead! Of course I may look into altering a profile and see if I can get that to work, or even write a scaling application (if that's even possible), although the latter sounds like it could be quite difficult to do.

Thanks for taking the time to write that detailed post, it's appreciated. :)

I'm wondering, if those Specimen's are using sometimes RagDoll's, why Physics side is so hard to do ?

Could you elaborate on that? I'm not sure what you mean.
 

PsYcH0_Ch!cKeN

Grizzled Veteran
Nov 27, 2005
1,677
200
63
39
Brisbane, Australia
www.ragequit.com
Oh well, looks like I'll have to just default to gibbing all the time instead!
It wouldn't necessarily be unreasonable for something so small. They're pretty adorable when they're that size and having them turn into red pulp when you kill them wouldn't be too farfetched. Although you'd probably have to make a decapitation cause an instant death regardless of health remaining, otherwise you'd have headless bodies spontaneously combusting.

Along similar lines, don't forget to resize the severed limb meshes. It's quite funny when you slice the head off a tiny zombie and the head that spawns in mid-air is almost as big as the entire creature it just came off. :p
 

Benjamin

Grizzled Veteran
May 17, 2009
3,631
635
113
France
Although you'd probably have to make a decapitation cause an instant death regardless of health remaining, otherwise you'd have headless bodies spontaneously combusting.

Well I thought it looked rather funny seeing bodies walk around and then randomly explode. :p

Along similar lines, don't forget to resize the severed limb meshes. It's quite funny when you slice the head off a tiny zombie and the head that spawns in mid-air is almost as big as the entire creature it just came off.

Don't worry, I've already thought of that. Interestingly enough certain gib parts (brain parts I think) are scaled upon spawn, although the limb spawning function doesn't do this for some reason (something to do with collision perhaps?).

Also, the actual gib effect (blood splash and such) needs adjusting since for a tiny specimen it looks ridiculous seeing a huge mushroom cloud of blood and gore when all you did was shoot it with a 9mm. I've got it all covered. :p
 
Last edited:

PsYcH0_Ch!cKeN

Grizzled Veteran
Nov 27, 2005
1,677
200
63
39
Brisbane, Australia
www.ragequit.com
Limb gibs aren't scaled at all. Or rather, they're not scaled in the code. Since they're just a fairly basic extension of actor with a mesh as the drawtype, they just use whatever the default mesh size is. Chances are though that the meshes ARE scaled, just that the scaling has been done in UED to the mesh specifically rather than on a spawn by spawn basis. But yeah, overriding the DrawScale for them on spawn is about as easy as things get. :)