Download

ZOOM on location, where mouse is pointing using mouse wheel

Hello all,

I am new to UE4 and to programming, game development in general, as a way to learn UE4 I am creating a really simple RPG, following tutorials etc.
Now I am stuck at camera ZOOM function for a week and finally I am asking for some help! :slight_smile:

I am trying to ZOOM on location, where mouse is pointing using mouse wheel - mouse is pointed at random location on map and player camera ZOOMs/moves to it’s location. I want it to be smooth, similar to how it happens in Supreme Commander. ZOOM function it self is 100% fine, problem is with how actor moves to location mouse is pointing at.
I have created 2x solutions for the problem, but they are still not working properly:
1)Solution one is copied from this forum. In general it works just fine, problem is it instantly jumps camera to mouse location. This is an issue if point is far, because visually it’s distracting and scrolling more than once moves you around chaotically.
a)How can I make actor move towards mouse location gradually (NOT jump instantly) modifying this blueprint.
b)Can someone please explain to me how “World Location” and “World Direction” works, I know both of those are vectors with X;Y:Z values, but what’s the difference, what values they are based on, and how “World Direction” part of this blueprint works (as mentioned before, copied it, tried to figure it out unsucessfully).
c)How to eliminate camera position offset from actor if using “ConverMouseLocationToWorldSpace” - in all other configurations of this blueprint, “X” axis movement is broken, because camera is almost always under an angle, as a result actor always moves towards camera, but if I view it at 0 angle, it moves where mouse is pointing.

 2)Second solution is modified camera edge movement blueprint. Camera position offset from actor is not a problem here. Problem is actor seems to move only in 0; 45; 90; 135; 180; 225; 270; 315 degree angles when moving to mouse location. This creates quite stupid paths, when actor travels with 0 degree direction and then suddenly changes to 90 to get to mouse location.
      a)How to fix problem with actor moving only in 0; 45; 90; 135; 180; 225; 270; 315 degree angles
      b)Is there a way to fixate mouse pointers location on map, when actor moves towards it, otherwise it jumps around and it has to be rearranged to desired location all the time.

I know it’s a lot of questions!:slight_smile:
Thanks in advance!

Best regards,
Lidzsvars

Camera Component -> Set Field of View. Use a timeline w/ interpto for smooth transition.