Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

Models are imported with float values instead of the saved zero for position and orientation #95

Open
Jerome-SeaMonster opened this issue Nov 29, 2022 · 5 comments

Comments

@Jerome-SeaMonster
Copy link

When using remodel and git, a model file that i had saved out with zero for its and its children's position and orientation values ends up being built into the scene with random float values. i m not sure if this is due to some sort of way the remodel system brings them into the workspace and then moves them to replicated storage or if its just a bug.

when importing that file manually the values show up correcting (being zero) and I'm able to use the model as intended.

has anyone else had this issue? and or know what could be causing this?

@j-meiring
Copy link

Hi all, please could someone look at this urgently? This is quite a pertinent issue for us so if there is something that can be done we would really appreciate any guidance as to how we can resolve this.

For more detail, we are using a fully managed Rojo project, using a PullAssets script to utilise Remodel's API to extract our .rbxm files into Roblox models.
We are using the following functions:
readDir()
isDir()
readModelFile()
readPlaceFile()
writePlaceFile()

And here you can see that when we open the .rbxlx file created by Rojo and remodelled, the position is off, compared to when we import the file into the place manually.
Built using rojo build -o Place.rbxlx && remodel run ./scripts/PullAssets.lua
Screenshot 2022-12-02 at 10 28 07
When the model (.rbxm file) is imported using "Import from file"
Screenshot 2022-12-02 at 10 28 51

We are automating our builds, so that when we do releases any team member can just pull the .rbxlx file out of the location and save it to Roblox without needing any knowledge of the technical scope, but this means that if we do come across this issue we could end up with releases being broken if they are unaware of models like this.

@Boegie19
Copy link
Contributor

Boegie19 commented Dec 2, 2022

@j-meiring @JeromeFLS
This is the first time I hear of an issue like this.

I think that somehow the model loses its location data or is changed somehow.

Does this always happen to the same assets? so yes could you send me the asset it happens to?

This could happen at multiple places
1 the PullAssets script somehow makes it lose its data
2 an edge cease in remodel or rbx-dom

Work around would be to
Make a building place that has all buildings like you would want them in the live game at the right positions
Import the whole workspace and use the build script to switch your workspaces around

@eAi
Copy link

eAi commented Dec 2, 2022

This isn’t very helpful, I’ve also not come across this. We have a somewhat similar workflow that relies on the position being saved correctly. I have occasionally seen floating point positions change very slightly when round-tripped through Rojo/Roblox Studio/Remodel.

Have you tried outputting as rbxmx files instead? That may fix the issue - or may at least help you diagnose it as it’s a human-readable format.

I’d suggest creating and sharing a minimal test case. That may identify the issue or help others solve it.

@j-meiring
Copy link

j-meiring commented Dec 5, 2022

@Boegie19 I've asked @JeromeFLS to provide you more detail - he constructed the model so can hopefully provide you with more detail around the actual assets.
@eAi, I tried the export, but it interestingly saves the incorrect positional data to the .rbxmx file - see below (I named the assets with the file extensions so you can see which is which):
Screenshot 2022-12-05 at 09 49 56
Screenshot 2022-12-05 at 09 50 03

Plot.rbxm was inserted from file, and shows the coordinates as they should be. The .rbxlx file using our remodel script, and saved the asset as .rbxmx. I inspected the xml in that file, and found that the WorldPivotData was somehow set here:

<OptionalCoordinateFrame name="WorldPivotData">
	<CFrame>
		<X>0</X>
		<Y>6.22428417</Y>
		<Z>0.736301422</Z>
		<R00>1</R00>
		<R01>0</R01>
		<R02>0</R02>
		<R10>0</R10>
		<R11>1</R11>
		<R12>0</R12>
		<R20>0</R20>
		<R21>0</R21>
		<R22>1</R22>
	</CFrame>
</OptionalCoordinateFrame>

Even when I changed all of the coordinates to 0, PullAssets still imported them with these values, until I inserted the file manually. For context, our script doesn't manipulate any properties at all, we essentially have directories which we convert to roblox directories and give the assets the relevant ones as parents, for example:

for _, modelFile in pairs(models) do
	if remodel.isDir("assets/" .. location .. "/" .. modelFile) == true then
		addRobloxDirectory(game, location, modelFile)
	else
		local assetModel = remodel.readModelFile("assets/" .. location .. "/" .. modelFile)[1]
		assetModel.Parent = getLocation(game, location)
	end
end

It looks to me, based on saving it from Roblox, that the world pivot data is being saved out of nowhere - I saved the asset where the coordinates were all 0 and a readable in the xml as having changed. Importing it from file still works as expected, but when the models are generated via the script, the properties pull through incorrectly.

@Jerome-SeaMonster
Copy link
Author

I think I've managed to find a work around to my issue. After adding new mesh objects to it, and removing model objects that were only being used as parent objects, And then placing the new meshes into folders instead, I'm no longer getting random position values after the remodel. I've also added a floor mesh that is now the primary part of this plot object and everything is working as expected.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants