![]() |
![]() |
Swoop |
![]()
Post
#1
|
![]() Newbie ![]() Group: Members Posts: 9 Joined: 22-March 06 From: Colorado Member No.: 702 ![]() |
Hi.
I had two questions about waypointing. 1. I have taken the commandmenu.txt file from Sven Coop and have added some functions for quickly adding waypoints, entering into "edit mode (authenticate, godmode, noclip, waypoints on...), etc, and was wondering how I either send a command to choose the menu items from the waypoint_menu OR actually send the command to perform the same function. For example, in command_menu.txt, I have a whole section on adding flasg to existing waypoints. I tried to say "waypoint_menu; 2; 1" and the waypoint menu fails to catch the keystroke to add a JUMP flag. What's the best way to do this? Is there a function I could replace all of that with, such as "addflag wl_jump"? 2. Second Question: I think it would be AWESOME if you could use the crosshair from your weapon to select and view individual waypoints in the vicinity, exactly the same way you would do it now by walking up to the waypoint, but you wouldn't have to ncessarily move around as much; just aim and seloect. ![]() So, how hard would it be to check what the crosshair is centered on and show the paths to that waypoint in focus? I would even try it myself if it isn't too much of a doozie to code. ![]() Thanks for your time, Swoop |
![]() ![]() |
Cheeseh |
![]()
Post
#2
|
||||||
![]() Admin ![]() ![]() ![]() ![]() ![]() Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 ![]() |
to get the facing waypoint you need to find the nearest waypoint where the player is looking, otherwise if you are looking through a line of waypoints you'll get confused as to what waypoint you want to manipulate. The method will become a little more complicated because I hash waypoints in another structure for fast retrival, so if you want to makeuse of that then this would be the best algorithm (LAST METHOD .. i think -- been thinking through all these) the first method uses the waypointLocations hash table, the other methods do simple looping through every single waypoint. //// hashing technique // go through several steps from facing vector // find nearest waypoint to facing vector at several stages // each stage is fStep units 1. generate facing vector i.e. UTIL_MakeVectors(pPlayer->v.v_angle) 2. create the source vector (where player is) and the destination vector (where player is looking) i.e. Vector v_src = pPlayer->v.origin+pPlayer->v.view_ofs; Vector v_dest = v_src + (gpGlobals->v_forward*8192); // far enough to possibly reach end of map 3. run a traceline to get the actual end point TraceResult tr; UTIL_TraceLine (v_src,v_dest, ......) Vector v_endpoint = tr.endPos; // something like that anyway float fEndDistance = (v_endpoint - v_src).Length(); // distance to stop this is the end vector to stop searching 4. start at say
advantages : uses hash table and priority queue (fast) disadvantages : worst case greater than version below if Step is too small (can solve by storing bit mask of all waypoints --(CBits class)and if they have been evaluated or not and take this into account in finding nearest waypoint in waypointlocations) fStep must be a value not too small, not too large uses a traceline naive method !! (see last method) ////////////////////// // angle technique run through each waypoint find angle between player and waypoint store waypoint with nearest angle and distance (overwrite best waypoint each time)
advantages: simple calculations more robust than other algorithm disadvantages: differentiation between distance difficult (not done here) runs though every single waypoint ------------- possible distance calculation method for the above
advantages: simple calculations more robust than other algorithm takes distance into account aswell disadvantages: runs though every single waypoint available |
||||||
![]() ![]() |
![]() |
Lo-Fi Version | Time is now: 12th September 2025 - 01:45 AM |