by Anonymous » 03 Apr 2025, 02:16
Ich möchte die Kamera positionieren und dem Flugzeug daneben folgen. < /p>
Die Kamera befindet sich vor dem Flugzeug und folgt nicht.
Code: Select all
public class FollowPlayerX : MonoBehaviour
{
public GameObject plane;
private Vector3 offset = new Vector3(30,0,10);
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.position = plane.transform.position + offset;
transform.rotation = plane.transform.rotation;
plane.transform.rotation = Quaternion.Euler(new Vector3(0,0,-90));
}
}
[url=viewtopic.php?t=14917]Ich möchte[/url] die Kamera positionieren und dem Flugzeug daneben folgen. < /p>
Die Kamera befindet sich vor dem Flugzeug und folgt nicht.[code]public class FollowPlayerX : MonoBehaviour
{
public GameObject plane;
private Vector3 offset = new Vector3(30,0,10);
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.position = plane.transform.position + offset;
transform.rotation = plane.transform.rotation;
plane.transform.rotation = Quaternion.Euler(new Vector3(0,0,-90));
}
}
[/code]