Edit : And this guys is How I waste My time in game Jam
Hello guys, it s me, you probably already know me for my 0% submission rate at game jams so far.
Just Kidding.
So I have a problem and I m not sure How to research my answer in Google so I thought I could give it a try here.
So I have a empty GameObject which is supposed to move in FixedUpdate using the simple code below.
Further ahead I have a trigger wich set StopMoving to true.
My problem is that before the objects even start moving StopMoving becomes trues, as if it was moving really fast on the whole "map" triggering everything that can be, before starting the game at (0,0,0 ).
The thing is I already encountered this problem in a previous project also using transform.right to move my gameobject, at the time I was thinking it might be due to a bad script execution order.
In this previous project my main character went and took damage from every single ennemy before the game even started.
That or he took a few hits from a single ennemy.
The difference between these two options is :
1: the object doesnt teleport but move really fast and trigger everything in its path.
2: The object tp in a spot then is reset.
I think it s option 1 because in this project my ennemies had a cooldown for every attack.
Anyway in this previous project the problem appeared very late in the developpement while it appearded early on this prototype, furthermore, removing then replacing the trigger in the scene seems to have make things work as you can see here :
The object moves then stops when it reaches the trigger as it was intended to.
If you guys know what is the cause of this problem so I can avoid it in the future it would be appreciated.
I was thinking that maybe it was related to my use of Time.deltaTime since in the few examples using transform.right people wern't using it, but it s just a blind guess from a guy with very little knowledge.
I hope you can help me, and also that yo re having a fun Jam.
Edit : Ok, I don't know why I didn't say that but my empty GameObject is parent of another object wich has a rigidbody wich allow me to trigger the "stopMoving" . I talked only about the empty one because the rigidbody is moving by following his parent. But it could be that the child is the one who move independantly and trigger the "StopMoving".