Are triggers triggered before everything is drawn ?
Hello,
I need to make check each frames with a fixed framerate. I check one trigger each frame, if it is triggered then I move the character.
The issue is that it seems (because of what I write in the console) that the trigger is triggered the frame after I can see that the character is in the trigger.
If I do a simple example, here the character is falling and will go through the white bar :
So the next frame it would be be seen in the white bar but it should be moved elsewhere instead (because of the trigger). But the thing is that the next frame nothing happens :
And the frame after this one the character is moved.
I want to be frame perfect, how could I do that ?
Best regards,
rXp
Answer by rXp · Jul 29, 2016 at 08:15 PM
According to https://docs.unity3d.com/Manual/ExecutionOrder.html
OnTriggerEnter is called in the physic part. I change my update into LateUpdate to avoid any issue but my problem is still here.
The collision is detected one frame too late. The rigidbody is NOT sleeping (checked that more than once) and the two collider are really on top of each other.
So I'm really lost here.
Edit : I've fixed the issue. My stupid error was to update the character position in Update or LateUpdate. So it was moved in the collider after the trigger. Now I move it in FixedUpate and correct the movement in LateUpdate. Don't worry about the weird movement because I use frame count to compute all the movement.
Your answer
![](https://koobas.hobune.stream/wayback/20220612085755im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Do something after the next physics step (not the frame) 0 Answers
Setting a collider to active does not trigger collisions with nearby objects 1 Answer
2D Sprite Frame Skipping after upgrade to 5.6.1f1 0 Answers
check every frame if collider entered the another collider or not 1 Answer
Bullet Firing Every Frame 2 Answers