hi,
I am making a game in which you are in a bunker - position (0,0,0) and enemies are attacking you. their position is random - of course limited so they can apper randomly within certain area.
I need them to to turn so they are facing the bunker ( how they find out which angle is right ?) and then they begin to move in right direction to bunker.
I have always found the NodePath’s lookAt() function to be extremely helpful. You can pass in a point in space, or another nodepath as the argument, and it will turn to face that point or other nodepath.
first = render.attachNewNode("first")
second = render.attachNewNode("second")
second.setPos(20,30,75)
first.lookAt(second)