|
Senior Member
Join Date: Jan 2020
Location: Spain
|
12-07-2023
, 18:13
Re: [L4D2] predicted_viewmodel can't set attach to other entity
|
#7
|
Quote:
Originally Posted by LinLinLin
code below:
PHP Code:
int entity = CreateEntityByName("predicted_viewmodel");
if( entity < 1 || !IsValidEntity(entity) )
return ;
SetEntPropEnt(entity, Prop_Send, "m_hOwner", client);
SetEntPropEnt(entity, Prop_Send, "m_hWeapon", weapon);
SetEntityModel(entity, RIOTSHIELD_V);
ActivateEntity(entity);
SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", targetentity);
SetVariantString("!activator");
AcceptEntityInput(entity, "SetAttached", targetentity);
DispatchSpawn(entity);
by use cl_pdump to check entity, it still fix in (0.0.0) pos in the world and never follow the targetentity.
is the code got some mistake or just the predicted_viewmodel enttiy can't be attached to other entity?
|
You need to teleport your entity (use TeleportEntity), when parenting the entity will start moving from its origin relative to the player position and angles.
__________________
|
|
|
|