# Basic AI (line-of-sight detecting, geometry detecting, and other stuff)

Hello, I’m new to the whole game development scene, having only done stuff like modeling…

So I got dem questions, namely on how to enable line of sight navigation and detection of other entities.
It’s probably going to be complicated, but I respect that.

Right now I’m in development of a RTS game, but it will have detailed AI and as such they need to be able to function from LOS mechanics.
Soooo… no idea where to start.

other things:

Is using a node to move a spatial instead of moving it by itself while it’s animating a good idea?
How can I propel bullets from the opposite direction of the muzzle? I’ll figure out collision detection, etc.
It a decent idea to create a new weapon entity at the spatials hand and make it it’s child to equip a weapon, having the firing a function of the weapon?

I’m sorry to bug you and thank you for your patience, I’m new to working on things like phsyics and it’s… interesting.

LOS simple ray tests from the eyes of the subject to the shoulders, head and feet of the other players (or whatever). If theres a collision in between you don’t have a line of sight.

For bullets, just don’t throw around physics objects as projectiles. Determine the bullet path and do ray tests on that path while the bullet travels.

@normen said: LOS simple ray tests from the eyes of the subject to the shoulders, head and feet of the other players (or whatever). If theres a collision in between you don't have a line of sight.

For bullets, just don’t throw around physics objects as projectiles. Determine the bullet path and do ray tests on that path while the bullet travels.

Okay, thanks.

Assuming there is a tutorial for ray tests, I’ll get right on this.

Also, getChild() is not working… either version. On a spatial?
Any tips?

A spatial is either a geometry or a node.
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies

@normen said: A spatial is either a geometry or a node.

I’m going to sound really stupid… but how can I then figure out a submesh of the spatial(geometry) if it’s not a node and I can’t use getChild?

xD

@KosduWaya said: I'm going to sound really stupid... but how can I then figure out a submesh of the spatial(geometry) if it's not a node and I can't use getChild?

xD

A geometry has no children.

@normen said: A geometry has no children.

How would you recommend I find a specific part of a mesh?

@KosduWaya said: How would you recommend I find a specific part of a mesh?

What do you mean by find? Its right there.

@normen said: What do you mean by find? Its right there.

I need to child another mesh to it on the fly, and put it in the proper spot.

Is that possible?

@KosduWaya said: I need to child another mesh to it on the fly, and put it in the proper spot.

Is that possible?

A geometry has no children. You could use a batch node to do something like that. But generally it sounds like you are getting ahead of yourself, maybe go through the tutorials first.

@normen said: A geometry has no children. You could use a batch node to do something like that. But generally it sounds like you are getting ahead of yourself, maybe go through the tutorials first.

I guess I am.

I’m pretty much just trying to attach a weapon to a character.

I’ll work on what I know for the time being.

if its a character with a skeleton you’ll want to look up how to use bone attachment nodes.

if it doesnt have a skeleton, you’ll have to make your own node and attach the character and the thing hes holding to the same node, and then move that parent node around as if its the character (and whatever Geometry’s are childed to that node will move with it)

1 Like
@icamefromspace said: if its a character with a skeleton you'll want to look up how to use bone attachment nodes.

if it doesnt have a skeleton, you’ll have to make your own node and attach the character and the thing hes holding to the same node, and then move that parent node around as if its the character (and whatever Geometry’s are childed to that node will move with it)

The first one did it for me, thank you very much!

Unto the next problem…