- Home /
Interactive cloth, jittering when attached to a moving object
Hi, I'm new to Unity and have come against a problem using Interactive Cloth.
I'm not aiming to make a player cape, but to simplify my testing that's what i'm doing at the moment.
The problem I find is that (currently using default 3rd person camera & movement scripts) the cloth visibly lags behind the point where it is anchored. If I have it just attached to a cube object, the cube moves around smoothly but the cloth rapidly jumps forwards and backwards a little, kind of like it's always a frame behind everything else.
I didn't know if there's something I should be doing or whether this may be a bug/limitation?
I've tried to simplify everything as much as possible but it's always present. Here's the setup:
I've tried variations on numbers/types of attached colliders, using my own mesh or the default. With the player set up like this, when moving forward, the top of the cloth within the cube partially jumps out so it's visible what seems like every other frame.
If anyone's encountered this or is willing to quickly try it I'd be grateful for any thoughts on what might fix it. Thanks.
Answer by Julien-Lynge · Oct 04, 2011 at 10:45 PM
My guess would be that you have a mix of physical and non-physical movement. Cloth, I believe, moves physically, meaning it uses the PhysX engine to calculate its movement based on velocities, forces, etc. If you are moving the cube non-physically (i.e. by changing the transform directly), that movement happens instantaneously, once per frame, outside of the physics engine. In other words, the cube doesn't actually move smoothly from one position to the next as it appears to you, it moves discretely.
If that is the case, it explains why your cloth is jittering. Try making the cube a physical object by adding a rigidbody and moving it physically rather than by transform.
Answer by Jason B · Oct 04, 2011 at 11:31 PM
Try moving your object via LateUpdate() instead of Update().
Physics objects synchronize to LateUpdate(), so it should solve the problem. However I'm knee-deep in my own project right now so I can't test that theory myself at the moment.
I think this post and Julien have identified the issue, but LateUpdate() isn't the answer. Physics objects synch with FixedUpdate(), so that might be what you want.
Answer by amamateur · Oct 05, 2011 at 01:18 AM
Thanks guys, that sounds like it makes sense, although the solutions I tried didn't fix it. I changed the movement script to LateUpdate with no difference.
The movement is applied to a parent object "player" which contains the cloth, the cube and the attachment colliders. I tried adding Rigidbody to the "player" object, but the whole thing freaked out when I ran it. The cube itself shouldn't affect it, I can remove it alltogether so the "player" only contains the cloth & colliders but the jitter is still there, just not as visually pronounced without something smooth right next to it.
thanks
Answer by krides · Oct 23, 2011 at 08:17 AM
Hey, I was wondering if someone has already found solution to this problem. I’ve tried simply synchronizing movement of the cloth and the object it is attached to, which seems to be solving the jittering part of the problem, but it does add another one.
The thing is, when I move the object with a cloth not attached to it by synching with it, the end of the cloth attached to the object seems to be sliding on the surface, which becomes even worse when the fps drops.
In fact, the whole thing seems to be dependent on frame rate, as when the latter drops, the cloth slides further away.
Anyway, could you find a real answer to this question? If you did, I would really appreciate if you gave it to me.,
Something about not using an interactive cloth and using the skinned cloth component
Your answer
Follow this Question
Related Questions
Weird 3D Ball movement after Unity 5 Upgrade 1 Answer
Interactive cloth problem 1 Answer
iTween.MoveTo bug? 0 Answers
Is there any way to access a vertex of an interactive cloth? 0 Answers
Skinned cloth issue or bug 1 Answer