AIPlayer::Chase function in C++ Code
by Caleb · in Torque Game Engine · 06/27/2006 (6:15 am) · 10 replies
I was trying to make an AIPlayer::Chase function in the aiplayer.cc file. I'm still getting ajusted to script so I figured C++ was the way to go (besides getting proximity every 1/100 of a secound needs to be fast).
But after running torque it couldn't find the function, So I cut and pasted the "setMoveDestination", Changed the name, put a definition in the aiplayer.h file and made a consel function just to see what would happen. However after all that it still doesn't work! I tried running the compiled version.....notin.
So what I realy need is someone who knows whats wrong to see if they can help me out (or at least make some suggestions).
P.S. would VectorDist(position, position) work in C++ Code?
Thanks.
EDIT- (position, position) is just an example.
But after running torque it couldn't find the function, So I cut and pasted the "setMoveDestination", Changed the name, put a definition in the aiplayer.h file and made a consel function just to see what would happen. However after all that it still doesn't work! I tried running the compiled version.....notin.
So what I realy need is someone who knows whats wrong to see if they can help me out (or at least make some suggestions).
P.S. would VectorDist(position, position) work in C++ Code?
Thanks.
EDIT- (position, position) is just an example.
#2
06/28/2006 (10:09 am)
In your build options take it off of debug and set it to release, this is in visual studio.
#3
P.S. I'm using Visual C++ 6.
06/28/2006 (10:42 am)
Do you mean change the output directory to the release or change an option from Debug.P.S. I'm using Visual C++ 6.
#4
It might be advantageous to consider running the debug version from with in Visual C++ 6.0, that way you can find out were issues arise if your changes ever make your project crash.
06/28/2006 (11:04 am)
There is a combo box at the top of Visual C++ 6.0 that probably lists"Win32 Debug". Change that to "Win32 Release" to compile a "release" build.It might be advantageous to consider running the debug version from with in Visual C++ 6.0, that way you can find out were issues arise if your changes ever make your project crash.
#5
06/28/2006 (5:41 pm)
Thanks but I still can'y find anything that should alow me to do this thing that you speak of. Screen shots, thats what I need some good screen shots.
#6
Here are the steps using visual C++'s menu (top of window):
1. select "Build"
2. in the drop down menu that appears, select "Set Active Configuration..."
3. in the dialog window that opens, select "Torque Demo - Win32 Release"
06/28/2006 (9:27 pm)
It is very possible that you don't have the toolbar open that has the combo.Here are the steps using visual C++'s menu (top of window):
1. select "Build"
2. in the drop down menu that appears, select "Set Active Configuration..."
3. in the dialog window that opens, select "Torque Demo - Win32 Release"
#7
06/29/2006 (11:03 am)
Jeff, your awsome. It works just fine now, THANKS A LOT!!!!
#8
I tried the easiest way I could think of:
(float v0 = object - v;)
Then comparing v0 to the minimal distance for chasing. However using a binary operator like "-" or using float gives me an error. I figured that it would, but I still can't find something that will let use this. I'm almost a 100% sure that using such an operator is impossible, so I really need a solution.
When stuff like this popped up with DirectX, I would write a function (sometimes a whole program) that would print the value that I needed to the screen. Then manually assign my ints, floats, exc. my value.
This time around the value needs to be updated while the program is running without we ever seeing it.
Anyways an expert on this would be nice.
Thanks.
06/30/2006 (7:07 am)
Aaarg! One of my worst problems from DirectX is here again. All I need to finish my AIPlayer::Chase Function is compare the distance between the object chasing and the object being chased.I tried the easiest way I could think of:
(float v0 = object - v;)
Then comparing v0 to the minimal distance for chasing. However using a binary operator like "-" or using float gives me an error. I figured that it would, but I still can't find something that will let use this. I'm almost a 100% sure that using such an operator is impossible, so I really need a solution.
When stuff like this popped up with DirectX, I would write a function (sometimes a whole program) that would print the value that I needed to the screen. Then manually assign my ints, floats, exc. my value.
This time around the value needs to be updated while the program is running without we ever seeing it.
Anyways an expert on this would be nice.
Thanks.
#9
float v0 = (object->getPosition() - v).len();
in which (object->getPosition() - v) is the vector from v to object's position and len() returns its length, aka the distance between the two objects.
06/30/2006 (8:21 am)
Assuming 'object' is a pointer to one object and 'v' the location of the other, you can dofloat v0 = (object->getPosition() - v).len();
in which (object->getPosition() - v) is the vector from v to object's position and len() returns its length, aka the distance between the two objects.
#10
THANK YOU ALL SO MUCH!!!!!!!!
if its all right... If I ever get around to making a resource I would like to put I special thanks to PHILIPP TULL and
JEFF WHITE!
06/30/2006 (9:11 am)
All is well!!! My C++ Chase function works (and veary smoothly also)THANK YOU ALL SO MUCH!!!!!!!!
if its all right... If I ever get around to making a resource I would like to put I special thanks to PHILIPP TULL and
JEFF WHITE!
Torque Owner Caleb
Default Studio Name
My changes only work with the debug version of Torque. However the Torque_Debug.exe is slower then just the Torque.exe, so I realy need to know if there is a way to modfiy the standard version's code permanently.
I'm sure there are other ways to do my chase function but if possible I would like to do it this way. If not I need to know so I can stop wasting time on this and I'll just go back to doing it in script.
Thanks.