keenanwoodall / Deform

A fully-featured deformer system for Unity that lets you stack effects to animate models in real-time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object with a lattice deformable are incorrectly translated in the world

rlalance opened this issue · comments

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.

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?

Certainly!

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.. :(

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

@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.

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.

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.

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

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

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

Sounds good, thanks for finding this issue!