I thought about a script to get the relative fpscamera position into my hand coordinate system. The Idea is to move the hand right into the center of my fpscamera (my Aim Down Sights Idea): script (lerp included): Code (CSharp): Code (CSharp): GameObject handAK47 = GameObject.Find("FPSController/FirstPersonCharacter/WeaponHolder/M4 Garand Holder/FPS-AK47/Game_engine/Bone/AK-47"); GameObject fpscamera = GameObject.Find("FPSController/FirstPersonCharacter"); transform.localPosition = Vector3.Lerp(handAK47.transform.localPosition, handAK47.transform.InverseTransformPoint(fpscamera.transform.position), Time.deltaTime * adsspeed); ... maybe someone of you guys know what I am doing wrong
Do you mean like this: Code (CSharp): transform.position = Vector3.Lerp(handAK47.transform.position, handAK47.transform.InverseTransformPoint(fpscamera.transform.position), Time.deltaTime * adsspeed);
The object this script in on is the AK i assume? Code (CSharp): transform.position = Vector3.Lerp(handAK47.transform.position, fpscamera.transform.position, Time.deltaTime * adsspeed); btw, just a side note, that's not the best way to use lerp.
Still doesn't work. My hierarchy looks like this. Could you pls check if my GameObject.Find commands are wrong? Code (CSharp): GameObject handAK47 = GameObject.Find("FPSController/FirstPersonCharacter/WeaponHolder/M4 Garand Holder/FPS-AK47/Game_engine/Bone/AK-47"); GameObject fpscamera = GameObject.Find("FPSController/FirstPersonCharacter");