Question by
soutelit · Jan 16, 2018 at 02:27 PM ·
vector3transform.position
I want my props to be in front of my camera even when my camera is rotating ,How to set a GameObject's position in front of a FPSController
Hello ! First af all sorry if my english is a bit lame it's not my mother tongue.
Her is my problem. i'm making a little FPS game and i want my FPS controller to be able to hold some props (a bit like in skyrim when you move a corps).
I got a code that work a bit but i still have some issues :
void Update()
{
if (Input.GetKey(KeyCode.F) && m_triggered)
{
this.transform.position = new Vector3(m_PlayerTransform.position.x, m_PlayerTransform.position.y, m_PlayerTransform.position.z + 2f);
}
}
it hold my props but i can't make it follow my fpscontroller's rotation. I want to have it in front of the FPScontroller's camera.
Comment