亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

Unity3D 學習教程 12 C# 發射炮彈

2019-11-17 02:39:13
字體:
來源:轉載
供稿:網友

Unity3D 學習教程 12 C# 發射炮彈

建立一個炮彈

一個球體

雙擊腳本

進入編輯器

 1 using UnityEngine; 2 using System.Collections; 3  4 public class acc : MonoBehaviour { 5  6     // Use this for initialization 7     public Transform Q; 8     int speed=50; 9     void Start () {10 11     }12     13     // Update is called once per frame14     void Update () {15         float x = Input.GetAxis("Horizontal") * Time.deltaTime * speed;//左右移動16         float z = Input.GetAxis("Vertical") * Time.deltaTime * speed;//    前后移動17         //主攝像機物體    移動18         transform.Translate(x,0,z);19 20         if(Input.GetKeyDown(KeyCode.Mouse0))21         {22             Transform n = (Transform)Instantiate(Q,transform.position,transform.rotation);23             Vector3 f = transform.TransformDirection(Vector3.forward);24             n.rigidbody.AddForce(f*2000);25         }26 27         

public Transform Q;

建立一個炮彈 Q

Transform

Transform 變換

Inherits from Component,IEnumerable

Position, rotation and scale of an object.

物體的位置、旋轉和縮放。

Every object in a scene has a Transform. It's used to store and manipulate the position, rotation and scale of the object. Every Transform can have a parent, which allows you to apply position, rotation and scale hierarchically. This is the hierarchy seen in the Hierarchy pane. They also support enumerators so you can loop through children using:

場景中的每一個物體都有一個Transform。用于儲存并操控物體的位置、旋轉和縮放。每一個Transform可以有一個父級,允許你分層次應用位置、旋轉和縮放。可以在Hierarchy面板查看層次關系。他們也支持計數器(enumerator),因此你可以使用循環遍歷子物體。

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public void Awake() {foreach (Transform child in transform) {child.position += Vector3.up * 10.0F;}}}
// Moves all transform children 10 units upwards!//向上移動所有變換的子物體10個單位for (var child : Transform in transform) {child.position += Vector3.up * 10.0;}

參見:Physics 類.

Variables變量

  • positionThe position of the transform in world space. 在世界空間坐標transform的位置。
  • localPositionPosition of the transform relative to the parent transform. 相對于父級的變換的位置。
  • eulerAnglesThe rotation as Euler angles in degrees. 旋轉作為歐拉角度。
  • localEulerAnglesThe rotation as Euler angles in degrees relative to the parent transform's rotation. 旋轉作為歐拉角度,相對于父級的變換旋轉角度。
  • rightThe red axis of the transform in world space. 在世界空間坐標變換的紅色軸。也就是x軸。
  • upThe green axis of the transform in world space. 在世界空間坐標變換的綠色軸。也就是y軸。
  • forwardThe blue axis of the transform in world space. 在世界空間坐標變換的藍色軸。也就是z軸。
  • rotationThe rotation of the transform in world space stored as a Quaternion. 在世界空間坐標物體變換的旋轉角度作為Quaternion儲存。
  • localRotationThe rotation of the transform relative to the parent transform's rotation. 物體變換的旋轉角度相對于父級的物體變換的旋轉角度。
  • localScaleThe scale of the transform relative to the parent. 相對于父級物體變換的縮放。
  • parentThe parent of the transform. 物體變換的父級。
  • worldToLocalMatrixMatrix that transforms a point from world space into local space (Read Only). 矩陣變換的點從世界坐標轉為自身坐標(只讀)。
  • localToWorldMatrixMatrix that transforms a point from local space into world space (Read Only). 矩陣變換的點從自身坐標轉為世界坐標(只讀)。
  • rootReturns the topmost transform in the hierarchy. 返回層次最高的變換。
  • childCountThe number of children the Transform has. 變換的子物體數量。
  • lossyScaleThe global scale of the object (Read Only). 物體的全局縮放(只讀)。

Functions函數

  • TranslateMoves the transform in the direction and distance of translation. 移動transform在translation的方向和距離。
  • RotateApplies a rotation of eulerAngles.z degrees around the z axis, eulerAngles.x degrees around the x axis, and eulerAngles.y degrees around the y axis (in that order). 應用一個歐拉角的旋轉角度,eulerAngles.z度圍繞z軸,eulerAngles.x度圍繞x軸,eulerAngles.y度圍繞y軸(這樣的順序)。
  • RotateAroundRotates the transform about axis passing through point in world coordinates by angle degrees. 按照angle度通過在世界坐標的point軸旋轉物體。
  • LookAtRotates the transform so the forward vector points at /target/'s current position. 旋轉物體,這樣向前向量指向target的當前位置。
  • TransformDirectionTransforms direction from local space to world space. 從自身坐標到世界坐標變換方向。
  • InverseTransformDirectionTransforms a direction from world space to local space. The opposite of Transform.TransformDirection. 變換方向從世界坐標到自身坐標。和Transform.TransformDirection相反。
  • TransformPointTransforms position from local space to world space. 變換位置從自身坐標到世界坐標。
  • InverseTransformPointTransforms position from world space to local space. The opposite of Transform.TransformPoint. 變換位置從世界坐標到自身坐標。和Transform.TransformPoint相反。
  • DetachChildrenUnparents all children. 所有子物體解除父子關系。
  • FindFinds a child by name and returns it. 通過名字查找子物體并返回它。
  • IsChildOfIs this transform a child of parent? 這個變換是父級的子物體?

Inherited members繼承成員

Inherited Variables繼承變量

  • transformThe Transform attached to this GameObject (null if there is none attached). Transform附加到GameObject(游戲物體)(如無附加則為空)。
  • rigidbodyThe Rigidbody attached to this GameObject (null if there is none attached). Rigidbody附加到GameObject(游戲物體)(如無附加則為空)。
  • cameraThe Camera attached to this GameObject (null if there is none attached). Camera附加到GameObject(游戲物體)(如無附加則為空)。
  • lightThe Light attached to this GameObject (null if there is none attached). Light附加到GameObject(游戲物體)(如無附加則為空)。
  • animationThe Animation attached to this GameObject (null if there is none attached). Animation附加到GameObject(游戲物體)(如無附加則為空)。
  • constantForceThe ConstantForce attached to this GameObject (null if there is none attached). ConstantForce附加到GameObject(游戲物體)(如無附加則為空)。
  • rendererThe Renderer attached to this GameObject (null if there is none attached). Renderer附加到GameObject(游戲物體)(如無附加則為空)。
  • audioThe AudioSource attached to this GameObject (null if there is none attached). AudioSource附加到GameObject(游戲物體)(如無附加則為空)。
  • guiTextThe GUIText attached to this GameObject (null if there is none attached). GUIText附加到GameObject(游戲物體)(如無附加則為空)。
  • networkViewThe NetworkView attached to this GameObject (Read Only). (null if there is none attached) NetworkView附加到GameObject(游戲物體)(只讀)(如無附加則為空)。
  • guiTextureThe GUITexture attached to this GameObject (Read Only). (null if there is none attached) GUITexture附加到GameObject(游戲物體)(只讀)(如無附加則為空)。
  • colliderThe Collider attached to this GameObject (null if there is none attached). Collider附加到GameObject(游戲物體)(如無附加則為空)。
  • hingeJointThe HingeJoint attached to this GameObject (null if there is none attached). HingeJoint附加到GameObject(游戲物體)(如無附加則為空)。
  • particleEmitterThe ParticleEmitter attached to this GameObject (null if there is none attached). ParticleEmitter附加到GameObject(游戲物體)(如無附加則為空)。
  • gameObjectThe game object this component is attached to. A component is always attached to a game object. 組件附加的游戲物體。一個組件總是被附加到一個游戲物體。
  • tagThe tag of this game object. 游戲物體的標簽。
  • nameThe name of the object. //物體的名字
  • hideFlagsShould the object be hidden, saved with the scene or modifiable by the user? 物體是否被隱藏、保存在場景中或被用戶修改?

Inherited Functions繼承函數

  • GetComponentReturns the component of Type type if the game object has one attached, null if it doesn't. 如果游戲物體有一個附加,則返回Type類型的組件,如果沒有則為null。
  • GetComponent.<T>
  • GetComponentReturns the component with name type if the game object has one attached, null if it doesn't. 如果游戲物體有一個附加,則返回名字類型組件,如果沒有則為null。
  • GetComponentInChildrenReturns the component of Type type in the GameObject or any of its children using depth first search. 返回Type類型組件,在GameObject或它的任何子物體使用深度優先搜索,僅返回激活的組件。
  • GetComponentInChildren.<T>
  • GetComponentsInChildrenReturns all com
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
国产精品久久久久久五月尺| 精品调教chinesegay| 亚洲xxx视频| 国产精品福利观看| 久久久久久久一区二区| 色综合久久88色综合天天看泰| 欧美一乱一性一交一视频| 亚洲视频在线观看| 国内精品久久久久久久久| 91久久在线观看| 久久国内精品一国内精品| 青青草国产精品一区二区| 亚洲日本aⅴ片在线观看香蕉| 久久久久99精品久久久久| 亚洲最大福利网站| 国产精品久久久久久中文字| 日本一区二三区好的精华液| 国产精品视频白浆免费视频| 国外成人在线播放| 欧美激情综合色| 国产福利精品视频| 欧美日韩国产一区在线| 国产精品扒开腿做爽爽爽的视频| 伊人久久男人天堂| 亚洲欧洲在线视频| 国产精品6699| 麻豆国产精品va在线观看不卡| 中文字幕在线看视频国产欧美| 欧美日韩国产精品一区二区三区四区| 国产精欧美一区二区三区| 中文字幕日韩高清| 欧美成人午夜剧场免费观看| 国产一区二区动漫| 亚洲黄页网在线观看| 欧美久久精品午夜青青大伊人| 91成人国产在线观看| 情事1991在线| 黑丝美女久久久| 日韩精品极品在线观看播放免费视频| 国产精品1区2区在线观看| 国产精品久久91| 亚洲精品国产精品自产a区红杏吧| 欧美日韩ab片| 欧美三级欧美成人高清www| 日韩av免费在线播放| 97精品久久久中文字幕免费| 97久久伊人激情网| 久久久精品2019中文字幕神马| 亚洲综合日韩在线| 久久婷婷国产麻豆91天堂| 成人国产精品色哟哟| 欧美成年人视频网站| 欧美老女人性生活| 久久精品在线视频| 免费91麻豆精品国产自产在线观看| 成人妇女免费播放久久久| 久久综合久久美利坚合众国| 亚洲影院高清在线| 色噜噜狠狠色综合网图区| 久久久久久久久久久久av| 国产一区二区免费| 91av视频在线播放| 亚洲精品在线观看www| 国产99久久精品一区二区 夜夜躁日日躁| 亚洲高清久久网| 日韩中文字幕精品视频| 亚洲成人黄色网| 久久人91精品久久久久久不卡| 国产成人免费av| 欧美日韩在线免费| 欧美一区二区影院| 国产97色在线|日韩| 久久理论片午夜琪琪电影网| 亚洲图片在线综合| 在线免费看av不卡| 懂色av影视一区二区三区| 97精品国产aⅴ7777| 欧美大尺度电影在线观看| 欧美日韩国产麻豆| 中文字幕v亚洲ⅴv天堂| 色偷偷888欧美精品久久久| 久久久精品欧美| 日韩av电影免费观看高清| 久久久久久久久中文字幕| 浅井舞香一区二区| 亚洲精品久久久久| 国产免费一区二区三区在线能观看| 久久这里有精品| 亚洲剧情一区二区| 久久精品国产亚洲| 国产亚洲欧洲高清一区| 国产成人精品视| 久久人人爽人人爽人人片av高清| 亚洲国产精品高清久久久| 欧美日韩中文在线| 午夜精品久久久久久久男人的天堂| 亚洲欧美日韩在线高清直播| 国产欧美亚洲视频| 国产日本欧美一区二区三区在线| 久久久日本电影| 久久久久久高潮国产精品视| 2020欧美日韩在线视频| 日韩亚洲综合在线| 久久在线免费视频| 一区二区三区黄色| 国产精品视频自在线| 亚洲天堂av高清| 精品日韩美女的视频高清| 亚洲天堂av图片| 亚洲福利精品在线| 国产精品久久久久久久久久久不卡| 91精品国产沙发| 96精品视频在线| 亚洲天堂精品在线| 色哟哟亚洲精品一区二区| 97视频在线观看亚洲| 久久91精品国产| 成人精品视频99在线观看免费| 国产日韩换脸av一区在线观看| 国产91热爆ts人妖在线| 高清日韩电视剧大全免费播放在线观看| 久久97久久97精品免视看| 成人在线免费观看视视频| 91亚洲va在线va天堂va国| 亚洲欧美日韩天堂一区二区| 久久国产精品久久久久久| 91av在线精品| 成人精品一区二区三区电影黑人| 久久久久久久一区二区| 亚洲美女视频网| 国产精品日韩专区| 黑人巨大精品欧美一区二区| 在线国产精品播放| 精品国产自在精品国产浪潮| 欧美精品在线视频观看| 国产精品视频白浆免费视频| 欧美二区乱c黑人| 97国产精品视频| 精品视频一区在线视频| 国产欧美va欧美va香蕉在| 国产精品69精品一区二区三区| 久久噜噜噜精品国产亚洲综合| 久久99久久久久久久噜噜| 亚洲成色999久久网站| 久久影视三级福利片| 最近2019年中文视频免费在线观看| 亚洲电影av在线| 日韩福利视频在线观看| 九九久久国产精品| 亚洲四色影视在线观看| 国产三级精品网站| 日韩电影免费在线观看中文字幕| 亚洲综合最新在线| 欧美激情精品在线| 懂色aⅴ精品一区二区三区蜜月| 亚洲欧美国产日韩中文字幕| 国内揄拍国内精品少妇国语| 中文字幕久热精品视频在线| 琪琪第一精品导航| www欧美xxxx| 97精品一区二区视频在线观看| 国产精品激情av在线播放| 日日骚av一区| 青青久久av北条麻妃黑人|