26-09-2018, 03:02 PM
(This post was last modified: 26-09-2018, 03:03 PM by josemendez.)
(25-09-2018, 11:08 AM)Sewy24 Wrote: Hello Jose,
thanks for the reply.
"Fixed particles are not interpolated, which I believe it is what led you to use skin constraints instead." this is exactly the thing.
Unfortunately moving the code with summary
from OnSolverStepBegin() to OnSolverFrameEnd() has no interpolation effect on the fixed particles. (Every other particle is butter smooth in both cases). - I've try to move it to other functions as well in case of typo, but not change at all.Code:/**
* Transforms the position of fixed particles from local space to simulation space and feeds them
* to the solver. This is performed just before performing simulation each frame.
*/
My bad, there's another important difference that affects the fixed particle behaviour when paired with skinned meshes. In ObiSolver.cs, SimulateStep() method, you'll see a call to Oni.UpdateSkeletalAnimation();. Move this call to the solvers Update() method, right after the loop calling actor.OnSolverFrameBegin();. Would look like this:
Code:
void Update(){
if (!Application.isPlaying)
return;
if (OnFrameBegin != null)
OnFrameBegin(this,null);
foreach(ObiActor actor in actors)
actor.OnSolverFrameBegin();
// Update Oni skeletal mesh skinning after updating animators:
Oni.UpdateSkeletalAnimation(oniSolver);
if (IsUpdating && simulationOrder != SimulationOrder.LateUpdate){
AccumulateSimulationTime(Time.deltaTime);
}
}
This will ensure that the actual skinned mesh is updated every frame, not only during physics steps.
Also note that for this to work, the transform that the cloth is attached to (Cube_simul) must be translated in Update(), not in LateUpdate() (there would be a 1-frame delay) or FixedUpdate() (fixed particles would not be interpolated) as you're currently doing.