- Home /
Help My TP.js Script isn't working
i have no errors but it wont work please help! I add a Partical system as my TP's an then inserted abox collider which i set the trigger to true, now why is it when i play the box collider isn't working like it should, it should work like an invisble door that takeyou to pointb, I parented the TP's to one another but the portles act a a barrior instead of a portal
#pragma strict
var target : GameObject;
var adjust : float;
var c1 : Color;
var jump : boolean;
function Start (){
renderer.material.color = c1;
}
function OnTriggerEnter(other : Collider){
if(!jump){
if(other.tag == "Player"){
target.GetComponent(Teleport).jump = true;
other.gameObject.transform.position = Vector3(target.transform.position.x, target.transform.position.y + adjust, 0);
}
}
}
function OnTriggerExit(other : Collider){
if(other.tag == "Player"){
jump = false;
}
}
Hi, you need to say why it is not working, what it is not doing that you want it to do :)
I add a box collideraround my partical system aka my TP and i set trigger to true and i add the script to both TP's but it wont let my character go through.
It's so odd to me but the trigger wont work do u think if I add a 2d colliderwill it work?
What do you mean when you say it won't let the character go through, do you mean it acts like a collider rather than a trigger?
Answer by spiceboy9994 · Nov 11, 2014 at 11:44 PM
Here's something to test your script:
Try commenting the line 15 (stop moving the other game object), instead of that, just place a Debug.Log to ensure that the line is hit. It may be entering the trigger, but the transform relocation could be the line that provokes the strange behavior. Also, place a debug.log to ensure that jump variable is false. It is not really an answer, but it could help you out on finding what the real issue is.
Your answer
Follow this Question
Related Questions
Moving Platform Help (c#) 3 Answers
Roll-A-Ball tutorial help. 0 Answers
calling functions help {javascript} 1 Answer
Scripting BUG: target becomes bigger when getting nearer 1 Answer