I’m a tad confused with these two, and trying to narrow down the parameters in the Script Referance is like looking for a needle in an infitesimle haystack :?
I can’t seem to figure out how to initiate some code to move my player, when it stands on a pad. Both the Player and the Pad are Triggers, and they both have collision meshes. I tried looking at the Third Person Ttutorial, but that raised more questions than it answered 
At the moment, my code looks like this:
var location : Vector3;
function OnTriggerEnter (col : Collider)
{
var controller : ThirdPersonController = col.GetComponent(ThirdPersonController);
if (controller != null)
{
if (audio)
{
audio.Play();
}
controller.transform.position(location);
}
}
Oh, and one last thing, would I attatch the script to the pad or the player?
Thanks muchly!
Thor
1 Like
A trigger is just a way of using the basic collider mechanics for a different purpose. Normally, a collider… erm… collides with something, which means the objects apply a force to each other. This implies that the engine, internally, has to be able to detect when one collider overlaps another. The same overlap detection can also report when an object has entered a particular area, but without activating the collision force. A trigger is just a collider set only to report overlaps rather than apply a force.
Most solid objects in a game are just ordinary colliders. Use a trigger when you want something reminiscent of the sensor of an automatic door or hand-dryer.
8 Likes
I’m REALLY confused now, managed to get it sort of working. It transports me like I wanted it to, but not to the co-ords i set. I have no idea why, its not like they are even close to the ones I set :S
Heres the code:
var location : Vector3;
var obj : GameObject;
function OnTriggerEnter (col : Collider)
{
obj.transform.Translate(location.x,location.y,location.z);
}
function OnTriggerExit (col : Collider) {
}
Sorry for being such a noob 
Thor
1 Like
Hi,
Did you intend location to be the position you move to?
obj.transform.Translate(location.x,location.y,location.z) will move the object in the world coordinate system by x in the x direction, y in the y direction and z in the z direction.
If you just want to move the object to ‘location’ in the world coordinate system just use:
obj.transform.position = location;
Regards, David
1 Like
DUDE! You are the bee’s knees!! It rocks, mucho thanks!
Two Thumbs Up

Thor