Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Scripting rod forces
#19
(09-09-2025, 02:18 PM)josemendez Wrote: Modifying the velocity of the particle is the proper way to do this. This can be done by either writing into the velocities array, or writing into the externalForces array (forces get reset to zero after each step, and they result in an acceleration that depends on the mass of the particle, but at the end of the day they also modify the velocity).

Yeah, I tried both methods. The problem is that I don't move rod by pressing the keyboard arrow, but I try to keep it in sync with some depth value - for instance it's 10 meters at some point, but several frames later it will be 11 and rod should reflect that by moving 1m forward. There are two problems with that.
First one is pullback. I don't want my cable to go back on collision and that is the reason why I tried to "pin" particle - to disallow pullback from tension. I also thought about calculating tension to detect such a case and disable further movements against collider, because moving particle position directly forces constraints to break.
Second is related to first one. When movement is stopped, then velocity is 0 and other forces, constraints, collisions can move rod in general and it's not in sync anymore. I guess I would need to change approach to moving rod particle by invisible line, something like softbody dragon demo?

(09-09-2025, 02:18 PM)josemendez Wrote: If I understood correctly, you just want to just override the position of a particle? this can be done by setting the particle's inverse mass to zero. This will cause it to ignore forces (both internal/due to constraints and external) and you can just set its position. Reverting the inverse mass to its original value resumes dynamics simulation for the particle. This is how static attachments work internally. See: https://obi.virtualmethodstudio.com/manu...icles.html

I wanted, but that causes a lot of not physical things to happen, jitters or breaking constraints. Does pinhole do that actually? I think it does not.

(09-09-2025, 02:18 PM)josemendez Wrote: The alternative is using an iterative solver, which is how most other constraints (distance, stretch/shear, bend/twist, etc) in Obi work. These can yield approximate/good enough solutions even if they can't find *the* solution. Unfortunately this means you must rely on substeps/iterations to keep it stiff. Still, a moderate amount of substeps should yield rather stiff rods/ropes unless extreme forces, lengths, or resolutions are involved. Could you explain a bit more about your use case?

This is what I did, I increased solver substeps and iterations, but my rod is quite long and sometimes there might be sudden force shift (not sure to call it extreme), so in the end it's still not enough and the effect is that particles "float" or wiggle with delay. In my case rod is some kind of stiff cable and when I pull it I need the whole thing to move at the same time. You know, when you pull a plastic cable in reality it does not strech much, but the whole length moves at the same time.
My current solution do this problem is adding forces along the rope (according to particle orientations), not perfect, but definitely better than nothing. However I stillĀ  wonder if there is anything else I could do.

(09-09-2025, 02:18 PM)josemendez Wrote: Yes, still planned. ETA is end of October. There's many more changes coming to 7.2.

Nice! This is great news!
Reply


Messages In This Thread
Scripting rod forces - by Qriva0 - 08-08-2025, 06:33 PM
RE: Scripting rod forces - by chenji - 11-08-2025, 03:18 AM
RE: Scripting rod forces - by josemendez - 11-08-2025, 08:31 AM
RE: Scripting rod forces - by Qriva0 - 11-08-2025, 11:14 AM
RE: Scripting rod forces - by josemendez - 11-08-2025, 11:26 AM
RE: Scripting rod forces - by Qriva0 - 11-08-2025, 12:25 PM
RE: Scripting rod forces - by josemendez - 11-08-2025, 12:48 PM
RE: Scripting rod forces - by Qriva0 - 11-08-2025, 03:24 PM
RE: Scripting rod forces - by Qriva0 - 25-08-2025, 11:30 AM
RE: Scripting rod forces - by josemendez - 25-08-2025, 12:12 PM
RE: Scripting rod forces - by Qriva0 - 25-08-2025, 02:11 PM
RE: Scripting rod forces - by josemendez - 25-08-2025, 02:36 PM
RE: Scripting rod forces - by Qriva0 - 25-08-2025, 03:59 PM
RE: Scripting rod forces - by Qriva0 - 08-09-2025, 04:01 PM
RE: Scripting rod forces - by chenji - 09-09-2025, 02:46 AM
RE: Scripting rod forces - by Qriva0 - 09-09-2025, 09:56 AM
RE: Scripting rod forces - by chenji - 09-09-2025, 10:07 AM
RE: Scripting rod forces - by josemendez - 09-09-2025, 02:18 PM
RE: Scripting rod forces - by Qriva0 - Yesterday, 09:39 AM
RE: Scripting rod forces - by chenji - Yesterday, 10:02 AM
RE: Scripting rod forces - by josemendez - Yesterday, 10:25 AM
RE: Scripting rod forces - by Qriva0 - Yesterday, 11:48 AM
RE: Scripting rod forces - by josemendez - Yesterday, 12:06 PM
RE: Scripting rod forces - by Qriva0 - Yesterday, 01:40 PM
RE: Scripting rod forces - by josemendez - Yesterday, 03:28 PM