How to Aim Offset on Mouse Cursor Position

I’m getting the position of the mouse cursor with a macro named “GetRayAndPlaneIntersection” that basically returns the point that the cursor is on the world, knowing the character and the cursor’s locations we can find out the rotation and apply it to our pawn to make a kind of Aim on Mouse Cursor

Having only the rotation is working wonders for most of the cases, like for any gun’s projectiles that we can spawn them and rotate accordingly as the cursor is more far or close to our char but…

What if we have a skeletal mesh like a bow operated by an animation?

So the player decides how long will the animation draw the bow and this is deciding how far the arrow will go without spawning this arrow on release but applying force to it…

Thus now we need to look the actual aiming of the animation to be able to aim not only on rotation but to aim where the mouse cursor is, making the aim offset aiming on cursor

Any ideas on this ? Will be much appreciated

What if I need to adjust the aim offset anyway on mouse position? For visual purposes only

Really appreciate the prediction approach anyway! Will dig it

What if I need to adjust the aim
offset anyway on mouse position?

Then the prediction would not work great here as it’s somewhat physics driven.

In this case I’d do it manually and draw a 3d curve as the arrow flies using a spline.

  • point 0 is at the player’s position
  • point 2 is at the target (mouse position)
  • point 1 (the curve’s apex) is (p0+p2)/2 + some Z (based on the distance between p0 & p2 perhaps)

And it does not limit you to visual clues only. Since we now have a curving, fully interpolated spline, you can use it to drive a projectile home along that spline, and with 100% accuracy to boot.

I’ll try to dig up an example.

That, my friend, is outstanding, I’m loving it !! How could we link that curve apex to an animation aim offset? Like the char pointing with its finger and arm raised to that direction

So the player decides how long will
the animation draw the bow and this is
deciding how far the arrow will go
without spawning this arrow on release
but applying force to it…

You’ll need more than line-plane intersection for this. Consider looking into this one:

314569-screenshot-2020-09-22-163428.jpg

For example:

Essentially, you feed it direction (find rotation to cursor, for example) and the length of the anim (or how long the draw bow action is held for) sets the force. The prediction node spits out interpolated points and a hit.

It’s been years since I used it but I believe that’s what you’re after here. Hope I did not mix it up.

Do tell how it goes.

How close is this:

Image from Gyazo

Never worked with aim offset. Animation is not my domain. Sorry. Didn’t even know it was a thing up until now. I looked at the docs, I see what it does - no clue how to apply it.

Yes mine neither ! Thank you for this two ways, specially the second that I’m already working out, no worries my friend, thank you kindly