Topic: Move 3dMarker depending on camera look
Hi,
Frankly to say, I am new in Unity3d (hovewer skilled in C#).
I have a 3dmap with buildings etc. I placed a 3dmarker (which is basicly a default unity3d thirdPersonController).
I have the script to control my 3dMarker:
private void FixedUpdate()
{
OnlineMaps api = OnlineMaps.instance;
float h = CrossPlatformInputManager.GetAxis("Horizontal");
float v = CrossPlatformInputManager.GetAxis("Vertical");
m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized;
var position = v * m_CamForward + h * m_Cam.right;
if (position.magnitude > 1f) position.Normalize();
//probably I need to do something here to change h and v depending on the camera angle
px += h / 100000;
py += v / 100000;
api.SetPosition(px, py);
}So right now my player move in 4 directions. However, if I try to change camera look (with mouse right click), I want my character move forward concidering new "north".
Could you please give a clue how to do this? Thank you.