Posts: 75
Threads: 17
Joined: Jul 2025
Reputation:
0
Hi, obi actors (in my case rod) have got field with name massScale.
In mu understanding this is multiplier for particle mass and, indeed according to code it's used to with rotational mass and standard mass when blueprint is loaded.
However expected result was that it just influences weight of the actor, so when two actors collide, then the other one is heavier, but the result is that it affects a lot of things, for example compliances does not work in the same way, or collision with static colliders is alos different (but it could be side offect of compliance).
In theory that make sense because compliance is actually just added to weight.
Example from constraint:
Code: float3 dlambda = (omega.value.xyz - compliances * lambdas[i]) / (compliances + new float3(w1 + w2 + BurstMath.epsilon));
In any case, is that expected result? Should mass scale affect everything in this way? If yes, then what is affected except constraint? (I get completely different lambdas)
It seems it influences collision with static colliders too and also velocity applied to body, but shouldn't velocity be mass indepentent? (I add velocity with spring to controll rod movement)
Posts: 6,753
Threads: 28
Joined: Jun 2017
Reputation:
439
Obi Owner:
17-10-2025, 04:34 PM
(This post was last modified: 17-10-2025, 04:49 PM by josemendez.)
(17-10-2025, 03:55 PM)Qriva0 Wrote: In any case, is that expected result? Should mass scale affect everything in this way? If yes, then what is affected except constraint? (I get completely different lambdas)
Hi,
Mass affects acceleration due to forces, since F=ma and a = F/m.
So anything that involves forces (which is pretty much everything in the simulation - except for gravity which is an acceleration) will be affected by it. This includes aerodynamics (drag and lift forces), maybe this is what you mean by “velocity applied to body”?
It also affects the rigidness of rods, since it scales rotational mass which is the scale of the inertia tensor. As a result, rods with smaller rotational mass are more easily bent by external forces, regardless of compliance.
Lambdas reported by constraints will also of course be different as a result, since they're a measure of the force applied by the constraint: if you have two 5kg objects and must move them closer to each other to meet a distance constraint, the force you should apply to move them is larger than it would need to be if they weighed 1 kg.
(17-10-2025, 03:55 PM)Qriva0 Wrote: It seems it influences collision with static colliders too and also velocity applied to body, but shouldn't velocity be mass indepentent? (I add velocity with spring to controll rod movement)
Velocity (as a result of forces) is not independent of mass at all: if it were, a given force would always result in the same velocity regardless of the mass of the object it is applied to. This would make mass meaningless.
A spring (F=-kx) is a force so the resulting change in velocity (acceleration) must be affected by mass.
Kind regards
Posts: 75
Threads: 17
Joined: Jul 2025
Reputation:
0
Hi!
(17-10-2025, 04:34 PM)josemendez Wrote: Mass affects acceleration due to forces, since F=ma and a = F/m.
So anything that involves forces (which is pretty much everything in the simulation - except for gravity which is an acceleration) will be affected by it. This includes aerodynamics (drag and lift forces), maybe this is what you mean by “velocity applied to body”?
By this I meant that it does not matter what is the weight of the particle, if I add velocity directly, or particle already have velocity, then integration itself is not affected by mass (not talking about externalForces):
Code: // apply external forces and gravity:
float4 vel = velocities[i] + (inverseMasses[i] * externalForces[i] + effectiveGravity) * deltaTime;
(17-10-2025, 04:34 PM)josemendez Wrote: It also affects the rigidness of rods, since it scales rotational mass which is the scale of the inertia tensor. As a result, rods with smaller rotational mass are more easily bent by external forces, regardless of compliance. This is important bit for me, however is that the case for rod itself? If every single particle had the same weight, there were no collisions at all, then would that affect rigidness? (rot. masses are weighted, so is there other thing that could affect it?)
(17-10-2025, 04:34 PM)josemendez Wrote: Velocity (as a result of forces) is not independent of mass at all: if it were, a given force would always result in the same velocity regardless of the mass of the object it is applied to. This would make mass meaningless.
A spring (F=-kx) is a force so the resulting change in velocity (acceleration) must be affected by mass. In that sense yes, as I said above I mean calculation wise, because obviously to move heavier object I need more energy.
When it comes to my spring, I use all particles with the same weight and actually drive velocity directly (assuming mass 1), but somehow it behaves differently.
But, you mentioned aerodynamics are also affected and I can't find relation here (dragCoeff is multiplied by normalized direction and it's not affected by weight):
Code: velocities[p] += (-dragCoeff * rvNorm +
// lift:
liftCoeff * new float4(liftDirection.xyz,0)) *
// scale
attackAngle * math.min(aerodynamicFactor * invMasses[p] * deltaTime, 1000);
Posts: 6,753
Threads: 28
Joined: Jun 2017
Reputation:
439
Obi Owner:
20-10-2025, 10:58 AM
(This post was last modified: 20-10-2025, 11:18 AM by josemendez.)
(20-10-2025, 10:33 AM)Qriva0 Wrote: Hi!
By this I meant that it does not matter what is the weight of the particle, if I add velocity directly, or particle already have velocity, then integration itself is not affected by mass (not talking about externalForces):
Code: // apply external forces and gravity:
float4 vel = velocities[i] + (inverseMasses[i] * externalForces[i] + effectiveGravity) * deltaTime;
Correct, integration is not affected by mass. It's simply advancing the position using the velocity value.
(20-10-2025, 10:33 AM)Qriva0 Wrote: This is important bit for me, however is that the case for rod itself? If every single particle had the same weight, there were no collisions at all, then would that affect rigidness?
Yes it would. Internal forces are also forces.
Rotational mass is basically how much mass must be considered when it comes to bending the rod (which is done by rotating particles). You can think of it as the physical thickness of the rod: the more mass, the thicker the rod is, and the harder it is to bend it. Compliance also plays a role in this, as it's the bending resistance of the rod's material. "More" material (more mass) and harder material (less compliance) = harder to bend.
(20-10-2025, 10:33 AM)Qriva0 Wrote: In that sense yes, as I said above I mean calculation wise, because obviously to move heavier object I need more energy.
An important thing to note is that this also applies to constraint/internal forces, not just external forces. This is why constraint lagrange multipliers (lambdas) depend on mass.
(20-10-2025, 10:33 AM)Qriva0 Wrote: When it comes to my spring, I use all particles with the same weight
Doesn't matter whether all particles have the same weight or not. What matters is the mass of the particle being applied the spring force, compared to the magnitude of the force.
(20-10-2025, 10:33 AM)Qriva0 Wrote: and actually drive velocity directly (assuming mass 1), but somehow it behaves differently.
That can't be the case: if you ignore mass, forces become accelerations and all you're doing is modifying the velocity directly. Could you share your code for the spring?
(20-10-2025, 10:33 AM)Qriva0 Wrote: But, you mentioned aerodynamics are also affected and I can't find relation here (dragCoeff is multiplied by normalized direction and it's not affected by weight):
mass is right there in the equation you posted: the sum of drag and lift forces is multiplied by inverse mass (that is, divided by mass) to calculate acceleration. Then it's multiplied by time delta to get change in velocity, and an overall aerodynamic scale factor.
Quote:velocities[p] += (-dragCoeff * rvNorm +
// lift:
liftCoeff * new float4(liftDirection.xyz,0)) *
// scale
attackAngle * math.min(aerodynamicFactor * invMasses[p] * deltaTime, 1000);
Simplified:
Code: velocity += (dragForce + liftForce) / mass * dt;
that is,
Code: velocity += acceleration * dt;
Posts: 75
Threads: 17
Joined: Jul 2025
Reputation:
0
20-10-2025, 11:55 AM
(This post was last modified: 20-10-2025, 11:56 AM by Qriva0.)
(20-10-2025, 10:58 AM)josemendez Wrote: Yes it would. Internal forces are also forces.
Rotational mass is basically how much mass must be considered when it comes to bending the rod (which is done by rotating particles). You can think of it as the physical thickness of the rod: the more mass, the thicker the rod is, and the harder it is to bend it. Compliance also plays a role in this, as it's the bending resistance of the rod's material. "More" material (more mass) and harder material (less compliance) = harder to bend.
Where is that part of code that is affected by this? I checked bend constraint and yes compliance is added to weights of invRotMasses, but except that place is there anything else? I tested weights some time ago and I could not find difference in bending when mass was small or big, the only important thing was relation of masses.
(20-10-2025, 10:58 AM)josemendez Wrote: That can't be the case: if you ignore mass, forces become accelerations and all you're doing is modifying the velocity directly. Could you share your code for the spring? Yeah, I just double ask, because I expected the same result you described, so it should mean there is some other setting or script changing my movement.
I need to inspect my scene then, unless you can see something.
Code: private Vector4 CalculateSpringForce(Vector3 currentPosition, Vector3 targetPosition, Vector3 velocity)
{
Vector3 delta = targetPosition - currentPosition;
Vector3 direction = delta.normalized;
Vector3 projectedVelocity = Vector3.Dot(direction, velocity) * direction;
Vector3 force = stiffness * delta - projectedVelocity * damping;
return Vector3.ClampMagnitude(force, maxSpringVelocity);
}
// Spring force is calculated in OnSimulationStart [...]
Vector3 force = CalculateSpringForce(currentPosition, targetPosition, solver.velocities[solverIndex]);
solver.velocities[solverIndex] += deltaTime * force;
(20-10-2025, 10:58 AM)josemendez Wrote: mass is right there in the equation you posted: the sum of drag and lift forces is multiplied by inverse mass (that is, divided by mass) to calculate acceleration. Then it's multiplied by time delta to get change in velocity, and an overall aerodynamic scale factor.
Simplified:
Code: velocity += (dragForce + liftForce) / mass * dt;
that is,
Code: velocity += acceleration * dt;
Aaah yes, my stupid mistake, I overlooked the bracket ending there and I read that as dragForce + liftForce * mass * dt;
Ok so actually mass is even more important for me in such a case.
Last question to this topic - is collision different for single particle with static collider when mass is different? I guess friction is affected, but except that is there any difference for mass 1 or 100? Larger depenetration, some bounce or anything like that?
Posts: 6,753
Threads: 28
Joined: Jun 2017
Reputation:
439
Obi Owner:
20-10-2025, 12:19 PM
(This post was last modified: 20-10-2025, 12:23 PM by josemendez.)
(20-10-2025, 11:55 AM)Qriva0 Wrote: Where is that part of code that is affected by this? I checked bend constraint and yes compliance is added to weights of invRotMasses, but except that place is there anything else?
This is actually handled by stretch/shear constraints. These have a 4*invRotMass*sqr(restLength) term in the denominator. Note that only the mass of the current rod element is considered, it's not considering adjacent elements so it basically accounts for rotational inertia: how much of the displacement is shear in "rest space" and how much of it actually rotates the element.
See the original paper for details: https://animation.rwth-aachen.de/media/p...t-Rods.pdf
(20-10-2025, 11:55 AM)Qriva0 Wrote: I tested weights some time ago and I could not find difference in bending when mass was small or big, the only important thing was relation of masses.
There is quite a large difference in rod behavior when changing rotational mass. Test any of the sample scenes by changing the rotational mass of rod control points.
(20-10-2025, 11:55 AM)Qriva0 Wrote: Yeah, I just double ask, because I expected the same result you described, so it should mean there is some other setting or script changing my movement.
I need to inspect my scene then, unless you can see something.
Code: private Vector4 CalculateSpringForce(Vector3 currentPosition, Vector3 targetPosition, Vector3 velocity)
{
Vector3 delta = targetPosition - currentPosition;
Vector3 direction = delta.normalized;
Vector3 projectedVelocity = Vector3.Dot(direction, velocity) * direction;
Vector3 force = stiffness * delta - projectedVelocity * damping;
return Vector3.ClampMagnitude(force, maxSpringVelocity);
}
// Spring force is calculated in OnSimulationStart [...]
Vector3 force = CalculateSpringForce(currentPosition, targetPosition, solver.velocities[solverIndex]);
solver.velocities[solverIndex] += deltaTime * force;
Can't see anything suspicious here. Keep in mind that your damping depends on current velocity, and that current velocity can be affected by mass (via constraints, aerodynamics, etc), so that is a way that mass could change overall spring behavior.
(20-10-2025, 11:55 AM)Qriva0 Wrote: Last question to this topic - is collision different for single particle with static collider when mass is different? I guess friction is affected, but except that is there any difference for mass 1 or 100? Larger depenetration, some bounce or anything like that?
Nope, depenetration against a static collider is not affected by mass. Only by penetration distance.
Note that extremely large or extremely small mass values can affect collision behavior due to floating point accuracy, I've seen this before in some user scenes.
Posts: 75
Threads: 17
Joined: Jul 2025
Reputation:
0
(20-10-2025, 12:19 PM)josemendez Wrote: There is quite a large difference in rod behavior when changing rotational mass. Test any of the sample scenes by changing the rotational mass of rod control points. Well changing one control point to make some particles with different weight changed behaviour, but I mean situation where all particles are 10 or 0.1, I could not find much difference, if any. However I guess I know why - I think that I most likely tested that with all compliances set to 0, because as you said, changing mass actually affects rigidity, but only if compliance > 0.
This, combined with aerodynamics is probably the cause of different behaviour.
(20-10-2025, 12:19 PM)josemendez Wrote: Nope, depenetration against a static collider is not affected by mass. Only by penetration distance.
Note that extremely large or extremely small mass values can affect collision behavior due to floating point accuracy, I've seen this before in some user scenes. Good, so as expected.
Thank you very much, that was really helpful!
Posts: 6,753
Threads: 28
Joined: Jun 2017
Reputation:
439
Obi Owner:
21-10-2025, 10:14 AM
(This post was last modified: 21-10-2025, 10:30 AM by josemendez.)
(21-10-2025, 09:15 AM)Qriva0 Wrote: Well changing one control point to make some particles with different weight changed behaviour, but I mean situation where all particles are 10 or 0.1, I could not find much difference, if any. However I guess I know why - I think that I most likely tested that with all compliances set to 0, because as you said, changing mass actually affects rigidity, but only if compliance > 0.
I believe you're changing both mass and rotational mass, not rotational mass alone (as in inertia tensor magnitude). Uniformly changing both (which is what MassScale does) doesn't have any effect on rod rigidity, as linear to angular momentum ratio is kept fixed.
Changing rotational mass *only* does have a very large impact on rod behavior, as it should. Just tested in the "SpringRod" sample scene by selecting all control points and increasing/decreasing their rotational mass while leaving mass intact. This is equivalent to scaling the inertia tensor of a rigidbody in Unity.
Keep in mind that the inertia tensor is to angular moment what mass is to linear moment: it modulates the effect of torques (angular "forces") on velocity:
Linear: Force = Mass * linear acceleration. (in literature, F = m * a)
Angular: Torque = Inertia tensor * angular acceleration. (in literature, tau = I * alpha)
If you change both mass and inertia tensor together, there will be no qualitative effect on body behavior. However if you change their ratio, behavior will change since the object is now easier/harder to rotate than it is to translate. When dealing with a rod, this means it's easier/harder to bend than it is to stretch.
Hope this makes sense. Let me know if I can be of further help!
Posts: 75
Threads: 17
Joined: Jul 2025
Reputation:
0
24-10-2025, 09:35 AM
(This post was last modified: 24-10-2025, 09:38 AM by Qriva0.)
Aw, I forgot to click post reply.
(21-10-2025, 10:14 AM)josemendez Wrote: I believe you're changing both mass and rotational mass, not rotational mass alone (as in inertia tensor magnitude). Uniformly changing both doesn't have any effect on rod rigidity, as linear to angular momentum ratio is kept fixed.
Changing rotational mass *only* does have a very large impact on rod behavior, as it should. Just tested in the "SpringRod" sample scene by selecting all control points and increasing/decreasing their rotational mass while leaving mass intact. This is equivalent to scaling the inertia tensor of a rigidbody in Unity.
Keep in mind that the inertia tensor is to angular moment what mass is to linear moment: it modulates the effect of torques (angular "forces") on velocity:
Linear: Force = Mass * linear acceleration.
Angular: Torque = Inertia tensor * angular acceleration. (in literature, tau = I * alpha)
If you change both mass and inertia tensor together (which is what MassScale does), there will be no qualitative effect on body behavior. However if you change their ratio, behavior will change since the object is now easier/harder to rotate than it is to translate. Applied to a rod, this means it's easier/harder to bend than it is to stretch.
Hope this makes sense. Let me know if I can be of further help!
Oh you are right, yes I did what you described and touched both values. In addition I noticed there is way bigger change when value is like 0.01 than 10 or 100 and I tried to operate more around 0.1-10. What was counterintuitive for me right now is that compliance 0 and different masses can change rigidity of rod itself even when there are no collisions, I thought that if I want very rigid rod I need to set it to 0 and that is max I can get, meanwhile ratio of rotational mass and mass changes rigidity completely.
I have one question, but it's more about next version of obi (with compliance factors per particle), what is difference then, between rotational mass ratio and compliance for bending? I understand there is difference I can kind of feel it, but overall both control similar thing. Does it mean that with new system I can set big rotational mass to make rod very rigid, but then set compliance to big value and the result would be rigid rod, but with capability to bend sagnificantly during collision?
Does it actually mean I can create similar behaviour even right now by increasing rotational mass of the whole rod?
Because that is my goal, responsive and "rigid rod" when it comes to movement, but at the same time bendable when colliding with other (static) objects. (so far rigidity meant it behaves like rod made of iron)
Posts: 6,753
Threads: 28
Joined: Jun 2017
Reputation:
439
Obi Owner:
24-10-2025, 10:24 AM
(This post was last modified: 24-10-2025, 10:45 AM by josemendez.)
Hi!
(24-10-2025, 09:35 AM)Qriva0 Wrote: what is difference then, between rotational mass ratio and compliance for bending?
Rotational mass = "how much material is there?" and can be understood as the thickness of the rod, as far as physics are concerned.
Compliance = "how soft is the material?", so it sort of modulates the rotational mass.
In other words: having a very thick but soft rod (high mass, high compliance) is similar to having a very thin but hard one (low mass, low compliance). Even if your material has zero compliance, making the rod very thick (high rotational mass) will make it very hard to bend.
Keep in mind however that compliance affects both linear and angular forces. Linear and rotational masses only affect linear and angular forces respectively.
(24-10-2025, 09:35 AM)Qriva0 Wrote: I understand there is difference I can kind of feel it, but overall both control similar thing. Does it mean that with new system I can set big rotational mass to make rod very rigid, but then set compliance to big value and the result would be rigid rod, but with capability to bend significantly during collision?
No. External forces (collisions, wind, gravity, inertial forces, etc) and internal forces (forces that originate inside the object and keep its shape, such as the forces applied by constraints between particles) act on the exact same material (same mass, same compliance) so forces of the same magnitude must result in the same acceleration, regardless of where they originate from.
(24-10-2025, 09:35 AM)Qriva0 Wrote: Because that is my goal, responsive and "rigid rod" when it comes to movement, but at the same time bendable when colliding with other (static) objects. (so far rigidity meant it behaves like rod made of iron)
Think of a foam ball so soft that collapses under its own weight, but that feels hard as concrete when you try to sink your finger on it: this is physically impossible, objects must respond to all forces equally. Any other behavior would mean the object magically changes its mass or its constitutive model depending on the force affecting it, which doesn't make any sense.
You might be able to get comparable behavior by moving the solver component instead of the rod: this kinematically transforms all actors under it which means moving the solver won't inject any forces on the rod (or rather, the % of inertial force injected by the solver is controllable using the solver's linear/angular world inertial scale parameters). However, collisions still will be able to bend the rod as usual.
The combination of controllable inertial forces while moving with regular collision forces might do the trick.
kind regards,
|