Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Usage of particle position variables
#4
(12-07-2024, 01:25 PM)wenhao_zheng Wrote: Thank you for your reply.

In your last reply, you mentioned two processes in the engine, which are updating velocity according to acceleration and updating position according to velocity.
For me, I implement work based on callback functions, such as the one I organized in the figure below.

What I want to confirm with you is that before OnEndStep, the velocity, acceleration, and position of particles are constantly updated with the operation of constraint simulations, right?
In my current understanding, if I set the absolute values of positions before OnEndStep, it may be overwritten by some physical simulation at some time, right?
So if I need to set the absolute values of positions of particles in the scene,  I can only set them in OnEndStep, right?
Hi!

The simulation is performed before collision callbacks are called, so if you modify the positions in the collision callback (as you are doing now) they won't be overwritten by the simulation.

OnEndStep is called immediately after collision callbacks and external force buffers have been cleared. Like this:

Code:
OnBeginStep()

foreach substep
{
OnSubstep()
// engine updates positions, velocities, etc here
}

OnCollision()
OnParticleCollision()
ResetExternalForces()
OnEndStep()

kind regards,
Reply


Messages In This Thread
RE: Usage of particle position variables - by josemendez - 15-07-2024, 09:39 AM