Hi, I’m new to Unity I need this help.
I have 2 game objects which moves at a predefined speed.
Another is player game object. When player collide with this moving game object, I need player to move along with this.
But, now: When they come in contact, there is a slight crest and then they pass through each other.
Any idea why this is happening ?
have you check for is trigger option in any of the game object,if u do u it will go through every colider
This is actually a two-part problem, same issue.
1)This goes along with what Nanobrain was leading to. When moving your objects by updating their transform, they will go through other objects. To fix: move your rigidbody objects by actually adding a force to them.
2)The other problem you are facing is that your character movement script probably isn’t physics based either (my guess is you are using the default). The way to get your character to move back when hit is by adding the same force to your character as the rigidbody object that hit it had. Unfortunately because your movement script is not physics-base, you need to hard code this.