- Home /
Interpolation through a Trigger at runtime
I'm having problems with making triggers work when I move through them in game. The game is meant to be turn based, so movement is produced by a grid of transparent squares encircling the player, and the player moves to the square that is clicked on via linear interpolation. I have various pickups and traps that are set up as triggers around the level, but for some reason when the player passes through them, they don't trigger. However, when I START the player inside the trigger, or any other object for that matter, it will set off the trigger, just not in run-time. I have the code placed on all the triggers,the triggers all have a rigid body, the player does not. They both have box colliders.
This is the code for a random trap, very basic.
function OnTriggerEnter(other : Collider){ print("collision happened"); if (other.tag == "Player") { other.GetComponent(Player).Die(); } }
if anyone could let me know why it won't trigger when the player Lerps through it, I would really appreciate it. Thank you.
Do you want to try it WITHOUT rigid bodies on your triggers? And if that fails, perhaps with a rigid body on the player ins$$anonymous$$d?
That's just a guess of course, but I know that certain objects don't interact quite the same way when you make them Rigid Bodies.
You should only make objects that really need actual physics and/or gravity use the RigidBody component - most stationary or static objects in your scene don't need it.
ahh it appears to work if theyre both rigid bodies, I was trying to avoid using rigid bodies due to my player interacting with objects funny and getting knocked off his course etc. but i was just made aware of the "is kinematic" check box and what it actually does. thank you.
Answer by sparkzbarca · Nov 13, 2012 at 01:53 AM
your not lerping in FixedUpdate.
mark as answered if fixed please.
Your answer
![](https://koobas.hobune.stream/wayback/20220613083755im_/https://answers.unity.com/themes/thub/images/avi.jpg)