Radar Sensor

I was trying to fake AI by putting in different sensors and having the enemy (a cube) walk up to you and stop when he gets close. I made it so that if you bumped into him he’d turn around and chase you, and I wanted to give him periferal vision so if he saw you walking passed he would turn and chase you.

The easiest method was a Radar sensor, so I made an empty that shot one out and had it parented to my cube-enemy. When I walked passed him to test out his vision, the radar worked, but more as a collision sensor that slammed into my guy and pushed him off the map. I managed to get around the problem just by using normal ray sensors but I’m still quirious as to why the radar would do that.

Hi!

I have also a problem to add some AI to an animated character.

I have set Sumo instead of Bullet for the Physics Engine, because the character who is animated by actions on his armature was flying away when using Bullets.

I have added an Empty parented to the armature (because the armature has the axis in the wrong direction, so I cant use Positive Y axis for the Radar sensor) and used this Empty as radar sensor.

The goal is to make the character avoid obstacles instead of being sticked against the walls and walking stupidly on place.

I have connected a message actuator to the Radar sensor, and when the message is sent to the armature, a message sensor applied to the armature is supposed to read the message and switch on an action with a superior priority (0 instead of 1 for the ordinary walk cycle), and the character should turn on the right…

I can’t make it work.

I have added a sound actuator, and the message seems to be decoded, but the action is not played…

Philippe.

The near sensor works pretty good for me. I’ve found the radar sensor to be unusable, usually causing the character to fly off in wierd directions. The ray sensor works off and on. I had to give up using it because it wasn’t dependable in the game I’m working on now. Sometimes it would work great, other times it would not work. It might have been a conflict or something, I’m not sure. It seemed to work good when there weren’t too many walls around, but when there were walls around, it started giving false signals.

Hi!

I have tried something else :

I have done this trial only on a simple scene with a moving cube instead of a character animated by actions.

I have added 2 invisibles deformed cubes onthe right and on the left of the object supposed to be the character, and these cubes are parented to this object.

The 2 deformed cubes are set as touch sensors, and send messages (Turn Right, Turn Left) to the main object which has motion actuators receiving the messages from 2 messages sensors.

I couldnt get it work…

So I have tried something else, applying 2 different kinds of obstacles, and adding them a touch sensor sending the messages above, instead of leaving the cubes parented to the “character” object send the messages.

This seems to work…

Strange!

I’m afraid that I’ll have to search much more before trying with the real animated character…

Philippe

ROUBAL,

just guessing, but ,if your meshes are flying off the armatures usualy means that you have not ticked the actor>ghost button ,in the logic blocks window for your armature.

well… anything in general that explodes, and is made up of 2 or more seperate objects, usualy means that you have 2 solid actors inside each other.

Trust me, you really do not want to use SUMO.
hope this helps :slight_smile:

well… anything in general that explodes, and is made up of 2 or more seperate objects, usualy means that you have 2 solid actors inside each other.

I have noticed that in my first trials, but it is not the case here.

I have got one armature and it’s mesh. First, the actor was the armature, and the mesh was not actor. It worked fine using SUMO. I have read that BULLETS doesn’t allows Dynamics on armatures.

I can’t make the armature as ghost and the mesh as Actor and Dynamic, because as the parent is the armature, contacts with obstacles will displace the mesh away from the armature!

If I set the armature as actor and ghost, the character will pass through the obstacles…

Well, this can be solved using SUMO for physics engine, but the AI problem itself is not solved…

I have tried also to avoid using Dynamics on the character and faking all the behaviour (avoiding obstacles) with sensors and actuators, but the character will not be able to climb slopes or stairs… Also, the sensors seems to not react as they are supposed to do.

Philippe.

I’m working on IA as well.
But in python. I had two cubes, and two empties for each. One cube was on top of the other. The empties were in two corners of each cube, with ray sensors.

The upper cube always faced the target object. If none of the empties detected any obstacles the lower cube would take the same direction and start to move. If a wall is detected the lower cube starts to turn untill the raysensors are negative. Then it starts to move, until the upper cubes raysensors are free as well, then the lower cube turns to the right direction again.

My greatest trouble is how to make the cube decide which way to turn, I’m thinking of a very complicated code with maybe .getHitObject().getOwner().getOrientation() or something, or just simply randomize a direction… I will post a .blend if I get succesfull

Hi! this sounds interesting, but as I’m really hopeless at programming, I am afraid that I will not even understand one unique line of Python code… :o

But as a former electronician, your method seems to be what is called in french “écartométrie différentielle”.

I 'm not able to translate it… It is a method used in robotics to keep a trajectory using photo diodes , Operationnals Amplifiers and some hardware logic. The same method used in the tracking system of missiles driven by heat sources.

Philippe.