Download

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?

Actor->ActorToWorld() function converts local transform to world space where you can get “real” position from it.

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