Hi guys,
I’m developing a game and in this game i want to teleport the player to the bottom of the platform, when player activate the trigger he is teleported to the bottom of the platform. Does anybody have any ideia how i could script this?
I’m usign this script, actually it works but the player can’t move anyware after been teleported, just like if its lose his movement script.
public var player : GameObject;
function OnTriggerEnter (hit : Collider){
if (hit.gameObject.tag == "blue_platform "){
public var blue_platform: GameObject = GameObject.FindWithTag("blue_platform ");
transform.position = blue_platform.transform.position;
transform.Rotate(180,0,0);
GetComponent(“player_state_color”).gravity = -20;
player.transform.position.y = blue_platform.transform.position.y -10;
}
}
This script is atached to player.
Does anybody have and ideia or suggestion?
Does OnTriggerEnter keep getting called repeatedly for some reason? If so, the player’s position would keep getting reset and this would explain why he can’t move. You can detect this by printing a message from inside the “if” statement in OnTriggerEnter. I’m not sure why this would be happening but it might be worth checking out.
I thinks this is happening because of the Character Controller, when i use transform.Rotate(180,0,0), i’m rotating my player graphics but the character controller collider don’t rotate with player graphics, it stays in the same position before, i think if i could rotate the collider it should work perfectly, but acctually i didn’t find a way to rotate de collider of CharacterController, maybe if i create an variable:
var characterController : CharacterController = gameObject.FindWithTag(“Player”).GetComponent(CharacterController);
characterController.transform.Rotate(180,0,0);
I will check the trigger call, but i think its not calling repeatedly because i have trigger validation only on the up side of the platform, i didn’t created the down side trigger yet! : )
And i will try getting the CharacterController Component too!