Announcement

Collapse
No announcement yet.

relative and world position question

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

    relative and world position question

    Hello,

    i just want to know which script does it takes to get for example the position of my camera and using lerp to move my hand to my camera?


    #2
    Actor->ActorToWorld() function converts local transform to world space where you can get "real" position from it.
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #3
      I thought about a script like this one to get the relative camera position of my relative hand coordinate system (Aim Down Sights Idea):
      FVector relativeLoc = GetTransform().InverseTransformPosition(GetTransform().TransformPosition(ComponentA));

      unfortunately i still was only able to try it in ue4. Also a similar script in unity doesnt worked.

      unity script (with lerp):
      transform.localPosition = Vector3.Lerp(transform.localPosition, transform.InverseTransformPoint(Camera.current.transform.position), Time.deltaTime * adsspeed);

      Maybe the script doesnt know which coordinate system is meant.

      ps. sorry for my bed england

      Comment

      Working...
      X