Blinkity Posted June 12, 2002 Share Posted June 12, 2002 Hello. I'm wondering, to all the experienced coders out there, if you know of any way to access the direction that a client's view is pointing in. I'm looking for a vector that contains the relative amounts on the x, y, and z axis that a straight line would bring you. This would be so that I can easily change the client's velocity to accelerate them in the direction they are pointing, including vertically. If anybody knows if there is a vector containing this information at any given time, it would be much appreciated. Thanks, Blinkity Link to comment Share on other sites More sharing options...
douanier007 Posted June 12, 2002 Share Posted June 12, 2002 ps->viewangles Link to comment Share on other sites More sharing options...
ASk Posted June 13, 2002 Share Posted June 13, 2002 i myself used a trace dont know about viewangles, but the trace worked: vec3_t a; vec3_t tfrom, tto, fwd; vec3_t center, forward, right, fwdangles = {0}; trace_t tr; int radius = 1024; VectorCopy( ent->client->ps.viewangles, fwdangles ); AngleVectors( fwdangles, forward, right, NULL ); VectorCopy( ent->client->ps.origin, center ); VectorCopy(ent->client->ps.origin, tfrom); tfrom[2] += ent->client->ps.viewheight; AngleVectors(ent->client->ps.viewangles, fwd, NULL, NULL); tto[0] = tfrom[0] + fwd[0]*radius/2; tto[1] = tfrom[1] + fwd[1]*radius/2; tto[2] = tfrom[2] + fwd[2]*radius/2; trap_Trace(&tr, tfrom, NULL, NULL, tto, ent->s.number, MASK_PLAYERSOLID); This raises the trace origin to eyes height and traces in a small radius in the forward direction Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.