@Everynone Hey i just followed your steps and made a video. But stuck at the last phase. please check the video and give your suggestions.
Yes, sorry i missed that…Do we need the construct NONE also or just the below get widget only
Either construct a widget or use a widget component, not both. The component creates the necessary widget from class, shows it and maintains its lifecycle, too. If the component gets destroyed, it will get rid of the widget it was showing. Free of charge.
The goal of a widget component is to actually render a widget onto a quad and show it in 3d. We talked briefly about showing a widget on a cylinder or sphere, afair.
But it can also do Screen Space, as in your example.
This is somewhat similar to a static mesh component:
- static mesh components handles a static mesh
- widget component handles a widget
I added the widget as a component as you showed above. Do i need to map the widget to anything because when in play mode it is not showing. Again attaching the video reference. Thanks for your help as i know i kind of asking too much…
The component Tick Mode
needs to be set to Enabled
- it’s set to Automatic
.
Thanks it worked, basically i guess this method is similar to HUD as it draws on the screen and also moves when the camera spans. It will be awesome if there is any method available to set the camera location as the starting point of the line…
There is. But it depends on what you mean by camera here.
The centre of the sceen / viewport - the camera we’re looking through? Or the camera attached to the car. There can be many cameras we do not necessary use atm. They’re just components to whose point of view we can switch.
I mean camera_Front, which is a component of the sedan blueprint. I need to start the line from the exact location of the camera_Front…
so by transfer to widget, you mean using variable as i done in the video: https://youtu.be/rNcDhlFt1Jk ?
Not really.
- use a regular widget as suggested here (not a widget component you gravitated to):
A component, even in screen space, will eventually give you grief when attempting to account for aspect ratio and it will make other calculations cumbersome.
- promote the points array in the widget to a variable
- do note that you may need more than one line, two lines may be enough (can this shape be drawn with 1 line without overlapping?)
- calculate the necessary coordinates in the sedan, send the whole array to the widget
in short:
- paint from array(s) here:
- calculate it in the Sedan (pseudo-script):
If you like math, rotate forward vector of the camera to get the rest of the coords. If you do not like math all that much, attach dummy components to the camera and offset them - use their world coords for projection.
This needs to be updated every frame, tick executes once per frame.
Thansk and now a new issue came. Does the variaable from the array shouldbe same name as we created in the widget ? And where did the target came from ? can’t able to figure it out.
It’s not about having the same name - it’s literally the very same variable. You are accessing a variable that belongs to the widget:
Thanks to a widget reference, Sedan actor can Target
another piece of data → Points
in another blueprint. This is the very cornerstone of blueprints communication, oftentimes referred to as Direct Communication:
Yes i got that points-…Bascially we are copying the camera_Front position to the array and creating a variable called Points…Then the same variaable is accessing from the widget…i got doubt with the ‘As W Lines’ and the target in the promote variable. Where do you get the target while promoting to variable from the array ? ( as marked as red circle in the above image)
This has nothing to the with promotion.
Drag wire, search, click Set Points.
Please consider going either through some tutorials or the documentation covering the basics. Whatever time you spend (invest!) on studying those now will save 10x more in the very near future.
Hey Thanks for the help…after some playing around i finally found it. But while playing, the camera_Front position keep on changing and due to this line appears kind of sloppy. Do yo have any comment for this ?
It’s not changing, it’s clearly still. The car is not moving, the camera_Front is not moving.
What do you mean by sloppy? Sluggish, lagging, delayed or? And it seems you’re still using a widget component for this… You’re not going to like the math that it takes to translate something into the component’s relative space.