View Single Post
King_OXO
Senior Member
Join Date: Dec 2020
Location: Brazil
Old 12-08-2023 , 22:33   Re: [L4D2] prop_dynamic_override couldn't teleport with velocity
Reply With Quote #2

Quote:
Originally Posted by LinLinLin View Post
code:
PHP Code:
    int entity CreateEntityByName("prop_dynamic_override");
    if( 
entity || !IsValidEntity(entity) )
        return 
Plugin_Handled;
    
    
DispatchKeyValue(entity"model"PIPEBOMB);
    
DispatchKeyValue(entity"spawnflags""256");
    
DispatchKeyValue(entity"disablereceiveshadows""1");
    
DispatchKeyValue(entity"disableshadows""1");
    
DispatchKeyValue(entity"solid""0");
    
SetEntProp(entityProp_Send"m_nSolidType"61);
    
SetEntProp(entityProp_Send"m_CollisionGroup"2);
    
DispatchSpawn(entity);
    
g_pipebomb[client] = entity;
    
PrintToChat(client"Create pipebomb for client %N"client); 
teleport code in SDKHook_PostThink callback for client.
PHP Code:
    GetEntPropVector(g_pipebomb[client], Prop_Data"m_vecAbsOrigin"currentpos);
    
GetEntPropVector(g_pipebomb[client], Prop_Data"m_angAbsRotation"currentang);
    
PrintToServer("Entity(%d) pos %.1f,%.1f,%.1f ang %.1f,%.1f,%.1f"g_pipebomb[client],
    
currentpos[0],currentpos[1],currentpos[2],
    
currentang[0],currentang[1],currentang[2]);
    
PrintToServer("Target(%d) pos %.1f,%.1f,%.1f ang %.1f,%.1f,%.1f"target,
    
targetpos[0],targetpos[1],targetpos[2],
    
targetang[0],targetang[1],targetang[2]);

    
MakeVectorFromPoints(currentpostargetposvel);
    
PrintToServer("Vel %.0f, %.0f, %.0f"vel[0],vel[1],vel[2]);
    
TeleportEntity(g_pipebomb[client], NULL_VECTORtargetangvel); 
teleport not work for velocity, but ang are changed successfully.
pos and vel num are correct base on the print infomation.
does something wrong with the code?
Use molotov_projectile. Valve did not develop prop dynamics objects to be movable, just projectiles, players and prop_physics
__________________
_________________
Discord: gabrielbr007
YouTube: WhiteFire
Steam: WhiteFire
King_OXO is offline