Skaruts / racing_cameras

A set of cameras well suited to racing games.
MIT License
7 stars 0 forks source link

Chasing camera sort of stottering #2

Open renzo-massaro opened 2 weeks ago

renzo-massaro commented 2 weeks ago

Hi, when I use the chase camera it is not fluently riding when going fast. If I change it to orbit it is 100% fluently. Am i doing something wrong maybe or is it a known issue?

Skaruts commented 2 weeks ago

Hello. I can't really reproduce this issue.

Does it also happen to you when you play the example scenes included in the addon?

renzo-massaro commented 2 weeks ago

Yes even in your example I see it also but not always so then I think it is something at my side. When you drive strait you see that the camera wants to change position and that looks stottering. Other cameras no problem so I dont know why this one do that.

It looks like the camera constant want to change or focus the distance.

Skaruts commented 1 week ago

The chase camera is the only one that calculates interpolation for the distance to the car, so it's the only one that could have these issues.

Can you reproduce the issue in a completely new empty project? As in just: start new project -> install the addon (and turn it on in project settings) -> run the example scenes.

If not, then it might be a problem in your current project. And in that case, if you could send me your project or link me to a repo, I could take a look at it, to see if I can figure out what could be the issue.

renzo-massaro commented 1 week ago

I will try this evening. Maybe I found something because when I drive the car in that level which is on a Terrain3D ground I see that FPS is mostly around 55 and I read that under 60 it could jitter?

I will try something if I can raise the FPS somehow and see what happens then.

renzo-massaro commented 1 week ago

I found it, was my worldenvironment what was not good. I already saw the fps was bad and I searched why that was. Now a new worldenvironment created and the fps stays good. The car is now acting like it should. Sorry for the misunderstanding. Your cameras are working great :)

Skaruts commented 1 week ago

Nice to hear. :)

I'm gonna leave this open for now, until I take a deeper look at the camera code. I don't think this should happen even with low frame rates, so there might still be something wrong there.

renzo-massaro commented 1 week ago

I also are testing with different other interactions like with simplegrasstextured and especially the interactive part that grass is gone around the car. You have to disable a layer on the cull mask so the camera wont see a particulair mesinstance. Only the orbit camera disables this, other cameras will not disable the view of it. Have to figure out why.

renzo-massaro commented 1 week ago

Screenshot 2024-10-27 134527

It looks like disable a layer of 3d camera not working, am i right?

Skaruts commented 1 week ago

Ah, yes, most of the cameras use an internal camera object for their actual effect. They only inherit from Camera3D because some of them (e.g. the cockpit camera) don't use child cameras, but still require previewing in the editor.

https://github.com/Skaruts/racing_cameras/blob/eb2af2d3a7a07e8e09169bc093aba8942fbb5c4c/addons/sk_racing_cameras/src/cameras/race_cam.gd#L50

So, currently, you'll have to change the internal _cam settings (through code) to achieve that kind of thing. At least for some of them.

I'll see if I can figure out a way to expose the internal camera's settings, somehow.

renzo-massaro commented 1 week ago

I thought this would help:

func setCullMaskValue(): _cam.layerNumber = 17 _cam.value = false

0r

func _set_cull_mask_value(): _cam.layerNumber = 17 _cam.value = false

But I am wrong :(

Skaruts commented 1 week ago

Try this function:

https://docs.godotengine.org/en/stable/classes/class_camera3d.html#class-camera3d-method-set-cull-mask-value

renzo-massaro commented 1 week ago

Thanks,

If I do it in the _on_ready it works:

func _on_ready() -> void: _cam_pos = Vector3(0, 0, default_distance) _cam.position = _cam_pos _pivot2.rotation.x = deg_to_rad(-25) _cam.set_cull_mask_value(17, false)