0 votes

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?

Godot version 3.2.2
in Engine by (25 points)

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.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.