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

Origin stuff


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Obbin
Senior Member
Join Date: Mar 2005
Location: 192.168.1.3
Old 01-20-2006 , 16:28   Origin stuff
Reply With Quote #1

I know allmost the same quesion has been asked before (aiming direction and that stuff) but i couldn't figure out how to do this.

Here it is:
I want to get the position (x, y, z) that is 1500 units forward in the aiming direction of the player.

Thx.
__________________
Sig(h)!
Obbin is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 01-20-2006 , 22:03  
Reply With Quote #2

posted in this topic:

Code:
public find_origin_passed(Float:origin[3],Float:angles[3],Float:dist,Float:output[3]) {     output[0] = origin[0] + dist * floatcos(angles[1],degrees) * floatabs(floatcos(angles[0],degrees));     output[1] = origin[1] + dist * floatsin(angles[1],degrees) * floatabs(floatcos(angles[0],degrees));     output[2] = origin[2] + dist * floatsin(angles[0],degrees);  }
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
Obbin
Senior Member
Join Date: Mar 2005
Location: 192.168.1.3
Old 01-21-2006 , 04:27  
Reply With Quote #3

I do really not understand
Could you make a function that stored the new position in a global var?
__________________
Sig(h)!
Obbin is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 01-21-2006 , 08:10  
Reply With Quote #4

You can't understand this if you are unfamiliar with trigonometry.
VEN is offline
KoST
Senior Member
Join Date: Jul 2005
Old 01-21-2006 , 11:21  
Reply With Quote #5

there is a way doing this without the need to calculate angles to vectors with floatcos and/or floatsin, since VelocityByAim does it already.. look at this code. it will show you the x,y and z coordinate (that is 1500 units forward in the aiming direction of the player) if you say "test" in game chat..

Code:
#nclude <amxmodx> #include <amxmisc> #include <engine> public plugin_init(){    register_plugin("Test","0.1","KoST")    register_clcmd("say test", "test", ADMIN_KICK,"test function") } public test(id,level,cid){    if(!cmd_access(id,level,cid,1)){       return PLUGIN_HANDLED    }        new distance=1500 // here you can adjust the distance    new Float:originalSpot[3],Float:aimVec[3]    // get user's origin    entity_get_vector(id,EV_VEC_origin,originalSpot)        // get a vector in the direction the player is looking    VelocityByAim(id,distance,aimVec)    // add offset to origin    originalSpot[0] += aimVec[0] // is the same as originalSpot[0] = originalSpot[0] + aimVec[0]    originalSpot[1] += aimVec[1]    originalSpot[2] += aimVec[2]    new Float:x=originalSpot[0] // here is your x    new Float:y=originalSpot[1] // here is your y    new Float:z=originalSpot[2] // here is your z    // output x,y and z coordinate    client_print(id,print_chat,"x=%f y=%f z=%f",x,y,z)    // uncomment the following line to teleport the player to that point    // entity_set_vector(id,EV_VEC_origin,originalSpot)    return PLUGIN_HANDLED }
__________________
KoST is offline
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 10-29-2006 , 13:09   Re: Origin stuff
Reply With Quote #6

how far is 1500 units? and how many units is the distance between 2 boxes like in the bomb site in dust
k007 is offline
Send a message via MSN to k007
VEN
Veteran Member
Join Date: Jan 2005
Old 10-31-2006 , 10:17   Re: Origin stuff
Reply With Quote #7

From statsx.sma
Quote:
// Distance formula (metric)
Float:distance(iDistance)
{
return float(iDistance) * 0.0254
}
VEN 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 23:45.


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