- Home /
Getting continuos collision AND collision without a barrier
I actually have 2 questions. 1: I have a turret that detects where a bullet is using a collision box from the object in front of it. It then moves based on if the bullet come into contact with its collision. The problem I'm having if it does come into collision it only runs once. Once they come into collision I want the turret to rotate until they aren't colliding. Here is the code I used:
private GameObject Turret;
void Start()
{
Turret = GameObject.FindWithTag("Turret");
}
// Update is called once per frame
void Update () {
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Testing")
{
Turret.transform.Rotate(0, 100 * Time.deltaTime, 0);
}
}
Question 2: I want to create a collider where something can go through it but it doesn't stop or actually hit the object like an invisible wall. How do I go about this?
Your answer
Follow this Question
Related Questions
Capsule Collider editing via script? 1 Answer
How do i code a Mesh collider ? 1 Answer
Mesh collider without Rigidbodies 1 Answer
vehicle falls through the ground 1 Answer
Fps drops after entering house 0 Answers