Jump to content
Unity Insider Forum

Spawner zum Kugelschießen


ShV

Recommended Posts

Ich habe folgendes Script geschrieben:

public class Shoot : MonoBehaviour
{
    public Transform Bulletspawn;
    Rigidbody2D clone;
    public Rigidbody2D bulletPrefap;
    public float bulletSpeed = 100f;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Attack()
    {
        clone = Instantiate(bulletPrefap, Bulletspawn.position, Bulletspawn.rotation);
        clone.AddForce(Bulletspawn.transform.right * bulletSpeed);

    }
}

aber die Kugel spawnt nicht an der Stelle, wo sich der Spawner befindet. Woran liegt das?

Link zu diesem Kommentar
Auf anderen Seiten teilen

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Auf dieses Thema antworten...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Lädt...
×
×
  • Neu erstellen...