Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[HELP] Implementing 2D joints

Discussion in 'Project Tiny' started by Eulenmensch, May 4, 2019.

  1. Eulenmensch

    Eulenmensch

    Joined:
    Mar 10, 2018
    Posts:
    19
    Hello again :)

    I'm currently trying to get joints to work in unity tiny to simulate rope physics or more specifically a sticky-hand.
    My current implementation of spring/string joints works fine for a certain set of spring constants(stiffness of the spring k) and damping coefficients but for very high stiffness values which are necessary for ropes, everything just explodes. I think this might have to do with timestep and high forces but I'm not too familiar with physics simulation so I might be wrong.
    This makes creating a rope quite difficult since low stiffness just feels very weird.
    There is also a force applied at the very start of the game which I cannot quite understand. My guess is that it's the spring working against the gravitational force for the first time but it also makes the game startup with the rigidbody already flying around instead of in a resting position.

    If anyone has any kind of advice, I would greatly appreciate it!
     
  2. Eulenmensch

    Eulenmensch

    Joined:
    Mar 10, 2018
    Posts:
    19
    Okay so changing the RigidBody2D body type to bullet dynamic has improved the performance of my spring at somewhat higher values, making my simulation applicable for my use case now.
    However, a gripe that I still have with it is that to apply the accurate force, I currently have to divide it by the time between physics simulation steps since the only available method is to use addImpulse, which is force over time.
    I can't, however, seem to find the physics timestep anywhere in the documentation so I'm currently using deltaTime. This, of course, makes my physics simulation dependent on framerate, which just doesn't feel quite right ^^

    Is the physics timestep accessible somehow?