Announcement

Collapse
No announcement yet.

Is there any function to rotate one point around another point by angle?

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

    Is there any function to rotate one point around another point by angle?

    I found a arithmetic formula on forum:
    If you rotate point (px, py) around point (ox, oy) by angle theta you'll get:

    Code:
    p'x = cos(theta) * (px-ox) - sin(theta) * (py-oy) + ox
    p'y = sin(theta) * (px-ox) + cos(theta) * (py-oy) + oy
    this is an easy way to rotate a point in 2D.
    Is there any function packaged with similar formula in UE4 to rotate FVector A around FVector B by FRotator C?
    Last edited by dawnarc; 06-08-2016, 07:34 AM.

    #2
    B+C.RotateVector(B-A)

    B-A - get Vector A in B local space
    C.RotateVector(..) rotate it around
    B+.. - get world space location
    Last edited by RxDesu; 06-08-2016, 08:33 AM.

    Comment


      #3
      Originally posted by RxDesu View Post
      B+C.RotateVector(B-A)

      B-A - get Vector A in B local space
      C.RotateVector(..) rotate it around
      B+.. - get world space location
      that works! thx so much for help! B+C.RotateVector(A-B) would be better.
      have a nice day~
      Last edited by dawnarc; 07-06-2016, 04:57 AM.

      Comment


        #4
        Originally posted by DawnArc View Post
        that works! thx so much for help! have a nice day~
        My entire game is based around angles in 2d and 3d space. Let me know if anything else comes up.
        Tek LLC a personal Candaian Company running BlenderTek & UnrealTek is currently looking for help to bring back submarine simulator gaming with a new genre of sub sims: Cold War! (1945-1991) Operation: Trident SubSim Dev Diary Thread - Donations

        Comment


          #5
          Originally posted by Nsomnia View Post
          My entire game is based around angles in 2d and 3d space. Let me know if anything else comes up.
          that' great! thx so much!

          Comment


            #6
            Just use func RotateVectorAroundAxis

            Comment

            Working...
            X