Raised This Month: $ Target: $400
 0% 

how to limiting angle of rotation?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leech_v2
Senior Member
Join Date: Mar 2011
Location: Chinese GuangDong
Old 05-31-2012 , 18:07   how to limiting angle of rotation?
Reply With Quote #1

Code:
public fw_MissileThink(ent)
{
        if (!pev_valid(ent)) return
        new class[33]
        pev(ent, pev_classname, any:class, any:32)
        if (!equal(class, "rpg_missile")) return
        new id = entity_get_edict(ent, EV_ENT_owner)
        new Float:vec[3]
        velocity_by_aim(ent, 800, vec)
        set_pev(ent, pev_velocity, any:vec)
        new org[3], Float:org2[3]
        if (is_user_alive(id) && g_haswpn[id] && get_user_weapon(id)==CSW_AWP)
        {
                get_user_origin(id, org, 3)
                org2[0] = float(org[0]), org2[1] = float(org[1]), org2[2] = float(org[2])
                aim_origin(ent, org2)
        }
        pev(ent, pev_origin, any:org2)
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_SMOKE)
        write_coord(floatround(org2[0]))
        write_coord(floatround(org2[1]))
        write_coord(floatround(org2[2])-20)
        write_short(g_smokeSpr2)
        write_byte(5)
        write_byte(30)
        message_end()
        set_pev(ent, pev_nextthink, any:(get_gametime()+0.01))
}
stock aim_origin(ent, Float:origin[3])
{
        static Float:org[3], Float:vec[3], Float:ang[3], Float:num
        pev(ent, pev_origin, any:org)
        vec[0] = origin[0] - org[0]
        vec[1] = origin[1] - org[1]
        vec[2] = origin[2] - org[2]
        num = 800.0/vector_length(vec)
        vec[0] *= num, vec[1] *= num, vec[2] *= num/-1.0
        vector_to_angle(vec, ang)
        set_pev(ent, pev_v_angle, any:ang)
        ang[0]/=-1.0
        set_pev(ent, pev_angles, any:ang)
}
Leech_v2 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 16:24.


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