Enemies shaking on the spot

My Enemies just shake on the spot with out moving from side to side.
Here’s my code:

Please help :frowning:

Hello @Noah_Seethor, how are you?

Can you send a screenshot of the EnemySpawner inspector? It is probably running the movingRight = !movingRight every frame for some reason, if you change the inspector mode to debug and take a screenshot of it while the game is running would also help (you can change this option in the dropdown menu that appears when you click in the three lines symbol in the top left corner of the inspector window)

In the next video he fixes a bug where the enemies get stuck halfway outside the screen. maybe you should watch it to see if thats the same problem your having. :slight_smile:

2 Likes

This is the same problem i had earlier and had created a post. @Joao_Dalvi cleared it up. Here is the post. click on the link to read the full post:

and as @F-J-Valentin mentioned, the issue does get brought up in the next video.

1 Like

Here’s a video I took

I had the same issue. Turned out my enemy formation was wider than my camera view.

Edit: It fixed it for a minute, but now the “trembling” is intermittent. xMin and xMax are reporting 10.1 / -10.1

I’m having the same issue, didn’t find a fix yet.

Edit; fixed it, when copying a line I forgot to update it with other values:

Vector3 leftBoundary = Camera.main.ViewportToWorldPoint(new Vector3(0,0,distanceToCamera));
Vector3 rightBoundary = Camera.main.ViewportToWorldPoint(new Vector3(1	,0,distanceToCamera));

in the second line I still had Vector3 (0,0 etc instead of 1,0.
Dumb mistake :stuck_out_tongue:

Privacy & Terms