Bullet trajectory

Hello, i’m new to unity and c# and i’m trying to create a vr shooter, i would like to create a preview with a line renderer of the bullet trajectory (straight line) which disappear on the collision of the bullet with a wall or a player. Is someone able to help me with acual code ? thanks in advance

Use Physics.Raycast to find where the line will intersect with an obstacle (or not). You can just use the origin of the ray and the hitpoint of the ray (or if no hit, then just a point n distance along the ray) as points for the LineRenderer.

That’s not how this forum works. You write the code, you run into issues, you ask here. :slight_smile:

If you have no code, start with youtube tutorials. Doesn’t even have to be VR. Just understand what you’re trying to do… it’s very simple and common in games to do this so there are plenty of examples to learn from.

If you have an actual issue with actual code, how to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

Oh, I’m sorry, I didn’t mean it in this way, I didn’t want a full code or something like that just small function example to guide me on the right way.

thanks you i will try