Raised This Month: $51 Target: $400
 12% 

Parenting Props To Players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MockingBird
Member
Join Date: Mar 2005
Old 11-15-2009 , 10:21   Parenting Props To Players
Reply With Quote #1

Hi all.

Im attempting to parent a prop_dynamic_override to a player (CS:S).

I have somewhat successfully done that with the code below:
PHP Code:
GiveLunchTray(index)
{
    if(
lunchTrayIds[index] != 0) return
    
    new 
ent CreateEntityByName("prop_dynamic_override");
    
SetEntityModel(entMDL_LUNCHTRYA);
    
    new 
Float:angles[3], Float:origin[3], Float:trayPos[3]
    
    
GetClientAbsOrigin(indexorigin)
    
GetEntPropVector(indexProp_Data"m_angAbsRotation"angles)
    
    
trayPos[2] = origin[2] + 40.0
    trayPos
[0] = Cosine(DegToRad(angles[1])) * 50.0 origin[0]
    
trayPos[1] = Sine(DegToRad(angles[1])) * 50.0 origin[1]
    
    
DispatchSpawn(ent)
    
TeleportEntity(enttrayPosanglesNULL_VECTOR)
    
//SetEntProp(ent, Prop_Data, "m_iParent", index)
    
SetVariantString("!activator");
    
AcceptEntityInput(ent"SetParent"indexent0);
    
    
lunchTrayIds[index] = ent

However there is an undesired effect. When the player looks around, the prop rotates around the origin of the player (i.e, the players feet).

I simply want to parent the prop to the players model, not the players vision.

Is there a way to do this that im missing?

Any help is appreciated

Thanks in advanced

Last edited by MockingBird; 11-16-2009 at 20:42.
MockingBird 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 19:45.


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