- Home /
Help creating a physics based spring
Hi, I'm working on a 2D top-down game and am trying to make something so that when the player collides with this spring objects "loose end" and based on a rigid body force it will be pushed back. I need to use F = - k x as a basis for my code. What I have set up so far is the spring object with a loose/fixed end:
I want to make a script using that formula of (F = - k x) that compresses the "loose end" towards the "fixed end" and based on a rigid body force pushes the player back. Trying to set-up spring force equation - distance traveled from the relaxed position, then use spring force to determine how much is force needed to compress spring and then when it will stop compressing and push the player back.
Your answer
Follow this Question
Related Questions
Force normal to spring axis 0 Answers
Problems making a glider 3 Answers
Character Controller meets Rigidbody 1 Answer
add force to object that has 2 different rigid bodies 0 Answers
Ignore Force Imparted By Object 0 Answers