Ich brauche Hilfe bei meinem Code, ich bin ein Anfänger, der an einem kleinen Projekt arbeitet.using System;
using System.Linq;
using Unity.VisualScripting;
using Unity.VisualScripting.FullSerializer;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.InputSystem.XR;
// This program is used to move the camera to different positions in the scene
public class MoveCamera : MonoBehaviour
{
// This get transform points that the camera will go to
public Transform[] CamsPositions;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
CamsPositions.Append(GameObject.Find("CamPos1").transform);
CamsPositions.Append(GameObject.Find("CamPos2").transform);
// used to find the transform and put them in the array
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
MoveCam(CamsPositions[0]);
}
if (Input.GetKeyDown(KeyCode.A))
{
MoveCam(CamsPositions[1]);
}
}
public void MoveCam(Transform position)
{
transform.position = position.position;
}
}
< /code>
Ich versuche, einen Mechaniker zu machen, der die Kameraposition in der Szene umschaltet. Es funktioniert gut, aber jedes Mal, wenn ich die Schlüssel drücke, erhalte ich einen "Index aus den Grenzen". Ich weiß jedoch nicht warum, also ist jede Hilfe wirklich geschätzt
Ich brauche Hilfe bei meinem Code, ich bin ein Anfänger, der an einem kleinen Projekt arbeitet.using System; using System.Linq; using Unity.VisualScripting; using Unity.VisualScripting.FullSerializer; using UnityEngine; using UnityEngine.Animations; using UnityEngine.InputSystem.XR;
// This program is used to move the camera to different positions in the scene public class MoveCamera : MonoBehaviour { // This get transform points that the camera will go to public Transform[] CamsPositions;
// Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { CamsPositions.Append(GameObject.Find("CamPos1").transform); CamsPositions.Append(GameObject.Find("CamPos2").transform); // used to find the transform and put them in the array }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.E)) { MoveCam(CamsPositions[0]); }
if (Input.GetKeyDown(KeyCode.A)) { MoveCam(CamsPositions[1]); } }
public void MoveCam(Transform position) { transform.position = position.position; } } < /code> Ich versuche, einen Mechaniker zu machen, der die Kameraposition in der Szene umschaltet. Es funktioniert gut, aber jedes Mal, wenn ich die Schlüssel drücke, erhalte ich einen "Index aus den Grenzen". Ich weiß jedoch nicht warum, also ist jede Hilfe wirklich geschätzt
Abstraktion:
Zum Beispiel ist Transformation A übergeordnetes Transformation B. Das Ziel ist es, Transformation A so zu bewegen, dass die Position der Transformation B ist, dass dies alle im lokalen...
Ich habe es mit C# Code zu tun, der mehrere Grafikbilder direkt in einem Windows -Formular unter Verwendung von Drawimage zeichnet. Diese Bilder sind alle Mitglieder eines Arrays und verfügt über...
Ich bin neu in Python und habe einige Probleme über die Übernahme von einem Spefcific -Index zu anderen. Ex: Ich fordere eine Eingabe des Namens von jedem Elternteil des Benutzers an und möchte nur...
Ich habe ein Python -Skript geschrieben, um die DFT einer einfachen Sin -Welle mit Frequenz zu berechnen. 1/sample_rate = 1/15 = ~ 0,07 Sekunde
sample_duration = 1 Sekunde (für Test1) und 2...
Ich habe eine MySQL-Tabelle mit einem einspaltigen Index in der C1-Spalte. Ich muss es durch einen zusammengesetzten Index auf (C1, C2) ersetzen und dann den ursprünglichen Einspalt-Index fallen...