# Applying a variable force to an AnySeg.

Hi,

I’d like to know how to apply a variable force to an AnySeg object.

‘Variable force’ means that its size and acting point can be variable according to time.

If we see ‘AnyForce3D’, we can only set the dedicated AnyRefFrame and its vector.

I hope to get your advice.

Best regards,
Moonki

Hi Moonki,

You can use AnyFunInterPol for that. Please check the manual and the corresponding example - it is used in combination with AnyForce3D.

Best regards,
Pavel

Hi Pavel,

Thanks for your reply.

According to your help, I could download ‘Demo.Forces.any’ file from the chapter ‘The mechanical elements: Lesson 5: Forces’.

In the ‘Demo.Forces.any’ file, I could see that how to apply a time-varying size of force to a reference node of an AnySeg as you explained.

``````    AnyForce3D InterpForce = {

// Interpolation function. The interpolated data
// can also be read directly from a text file
AnyFunInterpol force = {
Type = PiecewiseLinear;
T = {     0.0, 0.2, 0.4, 0.6, 0.8, 1.0 };
Data = { {0.0, 1.0, 0.5, 2.0, 2.0, 0.0 }*100 };
};

AnyRefNode &PalmNode = Main.ArmModel.Segs.LowerArm.PalmNode;
AnyVector Fy = force(t);
F = {0,Fy[0],0}; // Force in Newton
};
``````

But as you can see in this code the acting point of the force is fixed to ‘&PalmNode’.

If I want to apply a force to a time-varying relative position of an AnySeg,
then should I use a dummy AnySeg and a kinematic driver between the dummy AnySeg and the original AnySeg that I want to apply force to?

Best regards and thanks in advance,
Moonki

Hi Moonki,

I am sorry for misreading your original message.

Yes, you are right, the dummy segment should help you. Drive it kinematically and introduce artificial reaction forces between the segments.

Best regards,
Pavel

P.S. Congratulations on defending your thesis (I noticed you changed ‘PhD candidate to PhD’)

Hi Pavel,

Thanks for your additional answer. Your answer is what I guessed.

Best regards,
Moonki

P.S) Thanks for noticing my changed status.