- Home /
http://answers.unity3d.com/questions/34444/high-speed-object-collisionhow-to-avoid-pass-throu.html
If force > some value, objects moving through coliders.
I have simple code script code for prefab :
public bool shake;
public float shakePower;
private Rigidbody rb;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown (KeyCode.Space))
{
shake=true;
}
}
void FixedUpdate()
{
if (shake)
{
rb.AddForceAtPosition(shakePower*(new Vector3(Random.Range(1,100),Random.Range(1,100),Random.Range(1,100))).normalized,transform.position);
shake = false;
}
}
some of these objects moving through the walls (object with colider) some stuck inside the walls if force magnitude higer of some value. I try different types of coliders (sphere, mesh, capsule, plane) for this prefab and for walls and nothing helped. How I need to set up the phisics to prevent objects move through walls coliders?
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
I am working on temple run like game 1 Answer
colider issues 0 Answers
Collider being able to push rigidbody, but not be able to be pushed 0 Answers
Any way to have a rigidbody not be affected by forces, but still collide with other objects? 2 Answers