Be the first to post for 'Widgets For FVector Properties'!

If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.

nice editable widget

… shame no option to have it display as global coord

I’m a little confused as to why if TargetLocation was a vector relative to the cube we didn’t just take the normal of that and move the cube in that direction like this:

FVector ActorLocation = GetActorLocation();
FVector NewVector = TargetLocation.GetSafeNormal();  // vector is relative to cube, so normalize it and move it
ActorLocation += NewVector * Speed * DeltaTime;
SetActorLocation(ActorLocation);

If we want to use the editor uproperty gizmo/widget to represent our moving platform destination, then we must use its value like the editor uses it, as location derived from an intended local/relative coordinate.

They must have special world actor components only for use in the editor, and perhaps like the Transform gizmo it relies on a local space to display. Only a guess though, but one way or another, its behaving much like a UActorComponent in relative space, using the FVector we set to display its (editable) location.

The editor location is derivative thus cosmetic so to use our Vector like the widget shows it we must use the vector/coordinate as its derived, like it were a relative location we need to covert to global space. Its otherwise using the wrong global coordinate that we want to use. We instead want to use a global coordinate based off a relative location in reference to the static mesh.

What confused me in the lecture was :
GlobalTargetLocation = GetTransform().TransformPosition(TargetLocation);

Because get transform looks like its going to get the Actor Transform, but instead it appears to be some kind of library for getting transforms xD. You can’t use FTransform or FVector since those structures cannot access the world and only store data. But we are not just getting actor transform, we are taking a location and converting it to local space. (or wait actually, we are going backwards and giving it a supposed local location?)

This is an untypical conversion since the vector does not have a transform, it IS a transform(position). So we cannot get Actor Transform of the Vector, so instead we have to get the transform of a conversion from a supposed local to global, specifically only of a position, thus GetTransform and Transform Position.

This is how i saw it :stuck_out_tongue:


I do recall a lecture from the Unreal Course, where we used a UPROPERTY array of actor references as waypoints.
There should be a way to tell the target location to derive its coordinate from an AActor* reference that we can set in the editor, or perhaps even telling it to scan for for one or otherwise spawn one for us if there is none set. (which there are other calls to do this that I do not remember, maybe @sampattuzzi does :thinking:)

This way we would get a more conventional/standard approach at which we derive another actor’s global location as the target location, so that the level designer can choose a location for the drone to go to, or use a dummy object to set it. We are almost providing a useful dummy object for the designer with this method to manually set the location, because of this “Meta = (MakeEditWidget = true)” uproperty parameter that most of us havn’t heard of before! .

Good review to start with at least for people like me who forgot everything in unreal but I also thought this one needed a little more clarity.

I didn’t think of doing it this way. Very neat!

I’m not sure I completely follow but I will try:

GetTransform() should be getting the current actors transform. Why are you concluding otherwise?

This is absolutely possible. I just thought it was much more work than converting local to global coordinate. I felt the MakeEditWidget was a neat solution and an opportunity to teach a new engine feature.

It was a nice alternative technique to see.

But if GetTransform() does return the actor transform then whats the variation from GetActorTransform() ?

I figured it must be for getting the conversion of a specific coordinate from local to global space. Which well, that’s what its doing isnt it? But they only included with GetTransform() … Maybe I should look it up

GetActorTransform and GetTransform are synonymous. The conversion from local to global has to be for something, it can’t be done generally else what is it local too?

Privacy & Terms