If mouse movement exceeds 90 degrees then play animation

I am trying to make it to where when my character is jumping in air and I scroll up to 90 degrees/ pointing at the sky… it detects that I am trying to move the mouse past/over my characters head. Then have it play my backflip animation. Can you think of any easy ways for a beginner like me to get this done.

I was thinking of a ray hitting an invisible plane above me even. If ray touches plane and player is jumping then play animation? I have no idea what I am talking about lol but that was my train of thought. I’m interested in any solution you guys might have.

Your idea should work, and its pretty simple to implement with logic bricks. If you know Python then just use the angle of the camera to detect when its looking up.

pseudo


Z_world = (0,0,1)
Z_cam = camera.worldOrientation.col[2]
radian_angle = Z_cam.dot(Z_world) 
if radian_angle > 0.5:
    #play animation

just place an invisible plane on top of the camera and scale it way down.
put some logic in it so that if mouse is over it, send a message “up”
recieve that message in the player object and movie it up

^This is one of the best solutions/suggestions I’ve ever seen on this forum. Kudos to you Sir!

Thanks guys :slight_smile:

Oh but wait, how do I set this ray sensor up to do this? I’ve never used them.

Figured it out, this post is solved. How do I mark it solved?