Weird frame drops when looking at the ground in fps game

hey,
Lately I was working on a fps game, but for some weird reasons whenever I look at the ground the frame rate goes down to 5-10 straight while its fine when I’m looking around.

Here is a Like to project

Hi @Explicit and welcome,

Looking at the profiler while looking down I can see your physics/update times suddenly increase way above average:

image

Check your logic/code and try to isolate what you may be doing at that particular instant.

Hello sir,
Thanks for your reply, I don’t think I have any special code for the instance when the player is looking at the floor is there any way to find what part of the code is causing this issue?

Hi @Explicit! I was unable to debug your project as it start with erros and your fps.js script doesn’t seem a common script to me. You can try to remove the texture of the material you use for the ground entity, to see if that helps.

hey @Albertos! I the fps.js is just the script to see show the fps on that top left side which I took from here I tried removing the material from the ground tho but its still not fixing the issue

The reasons is because you have a mesh collider on the gun and when looking down, you are moving it near/into the floor.

It’s expensive to work out collisions between a moving mesh and other objects. If you disable the collision of the weapon, the problem goes away.

If you must need a collision, use a primitive instead.

2 Likes

That fixes the problem, tysm sir!