e.mousePosition.x, Screen.height - e.mousePosition.y -36,0));//Upside-down and offset a little because of menusRaycastHithit =newRaycastHit();if(Physics.Raycast(ray,outhit,1000.0f)) {if(hit.collider.gameObject.GetComponent<ChunkObjectData>()) {returnhit.collider.gameObject.transform.position ...
public GameObject box;//获取我们Scene中的Box空物体void Start(){//创造墙的代码写在Start方法中,因为游戏一运行就会有一堵墙for(inti=0;i<18;i++){for(intj=0;j<10;j++){GameObjectgo=GameObject.CreatePrimitive(PrimitiveType.Cube);//创造物体Cube做为箱子go.transform.localScale=newVector3(5,5,5);...
hitInfo.raycastHit = hit; hit.collider.gameObject.SendMessage("GunHitInfo", hitInfo, SendMessageOptions.DontRequireReceiver);//send damage and position of hit} } } 开发者ID:Foodpunch,项目名称:ZOMBIETOWNVR,代码行数:26,代码来源:ShotgunScript.cs 示例4: Kill ▲点赞 2▼ privatevoidKill(){HitI...
{ IGameObject testable = null; var bridge = unityHit.collider.gameObject.GetComponent <UnityBridgeComponent>(); if (null != bridge) { testable = bridge.GameObject; } hitinfo = new RaycastHit(unityHit.point.ToUniject(), unityHit.normal.ToUniject(), unityHit.barycentricCoordinate.ToUniject(...
if(hit.collider.gameObject.tag.Contains("Finish")) {//plane tag } GameObject parentGameObject = hit.transform.parent.gameObject; SSDirector ssdDirector = SSDirector.getInstance(); // Debug.Log(parentGameObject.GetComponent<UFOController>().getNum()); 不能用这个确定UFO的index,原因未知 ...
void Start() { cam = GetComponent<Camera>(); } void Update() { if (!Input.GetMouseButton(0)) return; RaycastHithit; if (!Physics.Raycast(cam.ScreenPointToRay(Input.mousePosition), out hit)) return; Rendererrend = hit.transform.GetComponent<Renderer>();MeshCollidermeshCollider = hit.collider...
A ray is fired into the scene. The textureCoord is the location where the ray has hit a collider. RaycastHit._textureCoord is a texture coordinate when a hit occurs. A Vector2 zero is returned if no mesh collider is present in the GameObject. ...
voidOnControllerColliderHit(ControllerColliderHitother){if(other.gameObject.GetComponent<DeathOnContact>() !=null) { Kill(); } } 开发者ID:MatthewNelson2015,项目名称:UND-Capstone-Game-2014-2015,代码行数:7,代码来源:Manager.cs 示例5: OnControllerColliderHit ...
voidOnTriggerEnter(Collider other){if(Network.isClient)return;boolhit =false;if(universeN() !=-1) { manager = GameObject.Find("Character"+ universeN()).GetComponent<PlayerManager>(); GameObject collided = other.gameObject;stringcollidedTag = collided.tag;switch(collidedTag) ...
return; renderer rend = hit.transform.getcomponent< renderer >(); meshcollider meshcollider = hit.collider as meshcollider ; if (rend == null || rend.sharedmaterial == null || rend.sharedmaterial.maintexture == null || meshcollider == null) return; texture2d tex = rend.material.main...