Announcement

Collapse
No announcement yet.

How to rotate Actor around non-pivot Location?

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

    How to rotate Actor around non-pivot Location?

    I am building systems for Procedural first person rig movement.

    Procedural idle movement: Continous rotation between +/- target values on each axis of rotation at axis independent rates around some point
    Procedural sway: Leading/Trailing rotation on weapon around some point.

    These rotations must occur around different points. Procedural idle movement occurs around a point between the "shoulders". Procedural sway rotations will occur around the center of gravity of the weapon.

    My question should be a fairly simple one with many solutions. I am curious to hear what methods this can be done in Unreal:

    Will this solution work?
    0.5. Get Vector length (V) from FPSArms Pivot to RotationPoint (Rp)
    1. Set Relative Location of FPSArms to (Rp)
    2,3. Set Relative Rotation of FPSArms to New Rotation (Rn)
    3.5. Get Down Vector from (Rp) * (V) = New Location (Ln)
    4. Set Relative Location of FPSArms to (Ln)

    Picture:
    Click image for larger version

Name:	2016-12-12.png
Views:	1
Size:	7.8 KB
ID:	1203901


    Is there a cleaner way to do this? I have heard about RotateVectorAroundAxis and MatrixRotators but I am not sure how to use those or if they're applicable.

    #2
    You need to do some vector math, ie calculate new location and rotation of actor.

    Calculate relative vector from new center of rotation to actor pivot. Then rotate that vector, and an actor, then move actor to where rotated vector points (relative to new center of location).

    Comment


      #3
      if you are mathematically challenged like myself. I would move and save the axis point to the location you want to rotate off of.

      Comment


        #4
        Originally posted by Nawrot View Post
        You need to do some vector math, ie calculate new location and rotation of actor.

        Calculate relative vector from new center of rotation to actor pivot. Then rotate that vector, and an actor, then move actor to where rotated vector points (relative to new center of location).
        Could you break down the vector math for me a little bit? It's been a very very long time since I studied this stuff. I also don't know which blueprint nodes to use if there are any special ones for the vector math required.

        Do you subtract ActorPivot from NewCenter to get relative vector?

        Comment


          #5
          Originally posted by PropagandaWar View Post
          if you are mathematically challenged like myself. I would move and save the axis point to the location you want to rotate off of.
          lmao...it's been like 10 years since I've messed with any vector math. I can't even remember the basics.

          Comment


            #6
            I didn't even know it existed. I just look at it and go A1 to C1 and somebody goes "You sunk my Battleship"

            In all seriousness though if you have a 3d program move the pivot point to where you want it to rotate and bring it back in. You can do it with unreal "supposedly" but it is a tad wonky. So what I do is bring in a shape like a sphere put it at the point I want to pivot and then in blueprints hide it. From there I child the shape I want to move to the sphere. I would try the 3d program that you may or may not have first though as it would make your life a lot easier. If what I just typed doesn't make sense post a pic I'll grab and photoshop what to do (If I am understanding you correctly)
            Last edited by PropagandaWar; 12-13-2016, 10:41 PM.

            Comment


              #7
              Originally posted by PropagandaWar View Post
              I didn't even know it existed. I just look at it and go A1 to C1 and somebody goes "You sunk my Battleship"

              In all seriousness though if you have a 3d program move the pivot point to where you want it to rotate and bring it back in. You can do it with unreal "supposedly" but it is a tad wonky. So what I do is bring in a shape like a sphere put it at the point I want to pivot and then in blueprints hide it. From there I child the shape I want to move to the sphere. I would try the 3d program that you may or may not have first though as it would make your life a lot easier. If what I just typed doesn't make sense post a pic I'll grab and photoshop what to do (If I am understanding you correctly)
              Easiest way to do this is to parent the FPSArms to a scene component and do the rotation on the scene component. I just want to find a more elegant solution because I want less components to manage/clean up during run time for things such as changing weapons.

              Comment


                #8
                Originally posted by Nawrot View Post
                You need to do some vector math, ie calculate new location and rotation of actor.

                Calculate relative vector from new center of rotation to actor pivot. Then rotate that vector, and an actor, then move actor to where rotated vector points (relative to new center of location).
                Cool...Easy solution. Just had to refresh my memory a bit on basic vector math. Solution below in blueprints for others. Thanks.

                Click image for larger version

Name:	RotateAroundPoint.PNG
Views:	1
Size:	114.6 KB
ID:	1120109

                Comment


                  #9
                  beyond my current skill level.

                  Comment

                  Working...
                  X