iTween_OnTriggerEnter

I’m new to unity and just started using iTween, but what I’m trying to do is if player falls through a collider that is a trigger than shake camera, but I can’t get it to work. Is there something I just haven’t noticed in my code?

I’ve assigned the script to the main camera with a box collider attached to camera and the collider center position is big enough to detect anything that hits it.

private var cam : GameObject;
public var player : GameObject;

function Awake(){
    cam = camera.main.gameObject;
}

function onTriggerEnter (other : Collider) {
    if(other.gameObject.tag == "player"){
        iTween.ShakePosition(cam,{"y":.10,"x":.5, "time":.8,"delay":1.5});
    } 
}

Well, first the obvious- is your characterController tagged with “Player”?

Also, make sure your camera is tagged with MainCamera, or your gameObject isn’t going to be valid.

Why do you have a box collider attached to your camera? are you expecting this collider to cause the trigger, or your character controller?

Lastly- if your trigger moves at all, make sure it has a rigid body attached (just set it to kinematic if you don’t need any physics or gravity applied).

Your iTween call looks okay to me, so that shouldn’t be the problem- it’s most likely one of the things I’ve mentioned above. Try doing some debug outputs on-trigger to find out if the trigger is even happening, and work your way out from there.

Thanks sorry about the confusion. well the idea is my character has rigidbody with a box col. I gave the camera a col to detect the collision don’t ask me why crazy idea I guess. I give that a shot.

I got it to work. I had take a break and man I can’t believe I messed up. Mostly syntax errors.