When I'm trying to understand the simulation process of DOP network, and try to write it from scratch in the SOP solver. I find that the calculation order of DOP network is like e.g.
vectorvelocity = set(3, 1, 0);
vectorforce = set(0,-1,0);
v@finalvel = velocity + force * @TimeInc; //Add the S velocity to the frame force?v@framevel = v@finalvel * @TimeInc ;
But my question is why can't it be written like this?
it's ultimately up to you how you design your solver
how Houdini solvers work is that v, accel, force are all represented as units per second so if you want to replicate that and potentially stay compatible it's not helpful to do a oneliner that reduces v to units per timestep since then you would have to divide it by @TimeInc again to get v per second to pass to next tiemstep
the reason you don't want to keep v attribute in unit per timestep is that timestep can vary, @TimeInc doesn't represent frame if substeps are involved whether DOP level or introduced by other microsolvers like GasSubstep DOP etc.
Thank you Tomas. Sorry, but I just want to make it clear that according to your code, it won't be the result that should be expected mathematically. Is that right? For example, suppose v= (3, 1, 0), force= (0, -1, 0) should theoretically get (1, 0, 0) after one second, but according to your algorithm, this is not the case.
On the contrary, if we multiply V by @TimeInc at the beginning to get frame based V, and then use frame based force to affect frame based V,like(velocity * @TimeInc + force * @TimeInc) we will get the expected value.
ILIAZHAO For example, suppose v= (3, 1, 0), force= (0, -1, 0) should theoretically get (1, 0, 0) after one second, but according to your algorithm, this is not the case.
I'm gonna assume you meant that the result should be (3,0,0) and that's exactly what you'll get after 1s if it makes it easier you can assume f@mass=1 and therefore remove it from the equation if you want to start simple or if you only need gravity
The unit of velocity is distance/second. Velocity multiplied by time becomes distance. The unit of force is the same as that of acceleration. So acceleration multiplied by second becomes velocity.
If initial velocity is 10 and force(acceleration) is applied for 0.1 seconds: Final velocity = initial velocity + acceleration * 0.1
Why do you think you should multiply time to the velocity?
Oh, Sorry. You are right (3, 0, 0) I accidentally typed the wrong number.
And I finally understood my mistake. The reason why I write (velocity * @TimeInc + force * @TimeInc) is that I regard the force here as a constant velocity rather than an acceleration. This will cause my solver to produce a uniform motion rather than a quadratic function trajectory. I didn't wrap my mind about this at that time.
@ifree At the beginning, I wanted to multiply the initial velocity by @TimeInc because I thought the initial velocity was based on seconds rather than frames, so I wanted to change that to frame Initial velocity.
@ifree Thank you for your reply. I confused some concepts before. The initial velocity is constant in every frame or second, unless I want it to affect the position, I need to divide it by 24. I multiplied the initial velocity by @timeinc, which means that I mistakenly took the initial velocity as the initial acceleration, so I thought I would get its value at each frame.