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

Solved have entity move where i aim at.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BANDIT228
Member
Join Date: Sep 2017
Old 07-19-2018 , 14:53   have entity move where i aim at.
Reply With Quote #1

public AIM(id)
{
if (is_valid_ent(id))
{
new Float:Velocity[3]
VelocityByAim(pev(id,pev_owner), 1000, Velocity)
entity_set_vector(id, EV_VEC_velocity, Velocity)
new Float:NewAngle[3]
entity_get_vector(id, EV_VEC_v_angle, NewAngle)
entity_set_vector(id, EV_VEC_angles, NewAngle)
}
}

currently i use that...........dont find any other good examples....

i am sure i need to use "get user origin"

thing is....i spawn a entity form another player...........that entity should fly to the position i aim at.

right now i only takes my angles.....

but i want it that i look at the ground and it flys there.

anyone has a snippet for me?

Last edited by BANDIT228; 07-20-2018 at 05:52.
BANDIT228 is offline
BANDIT228
Member
Join Date: Sep 2017
Old 07-20-2018 , 00:13   Re: have entity move where i aim at.
Reply With Quote #2

no one?



stock fm_get_aim_origin(index, Floatrigin[3]) {
new Float:start[3], Float:view_ofs[3];
pev(index, pev_origin, start);
pev(index, pev_view_ofs, view_ofs);
xs_vec_add(start, view_ofs, start);

new Float:dest[3];
pev(index, pev_v_angle, dest);
engfunc(EngFunc_MakeVectors, dest);
global_get(glb_v_forward, dest);
xs_vec_mul_scalar(dest, 9999.0, dest);
xs_vec_add(start, dest, dest);

engfunc(EngFunc_TraceLine, start, dest, 0, index, 0);
get_tr2(0, TR_vecEndPos, origin);

return 1;
}



---------------------------------------------------





?
new Float:AimOrigin[3];
new Float:EntityAngles[3];
new Float:EntityOrigin[3];
new Floatirection[3];

xs_vec_sub( AimOrigin, EntityOrigin, Direction );
xs_vec_normalize( Direction, Direction );

vector_to_angle( Direction, EntityAngles );
set_pev( Entity, pev_angles, EntityAngles );
?


which one would be better?

Last edited by BANDIT228; 07-20-2018 at 01:24.
BANDIT228 is offline
Reply


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 16:16.


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