Find Nearest Object/Wall & Z value of floor @ point?
Forgive me as I am learning my way around the code - I couldn't find a function to identify the closest object / wall / whatever - is there one?
Reason: I am trying to implement the Shadow Knight AA Hate Step in the code. On live, this is an activatable AA that sends the SK forward x distance instantly; think Shadow Step, but always in the direction you are facing, for a fixed distance, unless you run into an object or wall, of course. Right now, I have the code working for the spell ( no, the client didn't take care of this for me like it does with Shadow Step and yes, I added a break condition to the spell effect code switch ). The only problem is that I can go through walls and at the moment, I can't 'place' the character on the ground should the ground he is facing be lower than what he is on ( much less preventing him from going through a wall when the ground is slanted upwards ), since I don't know of a funciton to find the z value at a given point. So what I think I need is: 1. the ability to find objects / walls 'in the way' along a certain vector. 2. the ability to read the Z value of the map along said vector. Anyone who knows the code that can point me to the functions I am looking for, if they exist? Thanks! |
I believe you are looking for the line of sight function. Check LoS to your point?
|
Defined in map.h/map.cpp
Code:
bool LineIntersectsZone(VERTEX start, VERTEX end, float step, VERTEX *result, FACE **on = NULL) const; I believe the result vertex is the point of collision, and the face 'on' is the triangle that was hit. Code:
float Map::FindBestZ( NodeRef node_r, VERTEX p1, VERTEX *result, FACE **on) const something, then will return the Z of the face it intersected. If it finds no ground beneath the given point, it will try again from 10 Z units higher up. If you look in waypoints.cpp and pathing.cpp, you will find examples of both functions in use. |
Thank you both! I must have went right by those - will let you all know how it goes.
Thanks! |
Ok, so I gave it a few runs, tried to add in debug messages to figure out what was going wrong, but have to throw in the towel and see if you guys can spot what I am doing wrong here. Here is the sample code I wrote for the Hate Step effect ( recall - warps a character forward in the direction they are facing x distance; its an SK AA on live ).
Code:
case SE_ShadowStepDirectional: I can paste in some of the logs too if that helps, but I figured it may be hard to envision in pure numbers when one is in a wall or not... :) Anything stand out as to what I am doing wrong? Seems like a rather simple thing to implement but I put no limits as to what I can screw up! :grin: |
All times are GMT -4. The time now is 11:01 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.