Здравствуйте!
есть сфера большая как планетка и человечек из ассетов "Supercyan Character Pack Free Sample"
отключаю стандартную гравитацию и freeze rotation.
Добавляю:
Скрытый текст: показать
public GameObject centr; Vector3 heading; Vector3 direction; float distance; public Rigidbody rigid; void Update() { heading = centr.transform.position - this.transform.position; distance = heading.magnitude; direction = heading / distance; rigid.AddForce(direction * 1f); }
Получили "притяжение к сфере" - работает
Теперь надо чтобы человечек стоял ногами на сфере.
Скрытый текст: показать
transform.rotation = Quaternion.LookRotation(direction);
- работает криво
но надо чтобы человечек еще и ходил
в коде скипта движения
Скрытый текст: показать
float v = Input.GetAxis("Vertical"); float h = Input.GetAxis("Horizontal"); m_currentV = Mathf.Lerp(m_currentV, v, Time.deltaTime * m_interpolation); m_currentH = Mathf.Lerp(m_currentH, h, Time.deltaTime * m_interpolation); transform.position += transform.forward * m_currentV * m_moveSpeed * Time.deltaTime; transform.Rotate(0, m_currentH * m_turnSpeed * Time.deltaTime, 0);
работает только вперед назад.
---------
может ктото поможет?