Physics & AI

I've some problems letting my AI (NPC's, in my case) use physics:

1. addForce(1,0,0) doesn't make the affected spatial actually move 1 jME unit. addTorque the same
2. pathfinding using physics to detect if a spatial (NPC) can move to a point probaly won't work or is very hard to implement, right?
1. sure, depends on mass, friction, simulation step size, etc. etc.
2. you will need steering algorithms similar to real world robot steering in the worst case (depending on the detail of you AI avatar), but usually it's easy to control programmatically what your user can handle (at least if it does not need to be that 'smart')
1. So what values should I give to the mass, â€¦ to make it move always exactly one "jme Unit"?
2. Can I see some example code on that somewhere?
1. You won't be able to find such a value (that's what I was trying to hint at with the first answer, too). It depends on the material of the avatar, on the material of the ground, on possible other forces, obstacles etc. It's like asking: "Hey, how much gasoline does my car need to move exactly one meter?"
2. Sorry, I don't have any public code on this. Anybody else?
1. Is there a way to calculate what force is needed? There's probably a very easy mathematical function that I don't know, because I never got any physics classes.
SeySayux said:

1) Is there a way to calculate what force is needed? There's probably a very easy mathematical function that I don't know, because I never got any physics classes.

Let's see...
irrisor said:

It depends on the material of the avatar, on the material of the ground, on possible other forces, obstacles etc.

Ask yourself if you can get hold of all those values under any circumstances. The materials certainly aren't a problem, because you define them yourself. "Possible other forces, obstacles etc." - that's where the problem arises. Those forces can combine to any value you can imagine, maybe they can even influence each other - that won't exactly be easy to calculate.
Maybe you don't really want physics to control your AI movement after all?

@ 2) : I once used an A Star algorithm on a grid of points on a heightmap based terrain, which gave acceptable results. It used ray picking to find obstacles between waypoints, and a bit of path smoothing after the path was calculated by A Star. I don't think I still have the code.
You can google a lot of tutorials on A Star (or A*), you'll have to decide yourself which one is most useful to you.

I think i'll throw out those physics as soon as I get my GUI workingâ€¦

SeySayux said:

2) pathfinding using physics to detect if a spatial (NPC) can move to a point

You like pain don't you?

This is impractical to code...and unnecessarily expensive for pathfinding...imho

I really want my AI to work, but I'm no longer using physics  ;). I made my own version of physics that's a lot easier.

physics has nothing to do with the ai. (maybe a little)

Sasa said:

physics has nothing to do with the ai. (maybe a little)

I want my AI to use physics for movement (i.e. the ai controls a physically controlled character). If I cannot say to the ai for sure "Now you've walked that distance", I cannot use physics ;)

if you want to measure a distance just capture the two points in time and calculate the distance between them. but that's not what you want obviously.

If you want to move your character in a some kind of a defined way, just calculate the path and move it along it without doing anything with physics.

And if someone trows a ball at your character then you calculate the balls position with physics and taking character's current position in calculation.

so in the end :

if you want to move things your way - don't use physics

if you want to throw something and let it move itself - use physics.