Raised This Month: $ Target: $400
 0% 

Set player camera


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 10-10-2009 , 06:03   Set player camera
Reply With Quote #1

I like this method,but it lags ( when moving you see you going like a lager and it annoys :/ ), is there are any other ways to set the players view ( not set_view (but it not lags) ) ???
PHP Code:
//Call this wherever you want.
Create_PlayerCameraid )
{
    new 
entid;
    while( (
entid find_ent_by_class(entid"PlayerCamera")) != 0)
        if( 
entity_get_edictentidEV_ENT_owner ) == id )
        {
            
attach_viewidentid );
            return;
        }
        
    
entid create_entity("info_target");
        
    if(
entid)
    {
        
entity_set_string(entid,EV_SZ_classname,"PlayerCamera");
        
entity_set_model(entid,"models/w_usp.mdl");
        
entity_set_intentidEV_INT_solidSOLID_TRIGGER);
        
entity_set_intentidEV_INT_movetypeMOVETYPE_FLY );
        
         
//Set owner
        
entity_set_edictentidEV_ENT_ownerid );
        
//Don't draw
        
entity_set_intentidEV_INT_rendermodekRenderTransTexture);
        
entity_set_floatentidEV_FL_renderamt0.0);
        
//Attach our view to this entity.
        
attach_viewidentid ); 
        
//Think!
        
entity_set_floatentidEV_FL_nextthinkget_gametime() );
    }   
}
public 
Think_PlayerCameraentid )
{
    new 
id entity_get_edictentidEV_ENT_owner );
    
    
//Kill our entity if we hit USE key
    
new buttons entity_get_intidEV_INT_button );
    if(
buttons IN_USE)
    {
        
attach_viewidid );
        
remove_entity(entid);
        return;
    }

    new 
Float:origin[3], Float:angle[3], Float:vBack[3];
    
entity_get_vectoridEV_VEC_originorigin );
    
entity_get_vectoridEV_VEC_v_angleangle );

    
angle_vectorangleANGLEVECTOR_FORWARDvBack );

    
origin[2] += 20.0//So we're closer to the eyes.
    
    //Move back to see ourself (150 units)
    
origin[0] += (-vBack[0] * 150.0);
    
origin[1] += (-vBack[1] * 150.0);
    
origin[2] += (-vBack[2] * 150.0);

    
entity_set_originentidorigin );
    
entity_set_vectorentidEV_VEC_anglesangle );   
    
    
//For thinking only
    
entity_set_floatentidEV_FL_nextthinkget_gametime() );

__________________

Last edited by xbatista; 10-10-2009 at 06:11.
xbatista is offline
Send a message via Skype™ to xbatista
 


Thread Tools
Display Modes

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 22:34.


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