4

What is the difference between damping and frequency properties of a SKPhysicsJointSpring ?

the code I have is

var spring = SKPhysicsJointSpring.jointWithBodyA(
            body1.physicsBody,
            bodyB: body2.physicsBody,
            anchorA: body1.position,
            anchorB: body2.position)
spring.frequency = 1.8
spring.damping = 0.5
self.physicsWorld.addJoint(spring1)

body1.physicsBody?.dynamic = false
body2.physicsBody?.dynamic = true

In what range of values should frequency and damping fall so that the spring acts naturally?

Shruti Thombre
  • 989
  • 4
  • 11
  • 27
ielyamani
  • 17,807
  • 10
  • 55
  • 90

2 Answers2

3

Answer depends on what you consider "natural".

Damping means that the spring will dissipate energy with each oscillation and eventually come to rest.

Zero damping means that the mass attached to the spring will oscillate forever.

Such a system usually has three constants associated with it:

  1. mass m (lbm)
  2. spring stiffness k (lbf/in)
  3. damping coefficient c

It's well known that frequency f^2 = k/m.

When that system talks about spring "frequency" it makes no sense to me.

duffymo
  • 305,152
  • 44
  • 369
  • 561
  • Thank you for the clarification, so what sample values could I use for `mass`, `frequency` and `damping`? and How would the bounciness be affected if one of those changes? – ielyamani Sep 19 '14 at 18:08
  • "Bounciness" is controlled by the mass m and spring stiffness k. Make damping coefficiet c = 0 for now. Higher stiffness, lower mass mean higher frequency; lower stiffness, higher mass means lower frequency. – duffymo Sep 19 '14 at 18:12
  • lbm, lbf, in? What about kg, N or m? (Just kidding :) – Martin R Sep 19 '14 at 19:10
  • 2
    You mean the rational units that the rest of the world uses? You got me, @MartinR. – duffymo Sep 19 '14 at 19:59
  • @Carpsen90: I've given you something more valuable than code. You have to actually learn a little about physics to do this problem properly. – duffymo Sep 19 '14 at 20:00
  • Thank you for everything – ielyamani Sep 19 '14 at 20:37
0

It is useful to think of frequency as a measure of the spring's "stiffness", how it responds to compressive or lateral forces. Higher frequency means a stiffer spring. You'll often see values like 4.0 or 9.0. A frequency of 0.0001 is very, very loose!

However, a word of caution: this logic breaks down at the default frequency of 0.0. At frequency == 0.0, the spring is entirely rigid and non-compressive.

KSR
  • 221
  • 2
  • 4