Hello,
i want to add little helper to our racegame (like arrow or something), if the player is going wrong direction. Its two player splitscreen game. Attached image is overview of one level, and arrows represents desired direction; red for player1 and blue for player2.
I think this kind of thing can be done by checking player direction against some sort of direction vectors placed to the level. Not totally sure how to do that. Should i check if those two vectors intersect? Perhaps there is better way to accomplish this… any thoughts?

Edit: checkpoint script added.
#pragma strict
static var curP1:String;
var nextP1:String;
static var _nextP1:String;
static var curP2:String;
var nextP2:String;
static var _nextP2:String;
function Start()
{
curP1 = "";
curP2 = "";
_nextP1 = "start";
_nextP2 = "start";
}
function OnTriggerEnter (other : Collider)
{
if ( other.gameObject.name == "Player1")
{
curP1 = transform.name;
if (curP1 == _nextP1)
_nextP1 = nextP1;
}
if ( other.gameObject.name == "Player2")
{
curP2 = transform.name;
if (curP2 == _nextP2)
_nextP2 = nextP2;
}
}
Idea is simple: every collider has a name and variable for next checkpoint. These needs to be edited in inspector, so i suppose i need to figure out better way to do this if i end up to use @CuddleMonster’s idea.
yep, upvoted. Use trigger colliders as waypoints. There is an excellent example here : http://www.youtube.com/watch?v=7NehsLWcFIU
– AlucardJayThanks for answer. At the moment i got just four checkpoints (+start) at the level; up,down,left,right. I'll try to add this method for those. Covering whole level with checkpoint system i have, would cause quite lot of work, so i suppose i should learn better way for checkpoints (waypoints), so thanks @alucardj for the example. I'll edit the question to include current checkpoint script.
– chelnokAnd for others, here is the code to check direction: if (Vector3.Dot(transform.forward, playerGO.rigidbody.velocity) < 0){ print("Wrong direction"); }
– chelnok