Moving Plattform interaction with player

So in my jumping game i want moving plattforms :
Now the plattforms work fine on their own, their iteraction with the player is wierd though in 2 situations:

if the player is below the plattform, he doesnt get pushed away/ “crashed”. Instead the plattform moves through the player. Adding a rigidbody to the plattform makes it worse, because then the player even starts to push the plattform away instead of the other way around. How can i have the plattform push the player away from beeing underneath?

if the plattform goes in a direction other than the y-axis and the player is ON the plattform. The player isnt moved along with the plattform. So he kind a has to run to stay on the moving plattform. How can i make the player move with the plattform in all 3 axis?

Here the moving plattform code, not sure if it’s of any help for answering my question though.

using UnityEngine;
using System.Collections;

public class MovingAB : MonoBehaviour {
	
	public float x = 0;
	public float y = 0;
	public float z = 0;
	public float offset = 0;	//percent done going to B

	public float speed = 2;

	Vector3 PointA;
	Vector3 PointB;
	Vector3 direction;
	float way;
	float wayDone =0;

	bool gotoB = true;

	// Use this for initialization 
	void Start () {

		PointA = transform.position;
		PointB = PointA + new Vector3 (x, y, z);
		direction = (PointB - PointA).normalized;
		way = (PointB - PointA).magnitude;

		transform.position += offset *way/100 * direction;
		wayDone += offset* way/100;
	
	}
	
	// Update is called once per frame
	void Update () {

		if (gotoB) {
			transform.position += direction * speed * Time.deltaTime;
			wayDone += speed * Time.deltaTime;
		} else {
			transform.position -= direction*speed*Time.deltaTime;
			wayDone += speed * Time.deltaTime;
		}
		//check if reached pointA or B and reverses direction
		if (wayDone >= way) {
			gotoB = !gotoB;
			wayDone -= way;
		}
	
	}
}

Hi,
I would recommend using colliders and functions on triggerStay and on triggerExit

function OnTriggerStay(other:Collider)
{
       if(other.gameObject.tag == "platformAbove")
            {
             transform.position += platform.movement; //add the platform movement to your player
             }
}

Then you could also create a second collider under the platform and ontriggerstay or on triggerenter it would kill or move your player.
Hope this helps,

Great, that works. I didnt use tag regonize, that way it moves anything on top of it . For example boxes, or enemies.

Now for the crushing part, the scaling of the transform works nice. There’s a litte problem with the collider though:

// scales the collider if its not a boxcollider
void scaleCollider(Collider c){
	if (c.GetType () == typeof(SphereCollider) || c.GetType () == typeof(CapsuleCollider)) {
		if (c.radius >= 0.1) {		//yes, i do know that c has a radius!!!
			c.radius -= speed * Time.deltaTime * crushspeedfactor;
		}
	}
}

It wont accept c.radius. How can have it know that c is not only a collider but spherecollider/capsulecollider?