- Home /
Question by
Michael_R · Dec 08, 2018 at 09:21 PM ·
scripting problemphysicsfps
How To Convert World/Relative Position for Aim Down Sights?
hello, does anyone know how i can convert the world position of the "FPSController" to a relative position of my blue marked object so that i can use it for a lerp animation. I actually already tried it for about 10 hours, sitting on 1 line of code but it still does not work. I think it will takes just another hour until i lose my mind. Maybe someone of you guys can help me ;)
GameObject handAK47 = GameObject.Find("FPSController/FirstPersonCharacter/WeaponHolder/FPS-AK47/FPS-AK47/Game_engine/Bone");
GameObject fpscamera = GameObject.Find("FPSController");
handAK47.transform.localPosition = Vector3.Lerp(handAK47.transform.localPosition, handAK47.transform.InverseTransformPoint(fpscamera.transform.position), Time.deltaTime * adsspeed);
a.png
(18.7 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612183559im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
trouble making a fast projectile 2 Answers
Why are these object passing through each other? 1 Answer
How to stop an rigidbody enemy from jumping when chasing the player? 1 Answer
RigidBody.MovePosition seems jerky in movement 0 Answers
How do I completely turn off/avoid using the physics engine? 2 Answers