- Home /
Question by
kamexo3196 · Feb 04, 2012 at 04:44 AM ·
charactercontrollerplatform
making "one-way" platform
Hello.I'm expanding the unity's "2D Gameplay Tutorial " to inprove my coding skill. I want to make the platform like this...
It won't work as a platform if the player(character controller)'s y position are increasing.
It will work as a platform if the player's y position are decreasing.
This is my code attached in the platform.But it just works as a normal platform . Please improve this code.Thanks in advance.
function OnCollisionStay(col:Collision){
if(col.relativeVelocity.y>0)
enabled=false;
}
Comment
Best Answer
Answer by AVividLight · Feb 04, 2012 at 05:41 AM
Have you tried the Plane GameObject; it might work!
Gzee.I've never expected answer will be so easy. Thanks for your help!
No problem! I wish you luck with your endeavors, and never stop learning! - Gibson