Raised This Month: $32 Target: $400
 8% 

Solved [L4D] How correctly ClearParent to enable physics?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 02-21-2020 , 12:08   [L4D] How correctly ClearParent to enable physics?
Reply With Quote #1

Hi,

when I "ClearParent" of weapon, it doesn't fall on the ground until I shove it.



PHP Code:
Action CmdTest2(int clientint args)
{
    
AcceptEntityInput(g_iWeapon"ClearParent");
    
    
SetEntProp(g_iWeaponProp_Send"m_CollisionGroup"COLLISION_GROUP_WEAPON);
    
SetEntProp(g_iWeaponProp_Send"m_iParentAttachment"0);
    
SetEntityMoveType(g_iWeaponMOVETYPE_VPHYSICS); 
    
    
TeleportEntity(g_iWeaponNULL_VECTORNULL_VECTORNULL_VECTOR);
    
ChangeEdictState(g_iWeapon0);

How to solve it?

Thanks.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 02-21-2020 at 15:57.
Dragokas is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 02-21-2020 , 15:31   Re: [L4D] How correctly ClearParent to enable physics?
Reply With Quote #2

https://github.com/LuxLuma/L4D2_Defi...s.sp#L336-L357

This stock should wakeup sleeping entites
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 02-21-2020 , 15:33   Re: [L4D] How correctly ClearParent to enable physics?
Reply With Quote #3

What I've done with weapons in another plugin is:

PHP Code:
SetEntityMoveType(entityMOVETYPE_FLYGRAVITY);
AcceptEntityInput(entity"ClearParent"); 
Also: "TeleportEntity(g_iWeapon, NULL_VECTOR, NULL_VECTOR, NULL_VECTOR);"
has no no affect because you're not changing anything. Instead try setting velocity vector to "view_as<float>({ 0.0, 0.0, 1.0 });" if the above doesn't work.
__________________
Silvers is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 02-21-2020 , 15:56   Re: [L4D] How correctly ClearParent to enable physics?
Reply With Quote #4

wow, thanks for fast replies.

MOVETYPE_FLYGRAVITY is not helped.

view_as<float>({ 0.0, 0.0, 1.0 } is work.

Lux hurt method is also work.

Thanks a lot !!! Solution was so close )
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 02-22-2020 , 08:14   Re: [L4D] How correctly ClearParent to enable physics?
Reply With Quote #5

Accidentally found.

I'll just leave links here for myself.

https://forums.alliedmods.net/showpo...&postcount=207
https://forums.alliedmods.net/showpo...&postcount=226

Thanks a much for explanation, Lux.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode