Home > other >  For a rigid body collision body problem, consult the bosses
For a rigid body collision body problem, consult the bosses

Time:09-28

I have two models
Model a: a Cube, added the rigid body, the collision body, using rigid body moving
Model b: a chair, only add the rigid body, there is no script control

Then I control model to bump model b when the two cases
The first is that I go to hit at a slower speed model b, model no penetration model b
chair leg in the middle of the gapThe second is I to a speed bump model b, model through the model b
chair leg in the middle of the gap
I don't know why I will appear in both cases, because in theory model should not penetrate model b ah, all have no result I checked the along while, see what a crossing tachycardia, also don't know if I the answer to this question, so please teach bosses bai

In addition: model b is my spell with the Cube so his body is not a big collision of the Cube

CodePudding user response:

Rigidbody has an attribute "Collision Detection" (Collision Detection),

Discrete '(Discrete) : when the objects that a frame is in the front, the next frame went to the back, we won't be able to detect, not suitable for high speed moving object
Continuous (Continuous) : prevent objects through all static collision body
Continuous Dynamic Continuous detection (Dynamic) : prevent colliding objects through all static body and set to Continuous or Continuous Dynamic rigid body,

Moving too fast, easy to appear on a frame in front of the object B, the next frame behind the object B, object collision is not effective,

CodePudding user response:

reference 1st floor Uncle_Xiang response:
Rigidbody has an attribute "Collision Detection" (Collision Detection),

Discrete '(Discrete) : when the objects that a frame is in the front, the next frame went to the back, we won't be able to detect, not suitable for high speed moving object
Continuous (Continuous) : prevent objects through all static collision body
Continuous Dynamic Continuous detection (Dynamic) : prevent colliding objects through all static body and set to Continuous or Continuous Dynamic rigid body,

Moving too fast, easy to appear on a frame in front of the object B, the next frame behind the object B, object collision is not effective,

Bosses, I changed the properties also useless, or through the static collision body!

This is a code, bosses, you look really is very confused
 
using System.Collections;
Using System. Collections. Generic;
using UnityEngine;

Public class movetxte: MonoBehaviour {

Rigidbody _rigidbody;
The Transform _transform;
Void the Start () {
_rigidbody=gameObject. GetComponent (a);
_transform=gameObject. GetComponent (a);
}
Void the Update () {
If (Input. GetKeyDown (KeyCode. W))
{
_rigidbody. MovePosition (transform) position + Vector3) forward);
}
}
}

CodePudding user response:

CodePudding user response:

They melody no bosses please answer

CodePudding user response:

I'm sorry, just see,

Collision and the collision object requires BoxCollider, Rigidbody this two components,

Check your BoxCollider Settings, IsTrigger to be checked if there will be no collision effect,


I copied your code, the effect is normal, (no need to check the Static)

CodePudding user response:

Small remind
If don't need another object motion, like a wall, table, etc...
Don't need RigidBody (steel)
Starts (collision) + RigidBody (steel) can touch starts (collision)
In addition if two objects often make an object move collision can consider to use AddForce (thrust)

CodePudding user response:

The conditions of the collision:
Two objects have at least one with rigid body components;
Two objects must have collision;

You said that you added A rigid body model b only, did not add collider, add A collider to try again, then is the way of collision detection, if b object speed, assuming that the first frame has not happened when collision, but because of the too fast, the second frame, calculate the new position has missed A, so that it cannot detect the collision, the component has chosen mode of collision, the more precise collision, the need to consume the performance,
  • Related