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

Object with a lattice deformable are incorrectly translated in the world #75

Closed
rlalance opened this issue Dec 12, 2022 · 11 comments
Closed

Comments

@rlalance
Copy link

Describe the bug
After applying a lattice deformer and worked with the control points, an object that looks good in editor mode will get positioned incorrectly in playmode.

To Reproduce
Steps to reproduce the behavior:

  1. Apply a Lattice deform on a rock with 4 LODs
  2. Answer yes to all in the questions regarding the LOD
  3. Modify the controls points
  4. Apply scale to the lattice deform
  5. Run playmode.
  6. Result: The object is moved way into the distance

Expected behavior
Object should look the same between edit mode and play mode.

Screenshots
image
image
image

And result which is wrong:
image
image

  • OS: Windows 10
  • Unity: 2021.3.11f1
  • Deform version: 1.2.1]

Additional context
Once this feature is working probably, i'm going to use this throughout my level.
Please contact me as I am interested in funding the completion of this deformable lattice.

@rlalance rlalance changed the title Object with a lattice deformable are translated in the world in the distance Object with a lattice deformable are incorrectly translated in the world Dec 12, 2022
@keenanwoodall
Copy link
Owner

Sorry to hear about that. I tried going through your steps, but have been unable to reproduce the bug. Would it be possible for you to zip me a repro project?

@rlalance
Copy link
Author

Certainly!

@rlalance
Copy link
Author

rlalance commented Dec 15, 2022

Just realised, the console had errors in it regarding read/write. I thought I had press the FIX IT button...

image

And I can't seem to be able to locate Combined Mesh in my project.. :(

@rlalance
Copy link
Author

Yup, I have read/write on all my rock meshes.

@rlalance
Copy link
Author

@keenanwoodall Going to try with other rocks.
When I tried to package the scene, everything came in, so i'm not sure how to send you just the buggy rock.

@keenanwoodall
Copy link
Owner

Just realised, the console had errors in it regarding read/write. I thought I had press the FIX IT button...

image

And I can't seem to be able to locate Combined Mesh in my project.. :(

The errors in the console indicate the game-object is statically batched. Unity is combining all the static game-objects into one mesh when you enter play-mode or make a build and the Deformable cannot read/write to that mesh.

@keenanwoodall
Copy link
Owner

Each game-object has static flags for different things. If you check the static toggle on you turn on all static flags, but you can specifically disable static batching to fix the error.
image

That being said, I think the optimal way for Deform to handle this would be for the Deformable to detect if it is on a statically batched game-object and disable/remove itself automatically. I will look into adding this functionality.

@keenanwoodall
Copy link
Owner

This problem is a symptom of a larger problem which is that Deform does not have a proper controls for Deformable stripping. I ended up making a new feature branch that adds a "Strip Mode" parameter to Deformable components. This parameter is forced on when static batching is enabled on a game-object
image

Let me know if this works for you! It should also solve the issue of meshes getting teleported as that was caused by static batching

@rlalance
Copy link
Author

OH really!!! This is great!! Will try that ASAP.

@rlalance
Copy link
Author

Umm, ok, I have one more error to solve and that should be it.
I think you can close this for now.

Thank you @keenanwoodall

@keenanwoodall
Copy link
Owner

Sounds good, thanks for finding this issue!

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

No branches or pull requests

2 participants