Sometimes built in tools are not enough to simulate motion, for example to simulate harmonic oscillator with damping or to simulate forces oscillation, where we need external sinusoidal variable force.
This can be achieved by applying a variable force or torque on body.
How to apply force:
Right click on body node in simulation tree panel, or on body itself to show pop up menu, then select apply force at a point in menu
It opens add force dialog as shown
Set value of force (it can be a number of expression) and point on body in local coordinates (where (0,0) corresponds to center of mass) and then click apply to add force to the simulation.
Expression Syntax for force:
each component of force can be set as a valid mathematical expression with following allowed operators and variables
operators: plus minus(+ -), product (*), division(/), power (^)
variables: e, pi, instanteneous time (t),speed(v),velovity components (v_x, v_y) and coordinates(x, y) of body on which force is applied
functions: all trigonometric(sin, cos etc), algebric(sqrt, exp) etc
variables are automatically updated to their instanteneous values before applying forcein every step.
To simulate harmonic oscillation along x axis with force constant k and damping coefficient b on body.
set force's x component as k*x-b*v_x and forces's y cmponent as 0. (also make sure either gravity is zero or object is placed on smooth platform)