AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting a normal vector (https://forums.alliedmods.net/showthread.php?t=62191)

house 10-20-2007 13:51

Getting a normal vector
 
I want to get the normal vector for the part of the map that the user is aiming at; this gets me the location:

PHP Code:

public lol(id,level,cid)
{
    new 
orig[3]
    
get_user_origin(id,orig,3)

    ...

    return 
PLUGIN_HANDLED


How could I get the normal vector at that point ?

Wilson [29th ID] 10-20-2007 22:20

Re: Getting a normal vector
 
get_user_aiming()

Or you could fire a traceline and get the end point. Check FM Utilities for that.

house 10-21-2007 10:59

Re: Getting a normal vector
 
what ?

I'm trying to get a normal to a part of the map.

http://cgkit.sourceforge.net/tutoria...screenshot.jpg

That's what normals look like. The normal does not depend on the players' orientation relative to the surface.


EDIT
For clarification, in get_user_origin(...) that 3 is the flag for:
3 - End position from eyes (hit point for weapon)

That would be the surface-point I want the normal from.

VEN 10-21-2007 12:07

Re: Getting a normal vector
 
Code:
 static Float:start[3], Float:dest[3]  pev(id, pev_origin, start)  pev(id, pev_view_ofs, dest)  xs_vec_add(start, dest, start)  pev(id, 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, IGNORE_MONSTERS, id, 0)  get_tr2(0, TR_vecPlaneNormal, dest)


All times are GMT -4. The time now is 01:14.

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