Override base game static mesh

As the title says, I'm trying to figure out how to replace a base game static mesh with a custom one, but I can't seem to find a way to do this in the documentation. Is this not possible, or am I just being dumb?
84 Replies
Rex
Rexβ€’3mo ago
Do you want to replace any mesh in particular? In some cases (e.g. items), it might be easier to accomplish
The Urban Goose
The Urban GooseOPβ€’3mo ago
My specific end goal is to replace the collisions of the locomotive. As far as I can tell, the collisions of the locomotive are attached to FactoryGame/Buildable/Vehicle/Train/Locomotive/Mesh/SM_Locomotive_LOD4, which is a static mesh. If you check the Locomitive BP, it has a Skeletal Mesh component for the actual train object, and then SM_Locomotive_LOD4 as a LOD object and for the collisions. I've already reimported SM_Locomotive_LOD4 and was able to verify that the collisions on the placeholder object do match the ones in game And I've already edited the collisions
Rex
Rexβ€’3mo ago
Ah, you can use a CDO edit to replace the collision mesh https://docs-dev.ficsit.app/satisfactory-modding/latest/Development/BeginnersGuide/overwriting.html#_use_cdo_manipulation In the Dev branch of the modding repo, there's an example of a CDO edit in ExampleMod
The Urban Goose
The Urban GooseOPβ€’3mo ago
I'm not sure I'm quite following. I've been to that page on the docs, and didn't really understand how to actually use CDOs I'm just gonna work my way through the project setup section of the docs for a 2nd time, and make sure I got everything in there Yeah, I definiteley missed a bit there lol
Rex
Rexβ€’3mo ago
The CDO (Class Default Object) works as a "template", and stores the default values used when spawning objects of a given class.
No description
Rex
Rexβ€’3mo ago
The idea of a CDO edit is to change the values in a CDO, so that objects get created with different initial values
The Urban Goose
The Urban GooseOPβ€’3mo ago
What I'm not understanding is how does one actually set up a CDO modification? Just in general, I flat out don't understand what I'm supposed to do. Do I need to copy the base game file to my mod? Is it all done within some Blueprint? If so, what kind of Blueprint and where?
Rex
Rexβ€’3mo ago
It is done in code
The Urban Goose
The Urban GooseOPβ€’3mo ago
Right, I've never used C++ in UE5
Rex
Rexβ€’3mo ago
Code can be Blueprint too
No description
The Urban Goose
The Urban GooseOPβ€’3mo ago
Time to read the C++ documentation then
Rex
Rexβ€’3mo ago
Ah, I have this screenshot
No description
The Urban Goose
The Urban GooseOPβ€’3mo ago
Yeah, but where is that BP how do I set it up?
Rex
Rexβ€’3mo ago
Make a Game World Module (docs explain how), and in there you should be able to override a function
No description
Rex
Rexβ€’3mo ago
Could also be a Game Instance Module
The Urban Goose
The Urban GooseOPβ€’3mo ago
I... miseed the fact the root game object had a full BP editor Look, it's been a while since I used UE5 lmao
Rex
Rexβ€’3mo ago
It's OK, it happens. Good to know, though: I'm pretty sure it's a rather common pitfall, especially for newcomers
The Urban Goose
The Urban GooseOPβ€’3mo ago
Oh for sure, might be worth appending something about it to the docs? I mean I've been using UE as a hobby since UE4 became available to the public (back when you actually had to subscribe to use it) I just forgor πŸ’€
Rex
Rexβ€’3mo ago
Yes, if you have any ideas feel free to PR any fixes/improvements
Rex
Rexβ€’3mo ago
This button brings you to the GitHub repo where docs are, and from there you can edit the page
No description
The Urban Goose
The Urban GooseOPβ€’3mo ago
πŸ‘ Done Anyways, back to BP editing
The Urban Goose
The Urban GooseOPβ€’3mo ago
This isn't working, do you see any reason why it wouldn't work?
No description
Rex
Rexβ€’3mo ago
You should save the CDO in a variable so that it persists And I'm not sure if the "Set Static Mesh" node is succeeding, might be worth adding a log message (Log Display)
The Urban Goose
The Urban GooseOPβ€’3mo ago
Yep, it ain't going through:
No description
The Urban Goose
The Urban GooseOPβ€’3mo ago
I'm assuming that means I'm gonna learn about Access Transformers now
Rex
Rexβ€’3mo ago
It just means that Set Static Mesh didn't work, no idea why
The Urban Goose
The Urban GooseOPβ€’3mo ago
What about the warning above? LogSatisfactoryModLoader: Warning: Blueprint /BetterTrainCollision/RootGameWorld_BetterTrainCollision, owned by BetterTrainCollision, is accessing CDO of class /Game/FactoryGame/Buildable/Vehicle/Train/Locomotive/BP_Locomotive.BP_Locomotive_C, owned by FactoryGame
Rex
Rexβ€’3mo ago
That warning is expected
The Urban Goose
The Urban GooseOPβ€’3mo ago
Aight
Rex
Rexβ€’3mo ago
It just means you called Get Class Default Object on something that's not part of your mod
The Urban Goose
The Urban GooseOPβ€’3mo ago
Fair
Rex
Rexβ€’3mo ago
Which is not an issue, but can cause surprises (e.g. mods changing values on things without documenting it) Ah, you might need to temporarily change the component's mobility to Movable
The Urban Goose
The Urban GooseOPβ€’3mo ago
The component I'm trying to change is movable by default
Rex
Rexβ€’3mo ago
bool UStaticMeshComponent::SetStaticMesh(UStaticMesh* NewMesh)
{
// Do nothing if we are already using the supplied static mesh
if(NewMesh == GetStaticMesh())
{
return false;
}

// Don't allow changing static meshes if "static" and registered
AActor* Owner = GetOwner();
if (UWorld * World = GetWorld())
{
if (World->HasBegunPlay() && !AreDynamicDataChangesAllowed() && Owner != nullptr)
{
FMessageLog("PIE").Warning(FText::Format(LOCTEXT("SetMeshOnStatic", "Calling SetStaticMesh on '{0}' but Mobility is Static."),
FText::FromString(GetPathName())));
return false;
}
}

/* Actually setting the new static mesh, omitted for brevity */
return true;
}
bool UStaticMeshComponent::SetStaticMesh(UStaticMesh* NewMesh)
{
// Do nothing if we are already using the supplied static mesh
if(NewMesh == GetStaticMesh())
{
return false;
}

// Don't allow changing static meshes if "static" and registered
AActor* Owner = GetOwner();
if (UWorld * World = GetWorld())
{
if (World->HasBegunPlay() && !AreDynamicDataChangesAllowed() && Owner != nullptr)
{
FMessageLog("PIE").Warning(FText::Format(LOCTEXT("SetMeshOnStatic", "Calling SetStaticMesh on '{0}' but Mobility is Static."),
FText::FromString(GetPathName())));
return false;
}
}

/* Actually setting the new static mesh, omitted for brevity */
return true;
}
Either the mesh was the same or mobility wasn't good Might be that the mesh component in the CDO still has static mobility, might be worth testing
The Urban Goose
The Urban GooseOPβ€’3mo ago
Could this be relevane: Mount point: '../../../FactoryGame/Mods/BetterTrainCollision/' is not mounted to a valid Root Path yet, assets in this pak file may not be accessible until a corresponding UFS Mount Point is added through FPackageName::RegisterMountPoint.
Rex
Rexβ€’3mo ago
No
The Urban Goose
The Urban GooseOPβ€’3mo ago
Changing the mobility to movable did not fix it It's also not gonna be the fact that it's the same exact mesh just with different collisions, cause the Uobject still has a different name, location, and data to the original
FICSIT-Fred
FICSIT-Fredβ€’3mo ago
UObject* -# Responding to objectnaming triggered by @The Urban Goose
The Urban Goose
The Urban GooseOPβ€’3mo ago
Yeah, I don't get it, it's just not working Dunno what else to do here And set static mesh only outputs true of false, so I don't really have any idea why it's not working Yeah, I've got absolutely no fucking clue how to continue here. There are no functions that allow direct manipulation of the collisions, replacing the static mesh that actually has the collisions on it just doesn't work, and there is no way to get anything even remotely useful out of the logs.
Robb
Robbβ€’3mo ago
you will need something to detect when a train gets built or one loads in from the save file I think you could either hook begin play or use an SCS component hook to add your own component that does the mesh re-apply I am not sure if one would be better than the other, per-say, but I'd say try the SCS hook because I think it will deal with both the "new train" and "existing train loaded from save" cases easily ExampleMod and Vampirism have examples of using SCS hooks >docsearch SCS hook
FICSIT-Fred
FICSIT-Fredβ€’3mo ago
I encountered an error while trying to call this command. The error has been logged, sorry for the inconvenience.
Robb
Robbβ€’3mo ago
:feynoooo:
Robb
Robbβ€’3mo ago
Simple Construction Script (SCS) Hooks :: Satisfactory Modding Docu...
Introduced in SML3.5, Blueprint Simple Construction Script hooks allow adding modded Components to any blueprint-based actor. Mods can def...
Rex
Rexβ€’3mo ago
SCS hook would be reasonable, I'm not sure if it'd run when placing the train as a hologram but it shouldn't matter anyway
Robb
Robbβ€’3mo ago
if I recall correctly for your use case the mesh doesn't matter at placement time, you want to be able to stand on the side of trains, right?
The Urban Goose
The Urban GooseOPβ€’3mo ago
The train hologram shouldn't have the SM component I'm trying to replace Yeah, the hologram is it's own separate BP Not actually sure about that one, now that I looked at it again, still figuring out how everything works
Rex
Rexβ€’3mo ago
It shouldn't be a problem
The Urban Goose
The Urban GooseOPβ€’3mo ago
Yeah, from what I can see it should be fine Where in the example mod is the SCS hook?
Robb
Robbβ€’3mo ago
root instance module data (Blueprint SCS Hooks)
The Urban Goose
The Urban GooseOPβ€’3mo ago
Ah, got it
The Urban Goose
The Urban GooseOPβ€’3mo ago
This is... something
No description
The Urban Goose
The Urban GooseOPβ€’3mo ago
The SCS hook is loading the components and reporting they're owned by the locomotives
Robb
Robbβ€’3mo ago
your component will probably want to look at its owner, cast that to the train, check the mesh to make sure it's actually the vanilla train mesh and not a modded subclass, then change the mesh
The Urban Goose
The Urban GooseOPβ€’3mo ago
Yes, this worked perfectly
Solution
The Urban Goose
The Urban Gooseβ€’3mo ago
No description
No description
The Urban Goose
The Urban GooseOPβ€’3mo ago
all this to restore the train collisions they broke in 1.0
Robb
Robbβ€’3mo ago
excellent is there a QA site post about it? you could link your mod in the comments there
The Urban Goose
The Urban GooseOPβ€’3mo ago
I made one and didn't get any upvotes lmao
Rex
Rexβ€’3mo ago
Still, link to it anyway for visibility
The Urban Goose
The Urban GooseOPβ€’3mo ago
Will do
Robb
Robbβ€’3mo ago
link it here and I will upvote it lol
The Urban Goose
The Urban GooseOPβ€’3mo ago
For context:
No description
No description
The Urban Goose
The Urban GooseOPβ€’3mo ago
1st image is the collisions as they are in 1.0, 2nd image is the collision model that still is in the game files They just added a collision around the collision model I just went in and removed that I wanna be able to stand on the side of the engine
Rex
Rexβ€’3mo ago
I wonder if it's to have a convex collision mesh Or simplify collision checks in some way
The Urban Goose
The Urban GooseOPβ€’3mo ago
Probably, but it also means that my trains are now too big for my tunnels (and it did work in previous versions) Eh, doesn't matter, I fixed it now Thanks a ton for your help! (both of you)
Robb
Robbβ€’3mo ago
thanks for making the mod, I was bothered by the mesh change in game too but clearly not bothered enough, haha
The Urban Goose
The Urban GooseOPβ€’3mo ago
I'll send the link once I release it (gotta go afk for a moment) https://questions.satisfactorygame.com/post/66f3bf1a772a987f4a8d02ed This should be good to release without MP testing, right? (I'm gonna test it later tonight, just making sure) Yeah... should be fine
The Urban Goose
The Urban GooseOPβ€’3mo ago
Better Train Collision - SMR
Makes train locomotive collisions more accurate.
The Urban Goose
The Urban GooseOPβ€’3mo ago
(Also is it intended that #mod-updates skips the initial release of mods?)
Robb
Robbβ€’3mo ago
it isn't, I think you just got Digby'd (in-server term for #mod-updates not working for some reason, it happens unusually often to digby in specific)
The Urban Goose
The Urban GooseOPβ€’3mo ago
F The mod is so simple I don't think it'll ever need updating lmao
Robb
Robbβ€’3mo ago
you might for multiplayer, but probably not since you used scs hooks you should publish source πŸ‘‰ πŸ‘ˆ
Robb
Robbβ€’3mo ago
Creating a Git Repo for your Mod :: Satisfactory Modding Documentation
Once you have started working on a mod of your own, you should set up a repository to store your mod’s files. This page walks throug...
The Urban Goose
The Urban GooseOPβ€’3mo ago
That is a fair shout I just switched back to Linux though ;-; Gotta reboot again lol
Robb
Robbβ€’3mo ago
then we can get this added as a mod that uses SCS hook to the examples https://docs.ficsit.app/satisfactory-modding/latest/Development/OpenSourceExamples.html
Open Source Examples :: Satisfactory Modding Documentation
It’s impossible for this documentation to cover every aspect of making Satisfactory mods. However, there are quite a few open-source m...
The Urban Goose
The Urban GooseOPβ€’3mo ago
Fair enough, I'll brb once I'm on Windows In that case I'll just go over everything, make it look nice and pretty, and add some comments
Robb
Robbβ€’3mo ago
not urgent, you just rebooted after all
The Urban Goose
The Urban GooseOPβ€’3mo ago
Eh, not doing anything else right now (this also gives me an excuse to push an update lol) Update pushed, source code released @Robb (Nowβ„’)
The Urban Goose
The Urban GooseOPβ€’3mo ago
GitHub
GitHub - zuliwa/BetterTrainCollision: Satisfactory mod to change th...
Satisfactory mod to change the collision model of Locomotives - zuliwa/BetterTrainCollision
Robb
Robbβ€’3mo ago
sweet, could you write a brief summary in this style about what features you used? I can deal with formatting it if you don't want to
The Urban Goose
The Urban GooseOPβ€’3mo ago
Just in here?
Robb
Robbβ€’3mo ago
here or a PR, whatever's easiest for you docs repo is asciidoc (plain text editable) and already has a devcontainer if previewing it interests you
The Urban Goose
The Urban GooseOPβ€’3mo ago
I'll have a look, gonna get the thing typed up in notepad++ I'll see if I can be bothered to do the formatting :P
BetterTrainCollision

Replaces base game locomotive collision mesh.

Source Code: Linked on the Mod Page

Mod Type: Pure Blueprint

Notable Techniques Used:

- Custom Blueprint that finds the locomotive's collision mesh, and replaces it with a custom one
- Base game content modifications
- Replaces locomotive collisions with custom collision
- Makes sure only the basegame collisions are replaced, and no modified collisions get overwritten

Notable Satisfactory Features Used:

-None

Notable Mod Loader Features Used:

- SCS component hook to modify every locomotive instance
BetterTrainCollision

Replaces base game locomotive collision mesh.

Source Code: Linked on the Mod Page

Mod Type: Pure Blueprint

Notable Techniques Used:

- Custom Blueprint that finds the locomotive's collision mesh, and replaces it with a custom one
- Base game content modifications
- Replaces locomotive collisions with custom collision
- Makes sure only the basegame collisions are replaced, and no modified collisions get overwritten

Notable Satisfactory Features Used:

-None

Notable Mod Loader Features Used:

- SCS component hook to modify every locomotive instance
This look ok?
Robb
Robbβ€’3mo ago
yup, will add that on my side now thanks
Want results from more Discord servers?
Add your server