Please help, moving block!!!

This is hard, HARD I tell ya!! lol

Anyways, the problem is that I made a block, or cube, that moves up when my character lands on it, but my character goes right through it. Then I read on some posts that it is because character controllers usually ignore physics and that it is easily fixed with a OnControllerColliderHit function. Well I tried, and the character does go up, but to a certain extent and then falls through it. Here is the bit of code I am using:

MainController.js

function OnControllerColliderHit (hit : ControllerColliderHit)
{
	if(hit.gameObject.tag == "MovingBlock")
	{
		transform.position.y += Time.deltaTime * 60;
	}
}

and here is MovingBlockTrigger.js

var block : Transform;


function OnTriggerStay( hit : Collider)
{
	transform.position.y += Time.deltaTime * 60; 
}

Any help will be appreciated.

cheers =]

According to unity runtime class reference, OnTriggerStay:

“OnTriggerStay is called almost all the frames for every Collider other that is touching the trigger.”

I think that’s what your problem might be. Maybe use OnTriggerEnter and OnTriggerExit instead?

Hell, if they actually italicized it in the manual…

Well, I tried using OnTriggerEnter/Exit, but same results. I made it work now, but to a certain extent. I made it so that when the player detected that it made a collision with a gameObject.tag == MovingBlock, it will move up multiplied by Time.deltaTime. It made it go up at the same speed as the block, but it nulls the movement and inly when I jump can the player move again. I guess it’ll do for now till I figure it out completely.

EDIT

nvm, I solved it. It was just a matter of doing a lot of if statements to make it work.