Download

How to apply force in random direction to cursor?

I have a circle I want the player to hold the cursor in for a certain time, but I want to apply random force to the cursor in different directions to make it hard to keep the cursor in the circle. Any ideas how to go about this?

I’m not sure there is any way to move the mouse cursor itself in blueprint. Are you using the standard cursor or are you drawing a custom mouse cursor at cursor location? If the latter then I guess you could jitter where you draw the image, and detect if it ends up going out of your bounds. But underneath the real cursor wouldn’t be moved except by the player.

Not sure if that makes sense?

Hmm, yea that makes sense. I’m primarily looking using a gamepad, would that give me any more options? Like will I somehow have to build my own cursor system for the gamepad? I see you responded to my other question about using a gamepad to control a cursor. I think Destiny is a good example of what I’m envisioning. I would like to use that system for my menus, but also for this. I’ve included a screenshot of what it looks like:

Screen Shot 2015-07-16 at 2.59.08 PM.png

Off the top of my head what I would do is not even use a mouse or cursor at all.

Instead set up axis bindings for the mouse and gamepad stick that fire an event, and in that event draw a widget at a 2d location on screen, and then affect that widget. Make the center of the circle the 0,0 point and then move the image based on axis value plus your random forces. In turn the player will move the input to account for the random values, loop, etc.

Brilliant. I’ve got the new widget spawning, but I’m not sure how to control it with my gamepad. I’m guessing once I figure that out, applying random force will be a matter of floats and such

I assumed you could, but I will be honest I didn’t actually look. If you can’t affect a widget like that you could of course do the same with just any 2d image or even 3d or whatever you want to do. The concept is of course the same. I just assumed since you have some form of HUD there, that you would add to it.

So this is what i’m trying at its currently not working. Still fiddling and googling, but any assistance would be great! Its coming in from event tick because I figured the location would need to update every tick to have a smooth cursor location.

Screen Shot 2015-07-17 at 12.28.07 PM.png