1个回答
展开全部
public var target:Transform;
public var moveSpeed=1;
function Start(){
if(!target){
print("not set target!");
var go=GameObject.CreatePrimitive( PrimitiveType.Cube);
target=go.transform;
target.position=Camera.main.transform.TransformPoint(Vector3(0,0,5));
target.rotation=Camera.main.transform.rotation;
}
}
function OnGUI(){
var width=60;
var height=20;
GUI.BeginGroup(Rect((Screen.width-width*2)/2,Screen.height-height*3,width*2,height*3));
var moveDirection=Vector3.zero;
if(GUI.Button(Rect(width/2,0,width,height),"forward")){
moveDirection.z=1;
}
if(GUI.Button(Rect(width/2,height*2,width,height),"back")){
moveDirection.z=-1;
}
if(GUI.Button(Rect(0,height,width,height),"left")){
moveDirection.x=-1;
}
if(GUI.Button(Rect(width,height,width,height),"right")){
moveDirection.x=1;
}
if(target){
moveDirection=moveDirection*moveSpeed;
target.position=target.position+ target.rotation*moveDirection;
}
GUI.EndGroup();
}
public var moveSpeed=1;
function Start(){
if(!target){
print("not set target!");
var go=GameObject.CreatePrimitive( PrimitiveType.Cube);
target=go.transform;
target.position=Camera.main.transform.TransformPoint(Vector3(0,0,5));
target.rotation=Camera.main.transform.rotation;
}
}
function OnGUI(){
var width=60;
var height=20;
GUI.BeginGroup(Rect((Screen.width-width*2)/2,Screen.height-height*3,width*2,height*3));
var moveDirection=Vector3.zero;
if(GUI.Button(Rect(width/2,0,width,height),"forward")){
moveDirection.z=1;
}
if(GUI.Button(Rect(width/2,height*2,width,height),"back")){
moveDirection.z=-1;
}
if(GUI.Button(Rect(0,height,width,height),"left")){
moveDirection.x=-1;
}
if(GUI.Button(Rect(width,height,width,height),"right")){
moveDirection.x=1;
}
if(target){
moveDirection=moveDirection*moveSpeed;
target.position=target.position+ target.rotation*moveDirection;
}
GUI.EndGroup();
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
武义菲亚伏电子有限公司
2023-06-12 广告
2023-06-12 广告
绝缘子控件是指:“一种能够在架空输电线路中起到重要作用的特殊绝缘控件,能够在架空输电线路中起到重要作用。”绝缘子的作用是支持和固定母线与带电导体,并使带电导体间或导体与大地之间有足够的距离和绝缘。绝缘子应具有足够的电气绝缘强度和耐潮湿性能。...
点击进入详情页
本回答由武义菲亚伏电子有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |