Search Unity

Simple harmonic motion pendulum, how to?

Discussion in 'Editor & General Support' started by Mateq, Sep 29, 2014.

  1. Mateq

    Mateq

    Joined:
    Jul 15, 2013
    Posts:
    4
    Hello!
    I`m trying to make an obstacle-pendulum and I want it to return it back and forth to the same positions on top.
    My obstacle consists of 3 elements:
    -base(at rest)
    -line
    -spikeyball/mass

    Spikeyball is connected to the line via fixed joint and the line is also connected to the base via fixed joint.

    All objects are rigidbodies with 0 drag/angular drag.

    The problem is, the amplitude is decreasing in the time and I want it to swing forever.

    Any ideas?
     

    Attached Files:

  2. Mateq

    Mateq

    Joined:
    Jul 15, 2013
    Posts:
    4
    No one knows ? :(
     
  3. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    Can't say for sure when it comes to Unity/PhysX, but having spent the better part of the last 14 years writing physics engines, I can say that they have a way of numerically dissipating. I.e., even with damping of 0 there will still be some damping.

    If this is just meant to be a pendulum that is supposed to be moving exactly the same way every time it swings back and forth, I'd probably just solve it kinematically without using the physics. I.e., control the angles directly.

    If that's not really an option or is too difficult, I'd try adding a little force to it to keep it swinging. Maybe when it swings through the bottom you could give it a tiny little kick?
     
    Mateq likes this.
  4. Mateq

    Mateq

    Joined:
    Jul 15, 2013
    Posts:
    4
    Alright, so I made an animation of rotating ball and it works just fine.