Announcement

Collapse
No announcement yet.

Movement constraints with pivot point

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

    Movement constraints with pivot point

    Hello, i have a simple question, im going to post a picture to better explain what i want to do as well

    I want my character to have the movement ( the strafe ) always rotate towards a center point that i can always change

    I understand the basics of things in ue4 and i have searched for this but i think im using the wrong keywords.this has probably been answered, if you know of any link in the wiki i can look att or any tutorial that explains it , it would be warmly apprechiated.

    Click image for larger version

Name:	682e8a203a4793378b03e559a707cce4.png
Views:	1
Size:	37.4 KB
ID:	1170433

    #2
    I was thinking of doing this by creating a custom actor that acts as the pivot point, and make my character use Look att rotation constantly att the target with a event tick.
    is there a better way to do this ?

    Comment


      #3
      Use vector math for it. You need to calculate vector for pawn to move:
      - calculate vector from center point to player position.
      - now the tricky part. >ROTATE< that calculated vector depending on input from controller. Best here would be "rotate vector around axis" node for vector to rotate get "UP vector" of pawn, or simply [0,0,1] if you have it on flat surface.
      - calculate new "desired" position for pawn (that rotated vector value)
      - now calculate vector from current position of pawn to "desired" position.
      - normalize it, multiply by axis input and then some scale
      - you have your strafing vector.

      Edit:
      "by rotate that vector depending on input" i mean rotate for eg by 15 degrees, left or right, direction should be depending or strafe axis value. Always rotate by same number of degrees, this will make your circle a circle, if you rotate too far your pawn may start doing spirals etc.
      Last edited by Nawrot; 01-18-2016, 06:49 AM.

      Comment

      Working...
      X