Problem with AI and Player Mesh--Please Help
by Richard Blumenstein · in Torque Game Engine · 02/08/2008 (12:03 pm) · 19 replies
I am having a big issue right now with my AI not finding my player. I can walk right up to them and they just keep searching, but the instance I turn around he shoots me in the back. I do not know why this is. Does somebody know the answer to this problem? The character is made in 3ds Max 8 using bones. Please help.
Richard Blumenstein
skuatmraa@gmail.com
Richard Blumenstein
skuatmraa@gmail.com
#2
Richard Blumenstein
Skuatmraa@gmail.com
02/10/2008 (7:54 am)
It is not in the script code, I have 3 models, kork, an original version of the character and a new version of the character. It is the AI guard and patrol, that do not see the new version of the character. They do see the old version just fine.Richard Blumenstein
Skuatmraa@gmail.com
#3
02/10/2008 (10:07 am)
If you do a search of the resources, there's an aiGuard resource that will give you a really big help in figureing things out.
#4
It is not in the script code
Yes it is. A different DTS wouldn't make a difference, here, unless it was really screwed up--in which case it probably wouldn't work as a player at all.
02/10/2008 (1:42 pm)
@Richard:It is not in the script code
Yes it is. A different DTS wouldn't make a difference, here, unless it was really screwed up--in which case it probably wouldn't work as a player at all.
#5
www.richardblumenstein.com/torque/problemwithai.rar
on a side note, a student of mine had the same problem and with the help of Ben Geisler from FrozenCodebase he determined that the problem was not with the code. He fixed the model by moving the eye node inside the head of the student's character. This solved the student's problem but the same solution did not work for me.
Any other suggestions?
Richard Blumenstein
skuatmraa@gmail.com
02/12/2008 (5:52 pm)
I have looked at the code between the Ai files that work and those that don't and it is basically the same thing. I don't think I know enough about the code to make it work. I did upload my files at this address: www.richardblumenstein.com/torque/problemwithai.rar
on a side note, a student of mine had the same problem and with the help of Ben Geisler from FrozenCodebase he determined that the problem was not with the code. He fixed the model by moving the eye node inside the head of the student's character. This solved the student's problem but the same solution did not work for me.
Any other suggestions?
Richard Blumenstein
skuatmraa@gmail.com
#6
02/12/2008 (5:55 pm)
Are you using and IDE for your scripting, such as Torsion? I couldn't get by without it.
#7
02/12/2008 (6:15 pm)
I am using Visual C++ Express for compiling and Torsion for scripting.
#8
02/12/2008 (6:16 pm)
Well, have you tried stepping through the code?
#9
02/12/2008 (6:19 pm)
I've read the code backwards and forwards, both ai's, working and non working are using the same method of calling getting the closest enemy and attacking. They are basically the same code just using different variables. I still swear its the model since it works when I use Kork or the old model, not the new one.
#10
The code must fail. I'm not saying the problem couldn't be the model, necessarily. But if the code worked, you wouldn't have a problem. See what I'm saying?
02/12/2008 (6:49 pm)
You've read the code, but have you stepped through it? If you can see where it fails, it may help you to figure out what's wrong with the model.The code must fail. I'm not saying the problem couldn't be the model, necessarily. But if the code worked, you wouldn't have a problem. See what I'm saying?
#11
02/12/2008 (9:14 pm)
You do have a collision mesh on it?
#13
02/13/2008 (11:48 am)
You do not put collision meshes on characters since they use the bounds box as collision
#14
02/13/2008 (6:41 pm)
UPDATE: I updated the dts exporter to dts2maxexporterPLUS and it exports, the character sees it but now none of the nodes export and it exports twice the size. Any suggestions?
#15
02/13/2008 (7:01 pm)
The exporter only creates a mesh and doesnt export anything else so I need to figure out the problem with the old exporter
#16
If you want to send me the file i can take a look.
OR. posting shots of your heirarchy/cfg file/etc/etc could help as well
02/13/2008 (7:34 pm)
Without the file in front of me id be hard pressed to give a definitive answer on this problem. Id definately stick with the old exporter. Despite what other (less experienced) people have been known to say, it gets the job done.If you want to send me the file i can take a look.
OR. posting shots of your heirarchy/cfg file/etc/etc could help as well
#17
Richard
02/14/2008 (5:27 am)
You can download the pertaining files at www.richardblumenstein.com/torque/problemwithai.rarRichard
#18
First, your scene organization is, frankly, kind of a mess. Take the time to properly name your bones and controls, and don't sequence things with numbers. Use letters instead. So instead of naming FingerLt1, fingerLt2, id do fingerLt_A, fingerlt_B. The reason for this is shown if you look at your shape in showtool: One of your spine bones and all your finger bones are exported as geometry. Remember, a number trailing the name of ANY object in your scene will make the render see it as part of a level of detail.
Next, remember, its good practice to have your bounding box not only enclose the character in its root pose, but also the extents of it when its going through all its animations. Also, be sure to create the bounds in either the top or perspective views, otherwise its x,y,z will be altered so z isn't up, x isn't the side, and y isn't the front/back. Im guessing you created the bounds in a different view, because if i go to change the height, length, or width parameters, height is scaling what the length should be, and length is scaling the height. Finally, its good practice to have your object centered in the scene, with your bounding box pivot at 0,0,0. Not a big deal for random small objects, but a non-zero'd bounds can mess up how things get mounted to a shape (for example, wheels will mount to a car with an offset if the bounds isn't centered on the car mesh).
Finally, you shouldn't use transparent textures on skinned meshes, as it will cause wacky sorting errors. There are ways to get around these sorting errors if you NEED transparency on something, but its a bit convoluted and not really on topic for this post.
Id recommend you make some changes per these suggestions and see if it helps you out - particularly anything dealing with the bounds. Good luck!
02/14/2008 (9:11 pm)
Richard, there a few issues that, while Im not sure if they are connected with the issue you started the post for, I figured Id make you aware of for your future torqueing.First, your scene organization is, frankly, kind of a mess. Take the time to properly name your bones and controls, and don't sequence things with numbers. Use letters instead. So instead of naming FingerLt1, fingerLt2, id do fingerLt_A, fingerlt_B. The reason for this is shown if you look at your shape in showtool: One of your spine bones and all your finger bones are exported as geometry. Remember, a number trailing the name of ANY object in your scene will make the render see it as part of a level of detail.
Next, remember, its good practice to have your bounding box not only enclose the character in its root pose, but also the extents of it when its going through all its animations. Also, be sure to create the bounds in either the top or perspective views, otherwise its x,y,z will be altered so z isn't up, x isn't the side, and y isn't the front/back. Im guessing you created the bounds in a different view, because if i go to change the height, length, or width parameters, height is scaling what the length should be, and length is scaling the height. Finally, its good practice to have your object centered in the scene, with your bounding box pivot at 0,0,0. Not a big deal for random small objects, but a non-zero'd bounds can mess up how things get mounted to a shape (for example, wheels will mount to a car with an offset if the bounds isn't centered on the car mesh).
Finally, you shouldn't use transparent textures on skinned meshes, as it will cause wacky sorting errors. There are ways to get around these sorting errors if you NEED transparency on something, but its a bit convoluted and not really on topic for this post.
Id recommend you make some changes per these suggestions and see if it helps you out - particularly anything dealing with the bounds. Good luck!
#19
Richard
02/15/2008 (9:12 am)
Yeah I admit I got kinda lazy on the naming conventsions, but I did not know anything about using letters instead of numbers. I changed that and set the bounding box to 0 0 0. I also removed the transparent texture and then I also centered the bounding box pivot point. It worked but the mesh sticks halfway into the ground. So in order to fix that I moved the pivot point down towards the feet and that broke the ai again. Any ideas?Richard
Torque Owner Lee Latham
Default Studio Name