Can onTriggerEnter be called only on the fixed update?
Hi! I am currently trying to sort multiple gameObjects vertically on the screen. (Imagine having a bunch of notecards in a pile in front of you, and then moving them up and down until no notecards are stacked anymore).
My current approach to this problem is use the onTriggerEnter2D function to detect collisions, and if I detect collisions, I use a certain algorithm to move one or both of the gameObjects some amount. This 'step' may or may not move the gameObject out of and into a collision with another gameObject or keep it in collision with the same GameObject. (I hope that was clear).
Regardless, my current problem is that the onTriggerEnter2d function is called only on the Fixed Update, therefore, it is missing all the changes I make during my 'steps' and not letting my algorithm know when to stop moving the GameObjects.
I have attempted both changing the algorithm to run in the onTriggerEnter2D function, and creating my own collision detection system, but neither of these are working out for me.
Thanks!
try changing the rigidbody collision detection to continues, if that doesnt work you couñd also increase the frequency of the trigger in the project settings > Time > Fixed timestep, but the default 0.06 should be frequent enough
Your answer
Follow this Question
Related Questions
Not detecting Collision 1 Answer
Problem with DontGoThroughThings script 0 Answers
Prevent Player from passing through walls 1 Answer
Apply force over time 1 Answer
Rigidbody2D.Postion has not moved object even after many Fixed Updates. 0 Answers