I have moving platform made by animation and ball,
platform - rigidbody and box collider.
ball - rigidbody and sphere collider.
When i run into moving platform the ball penetrate and fall down.
How can i make to ball elevate by platform?
I have moving platform made by animation and ball,
platform - rigidbody and box collider.
ball - rigidbody and sphere collider.
When i run into moving platform the ball penetrate and fall down.
How can i make to ball elevate by platform?
Make sure both rigidbodies are kinetic and the colliders are not triggers. Thats what worked for me.
You can try
// All you have to do is make the ball the child of the platform
// Add this to the player
// You might have to do OnCollisionStay
void OnCollisionEnter(Collision col){
if(col.gameObject.tag == "Platform"){
gameObject.transform.parent = col.gameObject.transform;
//Disable any Components below this that you might need to do.
//Comp1
//Comp2
//Etc.
}
}
void OnCollisionExit(){
//De-Parent our ball from the platform
gameObject.transform.parent = null;
//Re-enable any components below this.
}
If this is correct and works for you, please mark this as correct so others will know.
Hope that helped.