Viewmodel issues

This is what a normal viewmodel would look like.

Aiming works fine.

But the viewmodel goes through the wall.

However there is a fix to this. Make the viewmodel really tiny.

Screenshot 2023-05-24 010546

And the viewmodel doesn’t go through the wall.

But now the model looks messed up while aiming…

The aiming happens procedurally with cframe math.
Even the bobbing, swaying works perfectly fine while also taking the scale into account.
And for the scaling of the viewmodel I use the new model scale API:

It looks to me that the camera is phasing trough the model a little bit which causes some parts of the gun to become invisible or cut. I don’t know how to fix the model weirdness while aiming. Any help is appreciated, even small leads, or things to research on.

p.s. i posted in scripting support because i think thats the issue…? im not sure, maybe its the model texture or appearance or that stuff (which i clearly do not understand)

1 Like

Yeah seems like a rendering issue either with the model or camera. Never faced this problem before.

Just curious have you tried changing the camera fov, focus, or any other related property?

Interesting solution to the viewmodel problem though. I think another potential solution is to increase the collision box on the character.

2 Likes

@dthecoolest is most likely right. it seems to be a problem of the viewmodel being too small, so the camera has trouble rendering it. try scaling it slightly larger.

heres some reading by egomoose which should address your problem.

2 Likes

What ego moose is doing is exactly what I’m doing. Taking the scale in consideration while offsetting.


Even with a little larger scale, the aiming gets better but then the clipping resumes bit by bit, is it just better to take that. Considering players probably won’t always hug walls?

i think that may be the best you can hope for unless you want to use viewport frames, which i dont reccomend (bad lighting and stuff). the problem is that

too small->clipping into camera
too large->clipping into wall

you may have to just strike a balance in between that.