15-03-2021, Saat: 18:56
[attachment=147][attachment=147]Arkadaşlar karakterimin kafasından kameranın baktığı yöne doğru başarılı bir şekilde ray çizdirmiş olmama rağmen (hit.collider.gameobject.name olarak console a bastırarak bunu onayladım) karakterimi hit pointe doğru döndüremiyorum yardımcı olabilcek var mı ?
not:Rigidbody freez rotation ile alakalı değildir
kod:
Physics.Raycast(transform.position+ new Vector3(0,3,0), mainCam.transform.forward, out hit);
transform.rotation =Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(new Vector3(hit.point.x, 0, hit.point.z)),.2f);
Debug.Log(hit.collider.gameObject.name);
Debug.DrawLine(transform.position + new Vector3(0, 3, 0), hit.point);
not:Rigidbody freez rotation ile alakalı değildir
kod:
Physics.Raycast(transform.position+ new Vector3(0,3,0), mainCam.transform.forward, out hit);
transform.rotation =Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(new Vector3(hit.point.x, 0, hit.point.z)),.2f);
Debug.Log(hit.collider.gameObject.name);
Debug.DrawLine(transform.position + new Vector3(0, 3, 0), hit.point);