AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   aim_at_origin (https://forums.alliedmods.net/showthread.php?t=46395)

Ramono 10-25-2006 17:13

aim_at_origin
 
Is there anyway to aim at a origin, i tryed some calculations already, but im bad with hard calculations. :(

Code:
public aim_at_origin(id,origin[3]) {     new angles[3]     //...     //...     //...     //...     //...     entity_set_vector(id,EV_VEC_angles,angles)     // or     set_pev(id,pev_angles,angles) }

jRaven 10-25-2006 19:08

Re: aim_at_origin
 
entity_get_vector(id,EV_VEC_angles,angles) ?

Edit: okay, I'm an idiot.

Zenith77 10-25-2006 19:10

Re: aim_at_origin
 
What a great response. He's trying to set something, not get it. Try setting puchangles (or look in aimbot plugins).

TheNewt 10-25-2006 20:34

Re: aim_at_origin
 
This is what I use...
Code:
sentry_turntotarget(ent, Float:sentryOrigin[3], target, Float:closestOrigin[3]) {     if(target) {         new name[32]         get_user_name(target, name, 31)                 new Float:newAngle[3]         entity_get_vector(ent, EV_VEC_angles, newAngle)         new Float:x = closestOrigin[0] - sentryOrigin[0]         new Float:z = closestOrigin[1] - sentryOrigin[1]                 new Float:radians = floatatan(z/x, radian)         newAngle[1] = radians * (180.0 / 3.141592654)         newAngle[1] += 180         if (closestOrigin[0] < sentryOrigin[0])             newAngle[1] -= 180.0                 entity_set_float(ent, SENTRY_FL_ANGLE, newAngle[1])                 new Float:h = closestOrigin[2] - sentryOrigin[2]         new Float:b = vector_distance(sentryOrigin, closestOrigin)         radians = floatatan(h/b, radian)         new Float:degs = radians * (180.0 / 3.141592654)                 new Float:degreeByte = 830.0/256.0;         new Float:tilt = 127.0 - degreeByte * degs;                 entity_set_byte(ent, SENTRY_TILT_TURRET, floatround(tilt))         entity_set_vector(ent, EV_VEC_angles, newAngle)     } }
It is from the SentryGuns plugin, and had to revise a lot of it to make it cleaner. But it forces and Entity to turn to a target.
Go look in the Sentry Guns plugin and see how he does it, it should be very similiar.
Some lines aren't truelly necassary for calculating the angles, they are just fuser, iuser, etc to hold values specific to that entity.
Sorry I can't be much of help, hope that gives you somewhere to start looking though!

Greenberet 10-26-2006 13:21

Re: aim_at_origin
 
to set the angles of an client you have to set pev_fixangle to 1


All times are GMT -4. The time now is 04:57.

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