Point & Click - Top Down Mechanics

I am trying to modify the template mentioned above to make a Diablo-like game.
So far, I’ve added an empty pivot, parented the camera to it and moved the camera component to the pivot. After I did this, I noticed that the target loses reference - after the camera moves - and does not teleport correctly with mouse click.

My bugged project: diablo.7z (109.7 KB)

With this, I intend to implement the following features:

  • Move the pivot over irregular navmeshes
  • Rotate the camera around the pivot
  • Zoom in and out the camera in relation to the pivot

Could someone help me implementing these features? Any help is welcome (no Logic Bricks please).

Thanks in advance.

the first thing you need is to get the mouse position if you made a click -
mouse_over = cont.sensors[‘MouseOverAny’]
mouse_LB = cont.sensors[‘MouseLeftButton’]
if mouse_over.positive and mouse_LB.positive:
pos = mouse_over.hitPosition
the second action is that you either record the finish position and build a path according to the algorithm (And the flow field is old), or if you use a navigation mesh, create a dummy for your unit that is the finish goal and put it in the finish position
target = own.children[‘Empty_Target’]
target.worldPosition = [pos[0], pos[1], pos[2]]
own[‘goal_posX’] = pos[0]
own[''goal_posY] = pos[1]
the x y positions are needed to keep the dummy target in the coordinates where you sent the unit - you check the distance to this dummy -
distFinish = own.getDistanceTo(target)
if distFinish>1.000:
target.worldPosition = [own[‘goal_posX’], own[‘goal_posY’], pos[2]]
#and run somebody algorithm - Astar, flow field path find or navmesh and steering actuator run - steering = cont.actuators[‘Steering’], cont.activate(steering)
movements, rotations and camera approach do not affect the unit if it is moving towards a target whose coordinates are recorded in the properties for which the target is set for the unit