【发布时间】:2014-07-05 06:22:25
【问题描述】:
我正在制作一个游戏,其中一个球落在一个平面上,一个球落在另一个球上,它们形成一条从下到上的线。我希望球在 y 轴上的某个点停止下落。不知道怎么做,直到现在我用来让球掉下来的代码是:
function calling(){
functionsRandom.Range(0, functions.Length);
}
function sphereA() {
var go = Instantiate(sphere,new Vector3(Random.Range(-3, 3),Random.Range(-3,3),-12.78451),Quaternion.identity);
go.renderer.material.color = Color(Random.value, Random.value, Random.value);
}
function sphereB() {
var go = Instantiate(sphere1,new Vector3(Random.Range(-3, 3),Random.Range(-3,3),-12.78451),Quaternion.identity);
go.renderer.material.color = Color(Random.value, Random.value, Random.value);
}
我使用了 random.range,所以球从 x 和 y 两者之间的点落下,对于 x 它可以工作,但它对 y 不起作用。
【问题讨论】:
-
这段代码中的什么让你的球体坠落?你在用
RigidBody物理吗? -
是的球体掉落,我正在使用刚体物理。
标签: unity3d unityscript