void OnControllerColliderHit(ControllerColliderHit hit) { Rigidbody body = hit.collider.attachedRigidbody; MazeCell cell = hit.gameObject.GetComponentInParent<MazeCell>(); if (cell == null) return; if(cell != currentCell) { if(currentCell != null) currentCell.OnPlayerExit(); cell.OnPlayerEnter(); } currentCell = cell; Vector3 transformDirection = new Vector3(Mathf.Round(transform.forward.x), 0f, Mathf.Round(transform.forward.z)); IntVector2 direction = new IntVector2((int) transformDirection.x, (int) transformDirection.z); if(direction.x != 0 && direction.z != 0) { if (Random.Range(0, 1) == 1) direction.x = 0; else direction.z = 0; } MazeDirection mazeDirection = MazeDirections.FromIntVector2(direction); faceDirection = mazeDirection; }
public override void OnControllerColliderHit(ControllerColliderHit hit) { if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(hit.gameObject.tag)) { collidedGameObject.Value = hit.gameObject; enteredCollision = true; } }
void OnControllerColliderHit(ControllerColliderHit hit) { //Debug.Log ("detect a controller collider hit"); Rigidbody body = hit.collider.attachedRigidbody; Vector3 pushDir; //Debug.Log ("body = " + (body==null)); if (body!=null) //Debug.Log ("body = " + (body.isKinematic)); // no rigidbody if (body == null || body.isKinematic) { return; } //Debug.Log (hit.moveDirection); // We dont want to push objects below us if (hit.moveDirection.y < -0.3) { return; } if (body.tag == "Door") { //Debug.Log("Pushing door"); body.AddForce(-transform.forward * 1000f, ForceMode.Acceleration); body.useGravity = true; } else { // Calculate push direction from move direction, // we only push objects to the sides never up and down pushDir = new Vector3 (hit.moveDirection.x, 0, hit.moveDirection.z); // If you know how fast your character is trying to move, // then you can also multiply the push velocity by that. // Apply the push body.velocity = pushDir * pushPower; } }
/*////////////////////////////////////*/ //Fonction des Dommages /*////////////////////////////////////*/ void OnControllerColliderHit(ControllerColliderHit collision) { if(collision.gameObject.tag == "Player") { animator.SetBool("Hit", true); } }
private void OnControllerColliderHit(ControllerColliderHit hit) { if (this.regularMutant) { bool flag = false; if (hit.gameObject.CompareTag("UnderfootWood")) { enemyCanPush component = hit.gameObject.GetComponent<enemyCanPush>(); if (component) { flag = true; } } if (hit.gameObject.CompareTag("Float") || hit.gameObject.CompareTag("suitCase") || hit.gameObject.CompareTag("pushable") || hit.gameObject.CompareTag("BreakableWood") || hit.gameObject.CompareTag("hanging") || flag) { Rigidbody attachedRigidbody = hit.collider.attachedRigidbody; if (attachedRigidbody == null || attachedRigidbody.isKinematic) { return; } float explosionForce = 100f; if (flag) { explosionForce = 1000f; } attachedRigidbody.AddExplosionForce(explosionForce, base.transform.position, 20f); } } }
void OnControllerColliderHit (ControllerColliderHit hit){ if (hit.gameObject.tag == "playerDoor" && doorIsOpen == false) { OpenDoor(hit.gameObject); } }
// check to see if we hit the player and if so do damage void OnControllerColliderHit(ControllerColliderHit hit) { if(hit.transform == PlayerController.getPlayer()){ hit.transform.GetComponent<PlayerController>().takeDamage(touchDamage); } }
void OnControllerColliderHit(ControllerColliderHit hit) { if (hit.collider.gameObject.name == "Box") { Debug.Log("Collision!!!!!"); } }
void OnControllerColliderHit(ControllerColliderHit hit) { // hit.gameObjectで衝突したオブジェクト情報が得られる if (hit.gameObject.CompareTag ("DangerWall")) { Application.LoadLevel(Application.loadedLevel); } }
public override void OnCharacterCollided(ControllerColliderHit hit, Transform other) { base.OnCharacterCollided(hit, other); if (Colliding) return; //check if hit point beneath player var dir = (hit.point - other.position).normalized; if (dir.y < -0.9) CollisionType = DaggerfallAction.TriggerTypes.WalkOn; else { if (thisAction.TriggerFlag == DaggerfallConnect.DFBlock.RdbTriggerFlags.Collision01) { Vector3 origin = new Vector3(hit.controller.transform.position.x, hit.controller.transform.position.y - hit.controller.height / 2, hit.controller.transform.position.z); Ray ray = new Ray(origin, Vector3.down); RaycastHit hitInfo; //if hit not below controller, see if player standing on this action object w/ raycast & if action flag is Collision01 (walk on) //set trigger type & activate if so - to avoid player being able to push against wall to avoid if (hit.collider.Raycast(ray, out hitInfo, hit.controller.skinWidth)) CollisionType = DaggerfallAction.TriggerTypes.WalkOn; else CollisionType = DaggerfallAction.TriggerTypes.WalkInto; } else CollisionType = DaggerfallAction.TriggerTypes.WalkInto; } Colliding = true; }
void OnControllerColliderHit(ControllerColliderHit hit) { Rigidbody body = hit.collider.attachedRigidbody; // no rigidbody if (body == null || body.isKinematic) return; // We dont want to push objects below us if (hit.moveDirection.y < -0.5) { //platform = hit.transform; return; } // Calculate push direction from move direction, // we only push objects to the sides never up and down // if you wanted up and down pushing, change 0 to hit.moveDirection.y Vector3 pushDir = new Vector3(hit.moveDirection.x, 0, hit.moveDirection.z); // If you know how fast your character is trying to move, // then you can also multiply the push velocity by that. // Apply the push and decrease speed to 25% of the normal walk speed. body.velocity = (pushDir * Speed)/4; }
void OnControllerColliderHit(ControllerColliderHit hit) { Rigidbody body = hit.collider.attachedRigidbody; // no rigidbody if (body == null || body.isKinematic) return; // Only push rigidbodies in the right layers var bodyLayerMask = 1 << body.gameObject.layer; if ((bodyLayerMask & pushLayers.value) == 0) return; // We dont want to push objects below us //if (hit.moveDirection.y < -0.3) // return; // Calculate push direction from move direction, we only push objects to the sides // never up and down //Vector3 pushDir = new Vector3(hit.moveDirection.x, 0, hit.moveDirection.z); // push with move speed but never more than walkspeed //body.velocity = pushDir * pushPower * Mathf.Min (controller.GetSpeed (), controller.movement.walkSpeed); body.AddForceAtPosition(hit.normal*(-pushPower), hit.point); //print(hit.normal); }
void OnControllerColliderHit(ControllerColliderHit hit) { if (Input.GetKey(KeyCode.Return)) { Rigidbody body = hit.collider.attachedRigidbody; if (body == null) { return; } if (hit.gameObject.CompareTag ("Ball")) { body.isKinematic = false; Debug.Log("Toimii"); pushForce = 2.0f; Vector3 pushDir = new Vector3(1, 0, 1); body.velocity = pushDir * pushForce; hit.gameObject.SendMessage("ObjectFalling", SendMessageOptions.DontRequireReceiver); } else if (hit.gameObject.CompareTag("Cube")) { body.isKinematic = false; Debug.Log("Toimii"); pushForce = 50.0f; Vector3 pushDir = new Vector3(1, 0, 1); body.AddForce(pushDir * pushForce); hit.gameObject.SendMessage("ObjectFalling", SendMessageOptions.DontRequireReceiver); } } }
public void OnControllerColliderHit(UnityEngine.ControllerColliderHit a) { if (fn != null) { fn.invoke(gameObject, a); } }
void OnControllerColliderHit(ControllerColliderHit coll) { if(coll.gameObject.tag == damageTag) { myKillable.Damage(damageRate); } }
void OnControllerColliderHit(ControllerColliderHit hit) { if(hit.transform.tag == "enemy") { hit.transform.SendMessage("", SendMessageOptions.DontRequireReceiver); } }
void OnControllerColliderHit(ControllerColliderHit hit){ GameObject go = GameObject.FindGameObjectWithTag ("Player"); MainPjMovement target = go.GetComponent ("MainPjMovement") as MainPjMovement; if (target.getHP () != target.getMAXHP ()) { if (hit.gameObject.tag == "BigHealPotion") { PJAudio.DrinkPotion(); target.increaseHeal (200); Destroy (hit.gameObject); } if (hit.gameObject.tag == "LittleHealPotion") { PJAudio.DrinkPotion(); target.increaseHeal (100); Destroy (hit.gameObject); } } if (target.getMP () != target.getMAXMP ()) { if (hit.gameObject.tag == "BigManaPotion") { target.increaseMana (200); Destroy (hit.gameObject); } if (hit.gameObject.tag == "BigManaPotion") { target.increaseMana (100); Destroy (hit.gameObject); } } if (hit.gameObject.tag == "Shield") { target.setShield(true); Destroy(hit.gameObject); } }
static void ControllerColliderHit_moveDirection(JSVCall vc) { UnityEngine.ControllerColliderHit _this = (UnityEngine.ControllerColliderHit)vc.csObj; var result = _this.moveDirection; JSApi.setVector3S((int)JSApi.SetType.Rval, result); }
public bool handleCollision(ControllerColliderHit hit, Rigidbody body, float force) { Vector3 pushDir = new Vector3 (hit.moveDirection.x, 0, hit.moveDirection.z); // body.velocity = pushDir * force; body.AddForce (pushDir * force); return false; }
void OnControllerColliderHit(ControllerColliderHit hit) { GameObject body = hit.gameObject; switch (body.tag){ case "Target": if(state == STATE.HOOKING && body.name ==hookTarget){ state = STATE.STUCK; lastStuck = body.name; hookTarget = ""; foreach(GameObject item in passedThrough) item.collider.enabled = true; passedThrough.Clear (); } else{ passedThrough.AddFirst(body); body.collider.enabled=false; } break; case "Platform": state = STATE.GROUNDED; break; } // body.velocity = pushDir * pushPower; }
public CollisionNodeInfo(CollisionNodeToggler hitNode, Collider colliderObj, Collision collisionObj, ControllerColliderHit cchit) { this.hitNode = hitNode; collider = colliderObj; collision = collisionObj; controllerColliderHit = cchit; }
static void ControllerColliderHit_moveLength(JSVCall vc) { UnityEngine.ControllerColliderHit _this = (UnityEngine.ControllerColliderHit)vc.csObj; var result = _this.moveLength; JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result)); }
void OnControllerColliderHit(ControllerColliderHit hit) { if (hit.gameObject.name == "Spaceship") { hit.gameObject.SendMessage("EnterSpaceship", SendMessageOptions.DontRequireReceiver); return; } Rigidbody body = hit.collider.attachedRigidbody; // no rigidbody if (body == null || body.isKinematic) return; // Only push rigidbodies in the right layers int bodyLayerMask = 1 << body.gameObject.layer; if ((bodyLayerMask & pushLayers.value) == 0) return; // We dont want to push objects below us if (hit.moveDirection.y < -0.3) return; // Calculate push direction from move direction, we only push objects to the sides // never up and down Vector3 pushDir = new Vector3(hit.moveDirection.x, 0, hit.moveDirection.z); // push with move speed but never more than walkspeed body.velocity = pushDir * pushPower * Mathf.Min (controller.GetSpeed (), controller.movement.walkSpeed); }
void OnControllerColliderHit(ControllerColliderHit hit) { if ( hit.collider.tag == "Monster" ) Death (); else velocity.y = -gravity; }
void OnControllerColliderHit(ControllerColliderHit hit) { if(hit.transform.tag == "Building") { GameOver(); } }
static public int constructor(IntPtr l) { UnityEngine.ControllerColliderHit o; o = new UnityEngine.ControllerColliderHit(); pushObject(l, o); return(1); }
static void ControllerColliderHit_transform(JSVCall vc) { UnityEngine.ControllerColliderHit _this = (UnityEngine.ControllerColliderHit)vc.csObj; var result = _this.transform; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); }
void OnControllerColliderHit(ControllerColliderHit other) { if (other.gameObject.GetComponent<DeathOnContact>() != null) { Kill(); } }
void OnControllerColliderHit(ControllerColliderHit hit) { if(hit.gameObject.tag == "boulder") { hit.rigidbody.AddForce(transform.forward * speed); } }
void OnControllerColliderHit(ControllerColliderHit hit) { switch(hit.gameObject.tag) { case "StickySurface": player.SetWallJumpDirection(hit.normal); break; case "Collectable": hit.gameObject.GetComponent<Collectable>().PlayerContact(); break; case "Enemy": player.Turn(); if (player.IsAttacking() || player.IsDashing()) { hit.gameObject.GetComponent<Enemy>().JumpedAt(-hit.normal); } break; case "LooseObject": if (player.IsAttacking() || player.IsDashing()) { hit.gameObject.GetComponent<LooseObject>().FallOver(-hit.normal); } break; case "Ink": hit.gameObject.GetComponentInParent<Ink>().Collect(this.gameObject); break; case "Health": hit.gameObject.GetComponentInParent<Health>().Collect(this.gameObject); break; } }
void OnControllerColliderHit(ControllerColliderHit hit) { if (hit.gameObject.Equals (lastColl) || isAnimation) { //Debug.Log("Nothing new: " + hit.gameObject.name); return; } Debug.Log ("Collision with: " + hit.gameObject); lastColl = hit.gameObject; transform.parent = lastColl.transform; // Aneinander kleben if (hit.gameObject.tag == "Finish") Application.LoadLevel (1); else if (hit.gameObject.tag == "Respawn") { Application.LoadLevel (0); } else if (hit.gameObject.tag == "Weiß" || hit.gameObject.tag == "Schwarz") { FeldControl2 fc = hit.gameObject.GetComponent<FeldControl2>(); Debug.Log("Auf Schachbrett " + (1 + fc.Board) + " auf Feld " + fc.Field); PosText.text = "B: " + (fc.Board + 1) + " - P: " + fc.Field; if (!cBretterWeiß.AnimInProgress && !cBretterSchwarz.AnimInProgress) { if (hit.gameObject.tag == "Weiß") { transform.parent = BretterWeiß.transform; cBretterWeiß.BeginAnimation(); } else { transform.parent = BretterSchwarz.transform; cBretterSchwarz.BeginAnimation(); } } } else { Debug.Log("Collission not recognized: " + lastColl); } grounded = true; }
void ApplyHit(ControllerColliderHit hit) { if (hit.normal.y > 0.7f) { Vector3 normalVelocity = Vector3.Project(move.velocity, Vector3.up); Vector3 tangentialVelocity = Vector3.ProjectOnPlane(move.velocity, Vector3.up); var movingSurface = hit.gameObject.GetComponentInParent<MovingSurface>(); if (movingSurface == null) { tangentialVelocity = Vector3.zero; } else { Vector3 radiusVector = hit.point - movingSurface.transform.position; //Vector3 rotationVelocity = Vector3.Cross(movingSurface.currentAngularVelocity * Mathf.Deg2Rad, radiusVector); //Vector3 localHitPoint = movingSurface.transform.InverseTransformPoint(hit.point); Vector3 nextRadiusVector = Quaternion.Euler(movingSurface.currentAngularVelocity * Time.fixedDeltaTime) * radiusVector; Vector3 rotationVelocity = (nextRadiusVector - radiusVector) / Time.fixedDeltaTime; //Debug.Log("movingSurface.currentAngularVelocity: " + movingSurface.currentAngularVelocity); //Debug.Log("rotationVelocity: " + rotationVelocity); Vector3 hitPointVelocity = movingSurface.currentVelocity + rotationVelocity; tangentialVelocity = hitPointVelocity; //Debug.Log("Final tangentialVelocity: " + tangentialVelocity); } move.velocity = normalVelocity + tangentialVelocity; move.angularVelocity = movingSurface != null ? movingSurface.currentAngularVelocity : Vector3.zero; //move.angularVelocity = move.angularVelocity.Change(x: 0, z: 0); } }
static public int get_collider(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ControllerColliderHit self = (UnityEngine.ControllerColliderHit)checkSelf(l); pushValue(l, true); pushValue(l, self.collider); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
void OnControllerColliderHit(ControllerColliderHit col){ Debug.Log(col.gameObject.name); if(col.gameObject.tag == "Core"){ score++; Destroy(col.gameObject); } }
//OnControllerColliderHit(ControllerColliderHit hit) void OnControllerColliderHit(ControllerColliderHit hit) { if (hit.transform.tag == "shark"){ Destroy(gameObject); Application.LoadLevel(Application.loadedLevel); } }
public void OnControllerColliderHit(ControllerColliderHit hit) { }
static public int get_normal(IntPtr l) { try { UnityEngine.ControllerColliderHit self=(UnityEngine.ControllerColliderHit)checkSelf(l); pushValue(l,self.normal); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } }
static public int get_normal(IntPtr l) { try { UnityEngine.ControllerColliderHit self = (UnityEngine.ControllerColliderHit)checkSelf(l); pushValue(l, self.normal); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.ControllerColliderHit o; o = new UnityEngine.ControllerColliderHit(); pushValue(l, o); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.ControllerColliderHit o; o=new UnityEngine.ControllerColliderHit(); pushValue(l,o); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } }
static public int get_transform(IntPtr l) { try { UnityEngine.ControllerColliderHit self = (UnityEngine.ControllerColliderHit)checkSelf(l); pushValue(l, true); pushValue(l, self.transform); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { LuaDLL.lua_remove(l, 1); UnityEngine.ControllerColliderHit o; if (matchType(l, 1)) { o = new UnityEngine.ControllerColliderHit(); pushObject(l, o); return(1); } LuaDLL.luaL_error(l, "New object failed."); return(0); }
static int OnControllerColliderHit(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); BehaviorDesigner.Runtime.Tasks.Task obj = (BehaviorDesigner.Runtime.Tasks.Task)ToLua.CheckObject <BehaviorDesigner.Runtime.Tasks.Task>(L, 1); UnityEngine.ControllerColliderHit arg0 = (UnityEngine.ControllerColliderHit)ToLua.CheckObject <UnityEngine.ControllerColliderHit>(L, 2); obj.OnControllerColliderHit(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_moveLength(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.ControllerColliderHit obj = (UnityEngine.ControllerColliderHit)o; float ret = obj.moveLength; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index moveLength on a nil value" : e.Message)); } }
static int get_collider(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.ControllerColliderHit obj = (UnityEngine.ControllerColliderHit)o; UnityEngine.Collider ret = obj.collider; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index collider on a nil value" : e.Message)); } }
public Hit(UnityEngine.ControllerColliderHit ControllerColliderHit) { this.CharacterController = ControllerColliderHit.controller; CCDesc sCurrentMovingCCDesc = CCDesc.s_CurrentMovingCCDesc; if (!sCurrentMovingCCDesc || sCurrentMovingCCDesc.collider != this.CharacterController) { this.CCDesc = this.CharacterController.GetComponent <CCDesc>(); } else { this.CCDesc = sCurrentMovingCCDesc; } this.Collider = ControllerColliderHit.collider; this.Point = ControllerColliderHit.point; this.Normal = ControllerColliderHit.normal; this.MoveDirection = ControllerColliderHit.moveDirection; this.MoveLength = ControllerColliderHit.moveLength; }
static int _CreateUnityEngine_ControllerColliderHit(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { UnityEngine.ControllerColliderHit obj = new UnityEngine.ControllerColliderHit(); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.ControllerColliderHit.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int get_moveLength(IntPtr l) { UnityEngine.ControllerColliderHit o = (UnityEngine.ControllerColliderHit)checkSelf(l); pushValue(l, o.moveLength); return(1); }
static public int get_normal(IntPtr l) { UnityEngine.ControllerColliderHit o = (UnityEngine.ControllerColliderHit)checkSelf(l); pushValue(l, o.normal); return(1); }
static public int get_gameObject(IntPtr l) { UnityEngine.ControllerColliderHit o = (UnityEngine.ControllerColliderHit)checkSelf(l); pushValue(l, o.gameObject); return(1); }
static public int get_rigidbody(IntPtr l) { UnityEngine.ControllerColliderHit o = (UnityEngine.ControllerColliderHit)checkSelf(l); pushValue(l, o.rigidbody); return(1); }
public void OnControllerColliderHit(UnityEngine.ControllerColliderHit a) { RunFunctions(a); }
/// <summary> /// OnControllerColliderHit /// </summary> void OnControllerColliderHit(UnityEngine.ControllerColliderHit _hit) { simulateMonoBehaviour.OnControllerColliderHit(_hit); }
/// <summary> /// OnControllerColliderHit /// </summary> public void OnControllerColliderHit(UnityEngine.ControllerColliderHit _hit) { OnRunControllerColliderHit(_hit); }
/// <summary> /// OnOnControllerColliderHit /// </summary> protected virtual void OnRunControllerColliderHit(UnityEngine.ControllerColliderHit _hit) { }
IEnumeratorOrVoid OnControllerColliderHit(ControllerColliderHit hit) { return(null); }