Navigation Menu

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

GridMap - Include transforms of tile object's children when generating .meshlib file #11722

Closed
Tracked by #10418
Scott3730 opened this issue Sep 30, 2017 · 7 comments · Fixed by #26308
Closed
Tracked by #10418

Comments

@Scott3730
Copy link

Scott3730 commented Sep 30, 2017

(currently using Godot 3.0, build from the 27th of September)

When creating a meshlib for use with a GridMap, the engine currently forces all components of each tile to be centred. This makes sense for neatly rotatable tiles of uniform size. But in some use cases, you want objects that are off-centre, and you still want them to have collision details.

image

  • My bookshelf model is deliberately off-centre so that it can be placed against a wall (it only takes up half a grid-space along one axis)
  • If I want to add a StaticBody with a BoxCollisionShape, I can't offset them to cover just the geometry (because they don't export their transforms, they are locked to the centre of the tile, or grid space)
  • I can centre its pivot in my modelling program, then I can apply the StaticBody and BoxCollisionShape. This will give me correct collision geometry, but my object is then forced to be in the centre of the tile/grid-space (which is undesired).
    image
  • Ideally, the children of the MeshInstance nodes should retain their transforms when a .meshlib is created from a scene.

This effect is exaggerated if you imagine the bookshelf is a painting, or something thin that you would typically mount on a wall, not in the centre of a grid space.

You can also imagine a half-tile object in a grid space would be affected by this issue.

@BastiaanOlij
Copy link
Contributor

BastiaanOlij commented Sep 30, 2017 via email

@Scott3730
Copy link
Author

Scott3730 commented Sep 30, 2017

That is actually one of the cases that I outlined above. Offsetting the meshes isn't a problem at all, because you can just offset them in your modelling software of choice.

The issue is that you can't use collision information for meshes that are off centre, because the transforms of child nodes aren't stored when creating the .meshlib file. This means that CollisionShapes and StaticBodies are forced to be centred, even when the source model is not.

Specifically in the screenshot above, the StaticBody would need to be offset to match the offset of the model - which is currently impossible.

@Scott3730
Copy link
Author

Having this functionality would also allow you to composite tiles from multiple meshes, although I'm not sure how useful that would be to have.

@Scott3730 Scott3730 changed the title [Feature Request] GridMap enhancement - Include transforms of tile object's children when generating .meshlib file Feature Request: GridMap enhancement - Include transforms of tile object's children when generating .meshlib file Oct 1, 2017
@kubecz3k kubecz3k changed the title Feature Request: GridMap enhancement - Include transforms of tile object's children when generating .meshlib file GridMap - Include transforms of tile object's children when generating .meshlib file Oct 5, 2017
@reduz
Copy link
Member

reduz commented Nov 7, 2017

kicking to 3.1, out of time

@reduz reduz modified the milestones: 3.0, 3.1 Nov 7, 2017
@ghost
Copy link

ghost commented Jan 25, 2018

You can edit the center in Blender or you can go in edit mode and offset the vertices . This will create an offset mesh. Then you can use this offset mesh to generate a convex collision sibling that will also be offset. Of course if you use a complex 3D model you must simplify it re-import it and use only the generated collision
image

@reduz reduz self-assigned this Sep 5, 2018
@reduz reduz added enhancement and removed bug labels Nov 2, 2018
@reduz
Copy link
Member

reduz commented Nov 2, 2018

This is more like a wishlist enhacement more than a bug, if someone wants to do it in MeshLibraryEditorPlugin, feel free.

@akien-mga akien-mga modified the milestones: 3.1, 3.2 Jan 9, 2019
bojidar-bg added a commit to bojidar-bg/godot that referenced this issue Feb 26, 2019
…rary

Would have added mesh transform, but realized that will cause problems when moving the mesh around the scene for visualization purposes.

Closes godotengine#11722
@TrueSgtMonkey
Copy link

If the 2D tileset editor has this, then why wouldn't the 3D GridMap have this offset feature?

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

Successfully merging a pull request may close this issue.

6 participants