- Home /
Questions about Is Triggers and player collision. HELP!
Hey guys, sorry if this post maybe a repeated one, i couldnt find any that answer my question.
1. Is there a way whereby i could check whether if the player is colliding with any is trigger on scene?
Currently i trying to achieve an objective whereby if player is not colliding with any of my collectibles within a certain timing, the score will be reset.
Thanks,
Answer by Mike 3 · Dec 28, 2010 at 03:58 AM
You could record the time you last collided with a collectible
var lastTime = 0.0; var score = 0; var certainTime = 2.0;
function OnTriggerStay(col : Collider) { if (col.name == "collectible") lastTime = Time.time; }
function Update() { if (Time.time - lastTime > certainTime) score = 0; }
Answer by Kristijan · Dec 28, 2010 at 11:12 AM
Ohh? This seems like a good Idea, it's like in Need For Speed when you need to check in with your goals or GAME OVER XD Yes what he said is correct, just copy & paste the script to match the items, if you Know what I mean.
Checkpoints Hehe, this is what u meant right? Ohh, and don't forget to make an actual score increasing script, just saying XD
Your answer
Follow this Question
Related Questions
Score keeping script 3 Answers
Determining rotation for collision avoidance? 3 Answers
Collision between sambe objects with same Layer 1 Answer
Optimization of bullet hit calculation per frame 1 Answer
Collision Destroy script without trigger 0 Answers