Hello! So I have a bit of a problem… basically, I have an “AI” (very very rudimentary but still working) which constantly moves towards the player! Here’s the code for it, by the way:
[java]
Vector3f offset = cam.getLocation().subtract(AI.getWorldTranslation());
Vector3f direction = offset.normalize();
AI_phys.setPhysicsLocation(offset.divide(1000).add(AI_phys.getPhysicsLocation()));
//AI is a spatial imported with the import tool…
[/java]
Now, this work great, and the AI moves slowly (hence the 1000 dividing) towards the player since this is in the update loop (well, not the creation of new vectors each frame, that’s just to make it clear).
However, here’s the catch: The physics body of the AI simply ignores all other physics, and passes through walls. Now, this also happens if I set the physics to be kinematic and spatial.move(…) instead, so it’s not just because of the moving of the physics. I kind of expect this behavior if I literally just force it to move forward, but is there any neat way to solve this problem? Charactercontrol, perhaps, and setting walkdirection? I tried it at first but got a bit stuck, so any help is appreciated! Thanks!