How to create 3D Widget with drop-down options?

So, since our last mesages I managed to fix and update a few of the forementioned issues.

The weird shading behind the transparent plane was due to a setting in the transparent raytrace settings.
I managed to get the plane with the circle mask texture to face the camera at all times.

Now I would like to implement the “FocusPoint” blueprint that I created, and add it to the Car Blueprint. Is that a thing? I tried, and it sort of worked, but I got the following error:
AttachTo:


'/Game/Levels/UEDPIE_0_MainStudio.MainStudio:PersistentLevel.AI_McLaren_C_1.BP_FocusPoint_V3' is not static  (in blueprint "AI_McLaren"), cannot attach '/Game/Levels/UEDPIE_0_MainStudio.MainStudio:PersistentLevel.BP_FocusPoint_V2_GEN_VARIABLE_BP_FocusPoint_V2_C_CAT_95.DefaultSceneRoot' which is static to it. Aborting.

The Icons/widgets were nowhere to be seen. If I change the mode of the icons to “static”, the error dissapears, but then the icons are stuck in space, where the car starts from.

I want to use these buttons in the car blueprint to open and close the doors.

What do you suggest I do? whats the best solution here?
Weirdly enough the icons are currently displaying way off. Within the blueprint I have one of the icons on the door, the other on the wheel. The Lights that I added to the interior of the car are placed corretly and also follow along with the car when it drives into frame.

I’m also having trouble getting the car to stop at the correct position. At the moment I’m driving it along a path, and manually setting when it uses throttle and brakes. Is it possible to tell it “when at end of nurbs curve, use brakes”? If so, how?

Hey @Grimgorkos1
ok some questions pilled up here, going step by step through them and trying to just answer one per post:

Yes, I prefer working like that as well. Normally you would then use a script to write it back to the asset to then be able to use your assets in a BP. e.g. Blueprint code in EUW (Editor Utility Widget)


or by code:

c++

USelection* SelectedActors = GEditor->GetSelectedActors();
TArray<UObject*> ActorsAsObject;
SelectedActors->GetSelectedObjects(AActor::StaticClass(),ActorsAsObject);
TArray<UStaticMeshComponent*> SMCs;
for (UObject* Object:ActorsAsObject)
{
AActor* Actor=Cast(Object);
if (IsValid(Actor))
{
TArray<UStaticMeshComponent*> Components;
Actor->GetComponents(Components);
for (UStaticMeshComponent* Component:Components)
{
UStaticMesh* StaticMesh=Cast(Component->GetStaticMesh());
if (!IsValid(StaticMesh))
return;
TArray<UMaterialInterface*> MatFromSMC=Component->GetMaterials();
TArray<UMaterialInterface*> MatFromSM;
for ( const FStaticMaterial& Material:StaticMesh->GetStaticMaterials())
{
MatFromSM.Add(Material.MaterialInterface);
}
if (MatFromSM!=MatFromSMC)
{
for (int Index=0;Index<MatFromSMC.Num();Index++ )
{
StaticMesh->SetMaterial(Index,MatFromSMC[Index]);

        }
     }
  }

}
}

Common practice in automotive:
It’s depending on which information you get upfront, working in pre-vis or with final constructed engineering data already makes a huge difference. If possible you would try to get the information from the source data (PLM), which material is assigned. But processes and department structure e.g. color&trim with excel sheets, make your life hard and you will end up with the manual approach you described a lot of times.

1 Like

It’s the default pawn which probably takes care for you of the movement and rotation you experience while in play.
image
In the DefaultPawn.h file you will find the corresponding functions:

Short extraction defaultPawn.h
     /**
 * Input callback to move forward in local space (or backward if Val is negative).
 * @param Val Amount of movement in the forward direction (or backward if negative).
 * @see APawn::AddMovementInput()
 */
UFUNCTION(BlueprintCallable, Category="Pawn")
virtual void MoveForward(float Val);

/**
 * Input callback to strafe right in local space (or left if Val is negative).
 * @param Val Amount of movement in the right direction (or left if negative).
 * @see APawn::AddMovementInput()
 */
UFUNCTION(BlueprintCallable, Category="Pawn")
virtual void MoveRight(float Val);

To counter that, you can create your own pawn, or overwrite / bypass the functionality. If you look into the carConfigurator example in the lvl Blueprint you’ll find as the first statement to hide the pawn
image
Doesn’t disable it, but later on in the BP_Configurator they use the same buttons to steer the ‘current camera’.

For Reference

So in a nutshell, there is still a pawn in the scene, which is actually not used, and all controls are handled separated as well and control the camera. In here you could add delays or whatever to let the user only interact if he is allowed to.

Depending on your workflow and how you set up your initial import. In bigger companies this is the first thing to be customized out of such issues, but UE would need to know where to get the information from.
So the easiest solutions would be, to import as many individual parts as possible and only reload the ones which got changed, writing scripts to handle your changes and write them back to the new import or store information separated somewhere else.

You could get your spline and get it’s length to determine how much space it’s still left (just some of the functions you might want to use):

I’m not completely sure what you’re doing. If your McLaren is already a BP and a Actor of some sort in your scene, you would probably attach your ‘icons’ (probably planes?) in the component tab of the already existing McLaren BP to have them always aligned with your car, even if it’s moving. If they should disappear while driving you could just hide them. :thinking: Don’t know if this helps, if not I would need more information what you’re doing.

First of all, thanks again for taking the time.

Here’s a quick update on my current situation:

I’ve changed the animation setup to use a branch with a “LineTrace”, so the car uses throttle when the game starts, and when the car’s line trace hits an obsticle, it switches from throttle to brakes. That works pretty well so far and gives me the control I need.

Regarding the material setup, I imported the FBX as a skeletal mesh and applied all of the materials to the skeletal mesh directly. That made things easier to handle as I only have a single mesh to worry about in my blueprints.

Regarding the Focuspoint, I tried to add the focus point blueprint into the components list of the Car blueprint, and (in theory) it worked, however when playing the game, they would not show up when set to “movable”, and when I set the Focuspoint blueprint to “static” they would spawn where the car originalyl stands, instead of driving onto the platform with the car.

To clarify - when set to “movable” the Focuspoint is visible in the viewport, at it’s correct location:

But when playing the game, It’s at the centre of the scene:

it also spits out the followign error:

AttachTo: ‘/Game/Levels/UEDPIE_0_MainStudio.MainStudio:PersistentLevel.AI_McLaren_C_1.BP_FocusPoint_V2’ is not static (in blueprint “AI_McLaren”), cannot attach ‘/Game/Levels/UEDPIE_0_MainStudio.MainStudio:PersistentLevel.BP_FocusPoint_V2_GEN_VARIABLE_BP_FocusPoint_V2_C_CAT_0.DefaultSceneRoot’ which is static to it. Aborting.

Finally, something that has been worying me is the following statistics:

From what I understand, it’s apparantly trying to call 180.000 different objects? That cant be right? Alo 6GB of memory also seems quite steep, right? Any idea what could be causing this, and how to fix/optimize the performance?

where is the attach to command, shown in the log, coming from? Can you add a screenshot of your components tab, what object you try to add, or do you do this entirely by code?

Where can I find the statistics bar you’re using? I normally use Tools->Audit->Statistics to start my hunt for frames. After that the GPU visualizer [ctrl][shift][,] and if these don’t tell me anything interesting I use Insights. But yes your obj count looks strange, let’s first figure out what objs are counted.

That’s coming from the FocusPoint blueprint that I added to the McLaren blueprint.
This is what the blueprint Components Tab looks like:

Regarding Stats, I get those from the Editor Settings:

These are the stats I get from your suggested “Audit” window:

I managed to get the door to animate open (after a lot of research and banging-in my head) using “Event BeginPlay”, however, I would like to trigger the door open/close using a button in the UI or using a “Focus Point” on the door. Any idea how I would get that to work? Doesnt seem to work as expected on my end.

When I use my own Custom Event “OpenDoor” nothing happens. I have the event linked to a button in the UI:

I can reproduce it and the behaviour is strange. Let’s see if I can find something about that, but probably next week.

Thanks, I’ve seen the stats window quite a few times but never used it. Have to figure out what the ‘Objs’ means but it’s already as high in an empty level (around 127k). The stats window in your case looks ok’ish. There is always room for improvement but for a standard car configurator not alarming.

To your animation. In the screenshot you’re just setting some kind of variable that looks like a pawn? You would need to call the actual event you created (blue markings). If this event is in a different object = blueprint, you would need to get a reference to the object and call the event in there.

1 Like

Sure, having some info on that would be great, but glad to hear that my stats seem okay for now, thanks for checking!

EDIT: I found a post about this. It seems that they are “unreal Objects” that do not only include meshes, but all components needed for the scene. See here:

You would need to call the actual event you created (blue markings). If this event is in a different object = blueprint, you would need to get a reference to the object and call the event in there.

Right, that’s what I’ve been trying to do. Im not sure if I’m doing somethign wrong or if i’ve simply not understood the system just yet.

In my brain, the Custom Event “Open Door” action within my BP_Mclaren is an input that will execute the nodes behind it, causing the door to open.

So my Idea was to reference the custom event “Open Door” in my button and send the info “okay go, open the door” to the custom event. Is my thinking off?

From my understanding above, the screenshot you made of the blue nodes would need to be added into the Focuspoint Blueprint, correct?

You are on the right track but your custom event is called ‘Open R Door’ the ‘Open Door’ in your case is a rotator variable, which is updated if your animation is running and represents the lerp of the two rotators, so probably the current rotation state of the door. This variable that is not used is the one your setting in your click event, but it’s the event ‘Open R Door’ you want to call.
If your button is not in the same class as your BP_McLaren you would need a reference to that object up front and call its custom event ‘open r door’. How to get the reference to the BP_Mclaren would be up to you. You could either get all Actors from the scene and cast all against BP_McLaren, the one not failing would be the correct one. If your button bp are nested in the BP_McLaren you could traverse up; get a selection etc. But somewhere you would need the reference to it. Or you would need interfaces but that’s a bit harder to understand for new users to oop (object oriented programming).
Thanks for the link.

Thanks, that’s pretty much what I’ve done now (with some help from the “Unreal Slackers” Discord).

So, doors are able to open and close now using a button in the UI. I might change that later, but at least I understand this approach now.

1 Like