Domanda

Credo che sto cominciando a come questa roba codifica. Comunque nella mia ripresa attuale progetto Galleria Ho una domanda JavaScript. Sto costruendo in Unity3d e ho ottenere un "trasformare" non è un utente di errore "oggetto" sul codice inserito qui sotto.

var newball;
static var tempBasketBall :Rigidbody;
private var canFire = true;
var pos :Transform[];
var ball1 :Rigidbody;
var canControl1 = true;
var destroyTime :int = 6;
var player1 :GameObject;
var b1Parent :Transform;

var yVel :float;
var zVel :float;

function Start()
{
    ball1 = Instantiate (tempBasketBall, pos[0].position, pos[0].rotation);
    ball1.transform.parent = b1Parent;
}

function Update() { 
    if(Input.GetButton("Fire1"))
        animation.PlayQueued("fire", QueueMode.PlayNow);   
}

function TapFunction() {
    animation.PlayQueued("fire", QueueMode.PlayNow);
    player1.animation.PlayQueued("fire");
    ball1.transform.parent = null;
    ball1.useGravity = true;
    ball1.velocity = transform.TransformDirection(0, yVel, zVel);
    MakeBall1(pos[0]);
    canControl1 = false;
    player1.animation.PlayQueued("idle");
}

function MakeBall1(pos)
{
    yield new WaitForSeconds(1);
    ball1 = Instantiate(tempBasketBall, pos.transform.position, pos.transform.rotation);
    ball1.transform.parent = b1Parent;
    canControl1 = true;
}

L'errore è nella funzione MakeBall alla fine. A mio avviso non addestrato, a quanto pare ho stabilito il trasformare in funzione di avvio. Come al solito alcuna assistenza e conoscenze condivise saranno enormemente apprezzate.

È stato utile?

Soluzione

Trasforma (si passa come argomento un oggetto di questo tipo) non dispone di un "trasformare" membro, è necessario utilizzare pos.position

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top