![]() ![]() You could write an image effect with a shader to generate your line. ![]() There are several other ways to achieve this (both good and bad) and it really depends on the kind of visible line that you want. If you're looking for a line in 3D space in the game view, you might consider using paricles (see Line Renderer or Trail Renderer). If you're looking for information in the scene view about your raycast, you could use Debug.DrawLine. What do you mean by a visible line? This is well documented regardless of your meaning in the answers and forums. Using the llider or hitInfo.rigidbody, you will know what was hit. This is the physics raycast, but there are other variants which may better apply to your use case depending on what you want to collide with.Ĭalculate your gun's direction, the point your gun is firing from and the distance it can fire, then call `Raycast(gunOrigin, gunDirection, out hitInfo, gunRange, layerMask)`. See the script reference for raycast which has example code. Also, there are several questions that you're asking and they should have been split up: How do I use raycast? How do I draw a line? How do I create an explosion? Raycasting If you want to create your own solution, this is fairly well-documented in the docs, forums and other questions. It is simple and doesn't require too much work. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |