Hi guys,
Let me ask somthing. How i should parent my player with a platform that makes a 180 twist and the player must not fall down? I’m trying to parent my player with platform but everytime platform makes the twist the player fall down. I have already tried to change the gravity to zero but te player dont move because it must be grounded to move. I’m using charactherController. Does anybody have any idea or suggestion?
Thanks!
the platform ts like… rotating 180 in the X or Y aspect?
The platform is rotating on x axis.
This is the script i’m using
var jogador : Transform;
var plataforma_azul : Transform;
var corJogador : String;
var entrouTrigger : boolean = false;
function OnTriggerEnter(objectCollided : Collider){
corJogador = jogador.GetComponent("player_state_color").playerState;
if(entrouTrigger == false){
if(objectCollided.tag == "Player" corJogador == "Azul"){
jogador.transform.parent = plataforma_azul.transform;
plataforma_azul.animation.Play("rotate_plataforma_180");
plataforma_azul.animation.wrapmode = WrapMode.Once;
for (var state : AnimationState in plataforma_azul) {
state.speed = 1.0;
}
jogador.GetComponent("player_state_color").gravity = 0;
if (!plataforma_azul.animation.isPlaying){
jogador.GetComponent("player_state_color").estado = true;
}
}
}
if(entrouTrigger == true){
if(objectCollided.tag == "Player" corJogador == "Azul"){
jogador.transform.parent = plataforma_azul.transform;
plataforma_azul.animation.Play("rotate_plataforma_180");
plataforma_azul.animation.wrapmode = WrapMode.Once;
for (var state : AnimationState in plataforma_azul) {
state.speed = -1.0;
}
if (!plataforma_azul.animation.isPlaying){
jogador.GetComponent("player_state_color").gravity = 20;
jogador.GetComponent("player_state_color").estado = false;
}
}
}
}
function OnTriggerExit(){
entrouTrigger = true;
}