Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | wildcard |
I want something akin to a laser sight for my pistol model that will be used in a 3rd-person game and to do that I intend to use ImmediateGeometry or something like that, the only problem is that I have no idea how to do that. Does anyone have good suggestions for that problem?
It could be done easier than with ImmediateGeometry:
Make Spatial → MeshInstance hierarchy. Make this mesh to be a f.i. cylinder with height = 1.0 and then offset it like Y+0.5, that its bottom located at parent Spatial origin.
Then you should point that Spatial to the target like with look_at()
or as a child of weapon and apply scale to that axis according to the target distance like
laser_ray.scale = Vector3(1.0, distance, 1.0)
You may also need a RayCast
to know exact distance and to don’t allow your laser to penetrate through rigid objects.
sash-rc | 2021-09-07 16:51