Raised This Month: $ Target: $400
 0% 

Using velocity_by_aim() to Get Other Directions


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-05-2010 , 15:31   Using velocity_by_aim() to Get Other Directions
Reply With Quote #1

Hello. I want to increate player's speed using velocity.
I have two directions so far: forwards, backwards.
I need six of them: upwards, downwards, left, right.
PHP Code:
#define GOING_SPEED 320
 
enum
{
    
GO_UP,
    
GO_DOWN,
    
GO_LEFT,
    
GO_RIGHT,
    
GO_FORWARD,
    
GO_BACK
};
 
public 
client_PostThink(Client)
{
    if (!
is_user_alive(Client))
        return;
 
    static 
Float:s_Velocity[3];
    
entity_get_vector(ClientEV_VEC_velocitys_Velocity);
    
velocity_by_aim(ClientGOING_SPEEDs_Velocity);
 
    switch (
GetDirection(Client)) // Returns one of the enumerated directions
    
{
        case 
GO_FORWARD:
        {
            
// velocity_by_aim() already gave the needed velocity, do nothing
        
}
        case 
GO_BACK:
        {
            
s_Velocity[0] = -s_Velocity[0];
            
s_Velocity[1] = -s_Velocity[1];
            
s_Velocity[2] = -s_Velocity[2];
        }
    }
 
    
entity_set_vector(ClientEV_VEC_velocitys_Velocity);

So, how do I calculate the other directions? And is there a better way to do this?
__________________

Last edited by hleV; 08-05-2010 at 15:41.
hleV is offline
 



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 00:18.


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