Announcement

Collapse
No announcement yet.

Directional blocking with AimOffset - Problem with left and right blocking

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Directional blocking with AimOffset - Problem with left and right blocking

    So I'm trying to make a directional blocking system. And I've made a Aim Offset with all the animations for Up Down, Left and Right blocking. Now I'm trying to find out how to get the axis value for the Left and Right blocking. Up and Down blocking I got working, but the problem with Left and Right is that I got "Use Controller Rotation Yaw" enabled in playercharacter. This is required for the basic movement control scheme to work as I want. If I disable "Use Controller Rotation Yaw" the directional blocking works as intented, but my character doesn't rotate with the camera yaw.

    Here's some of my code:

    Click image for larger version

Name:	YawProblem1.png
Views:	83
Size:	225.3 KB
ID:	1617633

    As you can see in the code I get the delta rotation between control rotation and Actor Rotation of my character. Since "Use Controller Rotation Pitch" is disabled in playercharacter, it nicely gives me the delta movement of my camera, so the Upper block and Down Block are working correctly.

    But with the Yaw, since I have "Use Controller Roation Yaw" enabled, the character control rotation and actor rotation zero eachother out in the delta rotator. Because the character is moving together with the controller rotation.

    How can I solve this problem? I need to somehow detect the movement of the camera in the last frames and get the delta so it gives me a negative to a positive value of the last cemera movement for the AimOffset Axis

    Any ideas are most appreciated! Thanks in advance!
    Creative Director at Rebel Camp Games

    http://www.rebelcampgames.com
    http://www.forestsofaugusta.com
    http://www.emberheartgame.com

    #2
    Originally posted by Rebel Camp Games View Post
    How can I solve this problem? I need to somehow detect the movement of the camera in the last frames and get the delta so it gives me a negative to a positive value of the last cemera movement for the AimOffset Axis
    well just store the yaw each frame so next frame you compare it with the previous frame to get the delta. it's the same principle used by character Turn In Place logic which is covered in several tutorials including a stream/talk from Epic


    btw you're probably going to face a related issue which will be perceived as a "precision issue". imagine the player makes a long horizontal mouse movement and then in the very last frame the player moves the mouse up just very slightly but not sideways anymore. a basic frame delta-based system will determine that the player moved the mouse up due to this last-frame slight only-up movement despite having made a very long horizontal move.
    naturally the way to go would be to accumulate the delta of several frames. but then what happens if the player intentionally wants a last-second change to the attack direction after having done a longer mouse movement? things get tricky.
    for this reason in my game (which features directional combat like you are describing) I made a more complex horizontal and vertical accumulation of various frames where the horizontal and vertical deltas decay over time. even then it takes some refinement to determine the right values until it feels like the game is doing what the player wants
    Follow me on Twitter!
    Developer of Elium - Prison Escape
    Local Image-Based Lighting for UE4

    Comment


      #3
      Thanks, I think i got it working more or less
      Creative Director at Rebel Camp Games

      http://www.rebelcampgames.com
      http://www.forestsofaugusta.com
      http://www.emberheartgame.com

      Comment

      Working...
      X