Announcement

Collapse
No announcement yet.

Getting aim with Roll - rolling/rotating 2-handed weapon

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

    Getting aim with Roll - rolling/rotating 2-handed weapon

    Yet another one of these questions...

    SIMPLE VERSION OF THE QUESTION --
    How do I get a mesh to LookAt 1 point for pitch and yaw, but roll should be "looking" towards a different point? so - forward and right vectors set via one point in space.... up vector set by another.



    MORE DETAILED VERSION OF THE QUESTION ------

    This MAY be a VR specific problem, but I think the solution is just a math / geometry one. Not sure.

    I've got an actor (a gun) held in one hand (attached to a motion controller).

    I have the mesh then aiming at the second, forward hand, to control pitch and yaw.

    You know... basically, you're holding the gun with two hands.... like so many of us playing with VR want to do...

    The issue I'm having is that the way the motion controllers are tracked, there's no way to get RELATIVE roll - it's all in world space.

    Which means that, while I can rotate the mesh along the Y and Z axis' ok, the roll rotation gets really funky at extreme angles like pointing straight up.

    I have an image attached - the yellow arrow is aiming always at the desired Up direction for the gun (it's pointing from the handle to a spot at the top of the wrist, always "above" the wrist in its relative space). So I can see the desired rotation!

    But I don't know how to get the mesh to ROLL only in the direction of that LookAt spot.

    Typically with 2-handed VR weapons, I could use something like this https://www.youtube.com/watch?v=wxKYgJmc5a8

    However, because of the way I'm connecting the Animation Blueprint, and getting the mesh to "attach" to the hands, it's not possible to use the same approach. (Also because I'm using a mixed attach with physical collisions on the weapons)


    I've looked at VR extension but I'm customizing so much that it's a pain to dig into that really crazy (though awesome) script. And I can't really use any of the plugins from the marketplace because they're not using the same collision system (ala Jonas Molgaard).

    Suggestions? Probably just an easy geometry solution, but I have exhausted Google with tests!

    #2
    After probably 20 hours of various failures, I found a solution to this problem.

    It's a COMPLETELY RIDICULOUS solution of calculating all 3 vectors individually (one of them twice), then using Make Rotation From Axes to get the world rotation for the gun.

    If anyone else doing VR runs into this issue, I can explain it to you.

    Comment

    Working...
    X