Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  actor‘s update time
#2
(28-12-2020, 09:45 AM)FZMv587 Wrote: Hi!
I use actor.ResetParticles(); to reset rope to the former position.
When i use this is the actor data (like particles position) will be updated in the same time? or it will take a while?
If it need some times when can i use the new position data?

Most particle data will be updated immediately. If you take a look at the ResetParticle() source code, you'll see that solver.positions and solver.velocities are immediately written to:

Quote:public void ResetParticles()
        {
            if (isLoaded)
            {
                Matrix4x4 l2sTransform = actorLocalToSolverMatrix;
                Quaternion l2sRotation = l2sTransform.rotation;

                for (int i = 0; i < particleCount; ++i)
                {
                    int solverIndex = solverIndices[i];

                    solver.positions[solverIndex] = l2sTransform.MultiplyPoint3x4(sourceBlueprint.positions[i]);
                    solver.velocities[solverIndex] = l2sTransform.MultiplyVector(sourceBlueprint.velocities[i]);

                    if (usesOrientedParticles)
                    {
                        solver.orientations[solverIndex] = l2sRotation * sourceBlueprint.orientations[i];
                        solver.angularVelocities[solverIndex] = l2sTransform.MultiplyVector(sourceBlueprint.angularVelocities[i]);
                    }
                }
            }
        }

Some data however, such as solver.renderablePositions, will only be updated at the end of the next simulation step (FixedUpdate, LateUpdate, or whenever the solver is being updated, determined by what ObiUpdater component you're using).

cheers,
Reply


Messages In This Thread
actor‘s update time - by FZMv587 - 28-12-2020, 09:45 AM
RE: actor‘s update time - by josemendez - 28-12-2020, 03:48 PM
RE: actor‘s update time - by FZMv587 - 28-12-2020, 03:52 PM
RE: actor‘s update time - by FZMv587 - 29-12-2020, 08:28 AM
RE: actor‘s update time - by josemendez - 29-12-2020, 09:36 AM
RE: actor‘s update time - by FZMv587 - 29-12-2020, 10:13 AM