Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make terrain assets reusable #121

Merged
merged 8 commits into from
Oct 25, 2022
Merged

Make terrain assets reusable #121

merged 8 commits into from
Oct 25, 2022

Conversation

JamesTKhan
Copy link
Owner

@JamesTKhan JamesTKhan commented Oct 23, 2022

The goal of this PR is to make Terrain Assets place-able and re-usable. Before, once a terrain asset was removed from a scene, it became unusable and could not be placed ever again. This PR adds a button when inspecting a terrain asset to add it to the scene (like models). The PR also makes it possible to reuse the same terrain asset in the same scene (like models). This required a somewhat large refactor of the Terrain class. The terrain class behaved like a ModelInstance, which made it difficult to be reusable.

Instead the terrain class has been modified to behave more like a Model, and now TerrainComponent holds the ModelInstance reference (similar to ModelComponent) and transform data. Transform was removed from the Terrain class. This allows the asset/terrain to be reusable. Note that this does not COPY a terrain asset. If you modify one instance of the terrain, it will affect all instances (just like models).

This has a bonus of fixing a bug with terrain transforms where their positions sometimes do not update.

Untitled.24.mp4

@JamesTKhan JamesTKhan linked an issue Oct 23, 2022 that may be closed by this pull request
@JamesTKhan JamesTKhan marked this pull request as ready for review October 24, 2022 03:54
@JamesTKhan JamesTKhan merged commit 9a478f6 into master Oct 25, 2022
@JamesTKhan JamesTKhan deleted the reuse-terrain-assets branch October 25, 2022 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Water/Terrain assets are not reusable/able to be placed again
1 participant