Jump to content
Sign in to follow this  
zooloo75

Ragdoll'd

Recommended Posts

z75_RagdollEffect =
{
private ["_unit", "_dir", "_unitPos", "_force", "_o", "_projPos"];

   _unit = _this select 0;
   _dir = _this select 1;
_projPos = _this select 2;

_unitPos = position _unit;
   _force = 250;

_unit allowDamage false; 

_o = "Steel_Plate_L_F" createVehicleLocal [0,0,0];
_o setObjectTexture [0,""];
_o setMass _force;
_o setDir _dir;
_o setPos [(_unitPos select 0) + sin(_dir + 180), (_unitPos select 1) + cos(_dir + 180), ((((boundingBox _unit) select 1) select 2) / 2) - ((_projPos select 2) / 100)]; 
_o setVelocity [(sin(_dir)) * 5, (cos(_dir)) * 5, 0]; 

sleep 0.5;

deleteVehicle _o;
_unit allowDamage true; 
};

Doesn't the _unit allowDamage false/true section cause problems with damage handling? It's spawned so it isn't guaranteed that the whole section between the two allowDamage commands is ran as one atomic operation.

Would it be possible to add handleDamage event handlers to all units, and then just ignore the damage if the handleDamage event source equals that vehicle that is created in the script above? This way you wouldn't have to use allowDamage command, thus removing synchronization issues with getting shot at.

Share this post


Link to post
Share on other sites
z75_RagdollEffect =
{
private ["_unit", "_dir", "_unitPos", "_force", "_o", "_projPos"];

   _unit = _this select 0;
   _dir = _this select 1;
_projPos = _this select 2;

_unitPos = position _unit;
   _force = 250;

_unit allowDamage false; 

_o = "Steel_Plate_L_F" createVehicleLocal [0,0,0];
_o setObjectTexture [0,""];
_o setMass _force;
_o setDir _dir;
_o setPos [(_unitPos select 0) + sin(_dir + 180), (_unitPos select 1) + cos(_dir + 180), ((((boundingBox _unit) select 1) select 2) / 2) - ((_projPos select 2) / 100)]; 
_o setVelocity [(sin(_dir)) * 5, (cos(_dir)) * 5, 0]; 

sleep 0.5;

deleteVehicle _o;
_unit allowDamage true; 
};

Doesn't the _unit allowDamage false/true section cause problems with damage handling? It's spawned so it isn't guaranteed that the whole section between the two allowDamage commands is ran as one atomic operation.

Would it be possible to add handleDamage event handlers to all units, and then just ignore the damage if the handleDamage event source equals that vehicle that is created in the script above? This way you wouldn't have to use allowDamage command, thus removing synchronization issues with getting shot at.

There is a very slim chance that a bullet will damage a unit during ragdoll when the processor hits the exact instructions. It's a simple fix though.

Sent from my HTC One V using Tapatalk

Share this post


Link to post
Share on other sites

Zooloo, maybe it's too much to ask and maybe it doesn't make sense with the whole mod, but would it be possible to add an option, or make an optional file to have non-ragdoll reaction on hit ? Something like TWP_Fall for the animation.

Share this post


Link to post
Share on other sites
Zooloo, maybe it's too much to ask and maybe it doesn't make sense with the whole mod, but would it be possible to add an option, or make an optional file to have non-ragdoll reaction on hit ? Something like TWP_Fall for the animation.

So units don't ragdoll when hit? Just disable the mod.

I hope I just misunderstood you, else I can't tell if you're trolling or not.

My mod is not a replacement for TPW's. He and I have different methods of activating the ragdoll. This is merely an experiment to activate it without killing the unit; if you want to have a mod like his, then by all means, just use his mod.

---------- Post added at 02:06 PM ---------- Previous post was at 01:36 PM ----------

@zooloo75

Thanks for sharing the addon. :)

Some observations:

1) Ragdoll effect seems to be more evident when units are shot either on their sides or their back compared to being shot at on front. Could it be due to the fact that my infantry targets where static? Refer to video below.

2) Also from the video demonstration below, there were 3 separate instances where I threw a grenade and each time there's this very luck dude who would survive the blast. Is it related to the fact that I am using an old version of CBA with the latest Arma 3 main branch version or totally unrelated to the ragdoll effect?

In your video, I don't think you had my mod enabled, or aren't using the latest version. I didn't see any ragdolling in effect from my mod. What was happening was just the default death ragdoll. It could also be caused by your older version of CBA. Consider updating both :)

---------- Post added at 02:11 PM ---------- Previous post was at 02:06 PM ----------

I did some playing around with this mod and I got the ragdolls behaving a bit better. They now fly back in the right direction and don't fly back as much (usually only just falling in place)

z75_RagdollEffect =
{
private ["_unit", "_dir", "_unitPos", "_force", "_o", "_projPos"];

   _unit = _this select 0;
   _dir = _this select 1;
_projPos = _this select 2;

_unitPos = position _unit;
   _force = 250;

_unit allowDamage false; 

_o = "Steel_Plate_L_F" createVehicleLocal [0,0,0];
_o setObjectTexture [0,""];
_o setMass _force;
_o setDir _dir;
_o setPos [(_unitPos select 0) + sin(_dir + 180), (_unitPos select 1) + cos(_dir + 180), ((((boundingBox _unit) select 1) select 2) / 2) - ((_projPos select 2) / 100)]; 
_o setVelocity [(sin(_dir)) * 5, (cos(_dir)) * 5, 0]; 

sleep 0.5;

deleteVehicle _o;
_unit allowDamage true; 
};

z75_IsBullet =
{
private ["_projType", "_strArr", "_isBullet"];

_projType = _this;
_strArr = toArray _this;
_isBullet = false;

if(count _strArr > 0) then
{
	if(_strArr select 0 == 98 || _strArr select 0 == 66) then
	{
		_isBullet = true;
	};
};

_isBullet
};

z75_HitPartHandling =
{
private ["_data", "_unit", "_shooter", "_projDir", "_projPos"];

   _data = _this select 0;
   _unit = _data select 0;
_shooter = _data select 1;
_bullet = _data select 2;
_projPos = _data select 3;
_vdir = _data select 7;

if(alive _unit) then
{	
	if((typeOf(_data select 2)) call z75_IsBullet) then
	{

		_projDir = direction _bullet;

	}
	else
	{

		_projDir = direction _bullet;

	};

	if(_unit == player) then
	{
		addCamShake [3, 5, 5 + random 10];
	};

	[_unit, _projDir, _projPos] spawn z75_RagdollEffect;
};
};

seems just as reliable as the current version but shooting in the arm is a bit iffy, might need to adjust the object placement

Will test your version tonight :)

I do see some logical errors in your changes, but I understand what you changed and why you changed it. This may be the best way of detecting projectile direction, fixing the calculation-error in my code. I wasn't sure if I would be able to get properties from the projectile because I didn't know if the event handler would pass that data given that the projectiles are likely deleted immediately upon impact.

If the test is successful, I will apply the changes properly in my code and I'll add you to the credits :)

Kudos! :D

Edited by zooloo75

Share this post


Link to post
Share on other sites

---------- Post added at 02:11 PM ---------- Previous post was at 02:06 PM ----------

[/color]

Will test your version tonight :)

I do see some logical errors in your changes, but I understand what you changed and why you changed it. This may be the best way of detecting projectile direction, fixing the calculation-error in my code.

If the test is successful, I will apply the changes properly in my code and I'll add you to the credits :)

Kudos! :D

Yeah I tried to get it to use the vector3d coordinates but I found it very unreliable so just went with the actual bullets direction which is working 100% when I tested it. The lower velocity also meant that people weren't flying back as dramatically and it seemed more in line (still exaggerated as people don't fly back at all from being shot..)

Share this post


Link to post
Share on other sites
zooloo75, thank you very much sir for this wonderful mod. Ever since Arma 3 was announced years ago I was really looking forward to the ragdoll physics, you have really made an enormous improvement, I spent the past 2 days experimenting with your mod and it's outstanding.

Thanks :)

When I heard that PhysX and ragdolling were added to ArmA3 during its reveals, I was so happy. Then when the game was released, I was hoping that I could shoot units in the legs and they'd fall over. Sadly, that was not the case.

I then came up with this method of triggering the ragdoll, and I had some good results so I turned it into a mod. Glad you enjoy it :)

---------- Post added at 02:33 PM ---------- Previous post was at 02:32 PM ----------

Yeah I tried to get it to use the vector3d coordinates but I found it very unreliable so just went with the actual bullets direction which is working 100% when I tested it. The lower velocity also meant that people weren't flying back as dramatically and it seemed more in line (still exaggerated as people don't fly back at all from being shot..)

Good work; I initially used the vector provided by the event handler, but as you said, they are unreliable. I'll get back to you tonight about the test :)

Share this post


Link to post
Share on other sites
In your video, I don't think you had my mod enabled, or aren't using the latest version. I didn't see any ragdolling in effect from my mod. What was happening was just the default death ragdoll. It could also be caused by your older version of CBA. Consider updating both :)

Thanks for your reply. Was using an old version CBA with your Ragdoll'd version 1.1

Share this post


Link to post
Share on other sites
Thanks for your reply. Was using an old version CBA with your Ragdoll'd version 1.1

Alrighty, just update CBA (I get mine from ArmAholic - You can get the link on the main post).

To better test the mod, shoot the AI once, best in the leg so you don't kill them. They should ragdoll (although there's a small chance they won't).

Share this post


Link to post
Share on other sites
Alrighty, just update CBA (I get mine from ArmAholic - You can get the link on the main post).

To better test the mod, shoot the AI once, best in the leg so you don't kill them. They should ragdoll (although there's a small chance they won't).

Just downloaded the CBA version from the main post (Armaholic link). Will test later because it is already 12am here in PH, have to get some sleep before going to work. Thanks for the tip, Sir.

Share this post


Link to post
Share on other sites
Just downloaded the CBA version from the main post (Armaholic link). Will test later because it is already 12am here in PH, have to get some sleep before going to work. Thanks for the tip, Sir.

You're welcome, and hopefully you get it working :)

Share this post


Link to post
Share on other sites
So units don't ragdoll when hit? Just disable the mod.

I hope I just misunderstood you, else I can't tell if you're trolling or not.

he wants the units to fall on every hit with a bullet, not ragdoll, just fall down as if it was dead but then get up. I guess he doesn't want to see them fly after being hit, and this seems to him as a good alternative

Share this post


Link to post
Share on other sites
he wants the units to fall on every hit with a bullet, not ragdoll, just fall down as if it was dead but then get up. I guess he doesn't want to see them fly after being hit, and this seems to him as a good alternative

Ah, well I'm trying to get the ragdolling to be more realistic, but there's only so much I can do with this hacky method.

Share this post


Link to post
Share on other sites
I wonder what that means.

Haha. My thoughts exactly. But I wanted to at least draw some attention to it. Hopefully somebody knowledgeable on the fix will chime in.

Share this post


Link to post
Share on other sites

@Kerc Kasha, the test was successful! Mod updated on Dropbox!

Ragdoll realism improved!

Share this post


Link to post
Share on other sites

Thanks for continuing to improve your mod zooloo75. I have been using your mod with Garrison script and it looks awesome when infantry are blown off balconies and rooftops, especially when they collide with other objects. For those who haven't tried it yet, position some troops beside a low wall and throw a grenade at them, the results look very realistic, a billion times better than the standard PhysX.

Share this post


Link to post
Share on other sites
Thanks for continuing to improve your mod zooloo75. I have been using your mod with Garrison script and it looks awesome when infantry are blown off balconies and rooftops, especially when they collide with other objects. For those who haven't tried it yet, position some troops beside a low wall and throw a grenade at them, the results look very realistic, a billion times better than the standard PhysX.

Thanks :)

I too have met my fair share of being shot off rooftops xD

Sent from my HTC One V using Tapatalk

Share this post


Link to post
Share on other sites
Guest

Thanks for sending us the latest version again :cool:

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Feels very natural and definitely a great addition to the game! Thanks a lot!

Share this post


Link to post
Share on other sites
Feels very natural and definitely a great addition to the game! Thanks a lot!

Welcome :)

Share this post


Link to post
Share on other sites
You're welcome, and hopefully you get it working :)

Just updated CBA. I'll try to upload a demo vid. Hopefully I really got it working. :o

Thanks again for the addon! :)

Share this post


Link to post
Share on other sites
Just updated CBA. I'll try to upload a demo vid. Hopefully I really got it working. :o

Thanks again for the addon! :)

Good luck!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×