题
我想我开始喜欢这种编码的东西。无论如何,在我目前的拍摄画廊项目中,我有一个JavaScript问题。我正在以Unity3D的形式进行构建,并且我得到的“转换”不是下面插入的代码上的“对象”错误的成员。
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;
}
该错误在末尾的makeball函数中。在我未经训练的情况下,我似乎在开始功能中建立了转换。像往常一样,任何协助和共同的知识都将受到极大的赞赏。
解决方案
转换(您正在作为参数作为此tipe的参数)没有“转换”成员,您应该使用pos.position
不隶属于 StackOverflow