What are the methods avaiable to draw lines in unreal engine?

Yes in my case the lines must be occulded as it will be beginning from the front of the car i.e from hood. So while viewing it must be occulded and only show it fully when i chnage the camera angle. So i think i can’t able to use HUD and UMG as it always are on top of the screen, am I right ?

They draw on top of geometry, yes. And HUD actually draws on top of UMG if I remember correctly. HUD and UMG are 2 different things - just to clarify.

2 Likes

Thanks for the clarification.

Is there any way i can extend the creation of spline with c++ ? Do you have any idea as i need to iteratively change the values of the rectangle while simualtion starts?

Yes, you can. It’s all dynamic. Luckily, YT is choke full of spline tutorials.


One note, since you’ve yet to dive into UE4’s splines, when the coordinates of spline points are updated, the mesh that represents a spline segment (via a Spline Mesh Component) does not follow and update automatically.

If you alter the spline, you need to adjust the meshes. This is generally a non-issue unless you decide to do it every frame for 100s of cars. It’s not exactly cheap under those circumstances.

1 Like

Now I got a slight confusion. When we add a spline component, does the spline mesh creates automatically and attaches to it or do we need to create a spline associated with thr spline.

“If you alter the spline, you need to adjust the meshes.” - Here I got the doubt.

Spline is a component and can have many points. For each pair of points, you will need a spline mesh component. For the white spline here:

You’d need 4 spline mesh component. They can (and should!) be added dynamically. Do look up tutorials - this is a topic that has been covered extensively.

Thanks for the long talk and giving the information. So in short I can add lines in the project using:-

  1. Using lines
  2. Using splines
  3. using particle beam
  4. Using HUD and UMG
  5. Using wireframe material
  6. Using procedural mesh
  7. Using material

I guess these are the methods available and for my application spline is the best method to proceed. You can add any final comments if you have. :smiley: :smiley:

Material, you could draw lines directly in material:

Since it’s a material, you can slap it on anything you want - texture the sides of your projection pyramid, for example; and since this is a shader, it’s very efficient and immensely customizable.

An approach that takes a lot of upfront work, though.

Yea I updated the list based on your comment. Hope using the material doesnot affect the physics as i mentioned earlier.

It has nothing to do with physics. Disable collision on the mesh that represents the projection:

Thanks i will try and get back to here if got stuck in between. Thanks again for your help and time :star_struck:

1 Like

I use a Procedural Mesh Component and wireframe material for a similar effect. In the material, I mask the inner edges of the polygons to avoid triangulation.


2 Likes

You used procedural mesh and wireframe material together for the pyramid or just the procedural mesh for the pyramid ?

I create and modify a pyramid with a procedural mesh. Wireframe material shows needed edges.

1 Like

Yea thanks for the insight. This is a completely new method for me and thanks for sharing. I will try once

Hi @Everynone

I got a doubt in the continuation of the topic. How can I get the location of a component attached to a blueprint. I want to start the line from the location where i attached a component. How to get that location ?

image

Depends on whether we’re working in world or relative space.

1 Like

If you have a ref of your component, get its world location:

image

1 Like

@Supremative Yes thankS i got that and do you have any idea what to give in the context of draw line as without it the line is not visible.

You can’t convert it like this. If the Component is at 25000, 25000, 0 and you point the camera there, you can see it in the viewport, sure. But if you try to draw a pixel at 25000, 25000 - there is no such pixel. Your monitor’s X ends at what - 1920 or 3440?

Try this:

There’s 3 or more nodes that do almost the same thing.