How do you set the world location of a UObject upon construction?

I used both:


NewObject<UObject>();

and


ConstructObject<UObject>(UObject::StaticClass());

to create a (an?) UObject.

I was wondering if there is a way to set the location of this UObject in the scene (world? level?).

Thanks in advance.

EDIT:

This image shows that the UObject holds a FVector that stores the location in the world. I cannot see a way to set the location, since the class member is private, and I don’t see any setter functions for setting the location. It is this part right here that I am confused with.

Actually, since AActor and all his subclasses are supposed to be the “placeable” objects in the level, I don’t think you can even talk about location of a UOject. Why don’t you take a look at Object.h from the repository on GitHub Object.h (I took a look and didn’t found Location vector in there).

As Sneppy mentions, only actors are considered “placeable” and come with built-in location management. Internally, this is done through the actor’s root component and scene components in general. UVehicleWheel’s Location is not the same as a scene component’s location, it is only used internally by the vehicle system. Setting that location would involve properly using the vehicle functionality.

OK, if Actor and all subclasses of Actor are the only objects that are “placeable” in the world, then I will resort to using Actors.

Well, I assume you were using VehicleWheel for a reason? If you need the functionality that’s in there, it might be more productive to use the engine’s vehicles than to roll out your own.

Yes…?

To be honest, I am not really sure where to go from here. Our team is tasked to create a vehicle, but I am a novice in Unreal Engine 4, and have mastered the QuickStart tutorial. I was just playing around whether or not I can spawn a UObject and put it in the world.

Then try subclassing AWheeledVehicle instead – that’s the class that uses UVehicleWheel. Looking at VehicleWheel, it seems to only contain physics logic, so most likely that’s only used for the vehicle movement simulation rather than the visuals and positioning of the actual vehicle actor.

While AWheeledVehicle has basic movement logic as well as a mesh, it doesn’t have much more than that – odds are you’ll have to write your own logic to spin the wheels, turn them, etc. if you want that behaviour.

Okay, thanks for a board-splitting lead.